# HG changeset patch # User Thomas Wuerthinger # Date 1433632115 -7200 # Node ID bb72c486714a99db841eb624ebada18c3d5c91bf # Parent a7a1b9b65bce56d474ffffea81509e9000f9253c Lower TypeCheck node in first lowering. diff -r a7a1b9b65bce -r bb72c486714a graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java Sun Jun 07 00:47:10 2015 +0200 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java Sun Jun 07 01:08:35 2015 +0200 @@ -2220,7 +2220,7 @@ frameState.push(Kind.Object, exception); FixedNode nextDispatch = createTarget(nextBlock, frameState); checkCast.setNext(catchSuccessor); - append(new IfNode(graph.unique(new InstanceOfNode((ResolvedJavaType) catchType, exception, null)), checkCast, nextDispatch, 0.5)); + append(new IfNode(graph.unique(InstanceOfNode.create((ResolvedJavaType) catchType, exception, null)), checkCast, nextDispatch, 0.5)); } else { handleUnresolvedExceptionType(catchType); } diff -r a7a1b9b65bce -r bb72c486714a graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Sun Jun 07 00:47:10 2015 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Sun Jun 07 01:08:35 2015 +0200 @@ -120,6 +120,7 @@ public void lower(LoweringTool tool) { Stamp newStamp = StampFactory.declaredTrusted(type).improveWith(object().stamp()); LogicNode condition; + LogicNode innerNode = null; ValueNode theValue = object; if (newStamp.isEmpty()) { // This is a check cast that will always fail @@ -127,11 +128,13 @@ newStamp = StampFactory.declaredTrusted(type); } else if (StampTool.isPointerNonNull(object)) { condition = graph().addWithoutUnique(InstanceOfNode.create(type, object, profile)); + innerNode = condition; } else { if (profile != null && profile.getNullSeen() == TriState.FALSE) { FixedGuardNode nullCheck = graph().add(new FixedGuardNode(graph().unique(new IsNullNode(object)), UnreachedCode, InvalidateReprofile, true)); PiNode nullGuarded = graph().unique(new PiNode(object, object().stamp().join(StampFactory.objectNonNull()), nullCheck)); - InstanceOfNode typeTest = graph().addWithoutUnique(new InstanceOfNode(type, nullGuarded, profile)); + LogicNode typeTest = graph().addWithoutUnique(InstanceOfNode.create(type, nullGuarded, profile)); + innerNode = typeTest; graph().addBeforeFixed(this, nullCheck); condition = typeTest; /* @@ -145,7 +148,8 @@ } else { // TODO (ds) replace with probability of null-seen when available double shortCircuitProbability = NOT_FREQUENT_PROBABILITY; - InstanceOfNode typeTest = graph().addWithoutUnique(new InstanceOfNode(type, object, profile)); + LogicNode typeTest = graph().addOrUnique(InstanceOfNode.create(type, object, profile)); + innerNode = typeTest; condition = LogicNode.or(graph().unique(new IsNullNode(object)), typeTest, shortCircuitProbability); } } @@ -154,6 +158,10 @@ PiNode piNode = graph().unique(new PiNode(theValue, newStamp, valueAnchor)); this.replaceAtUsages(piNode); graph().replaceFixedWithFixed(this, valueAnchor); + + if (innerNode instanceof Lowerable) { + tool.getLowerer().lower(innerNode, tool); + } } @Override diff -r a7a1b9b65bce -r bb72c486714a graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java Sun Jun 07 00:47:10 2015 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/DefaultJavaLoweringProvider.java Sun Jun 07 01:08:35 2015 +0200 @@ -73,6 +73,7 @@ @Override public void lower(Node n, LoweringTool tool) { + assert n instanceof Lowerable; StructuredGraph graph = (StructuredGraph) n.graph(); if (n instanceof LoadFieldNode) { lowerLoadFieldNode((LoadFieldNode) n, tool); @@ -107,9 +108,7 @@ } else if (n instanceof UnboxNode) { boxingSnippets.lower((UnboxNode) n, tool); } else if (n instanceof TypeCheckNode) { - if (graph.getGuardsStage().areDeoptsFixed()) { - lowerTypeCheckNode((TypeCheckNode) n, tool, graph); - } + lowerTypeCheckNode((TypeCheckNode) n, tool, graph); } else if (n instanceof VerifyHeapNode) { lowerVerifyHeap((VerifyHeapNode) n); } else {