# HG changeset patch # User Thomas Wuerthinger # Date 1379456135 -7200 # Node ID 226ef8ab5bc08d86b23f120e871d581bf0c3ae41 # Parent 693b06f5d8a6a45c265a6d6c42d677315d392b60# Parent 13b3c8cd5e527dfb8254c70e90809ba51c4bddc4 Merge. diff -r 13b3c8cd5e52 -r 226ef8ab5bc0 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Tue Sep 17 22:33:51 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Wed Sep 18 00:15:35 2013 +0200 @@ -605,15 +605,18 @@ LocationNode arrayLocation = createArrayLocation(graph, elementKind, storeIndexed.index()); ValueNode value = storeIndexed.value(); ValueNode array = storeIndexed.array(); + + CheckCastNode checkcastNode = null; + CheckCastDynamicNode checkcastDynamicNode = null; if (elementKind == Kind.Object && !ObjectStamp.isObjectAlwaysNull(value)) { // Store check! ResolvedJavaType arrayType = ObjectStamp.typeOrNull(array); if (arrayType != null && ObjectStamp.isExactType(array)) { ResolvedJavaType elementType = arrayType.getComponentType(); if (!MetaUtil.isJavaLangObject(elementType)) { - CheckCastNode checkcast = graph.add(new CheckCastNode(elementType, value, null, true)); - graph.addBeforeFixed(storeIndexed, checkcast); - value = checkcast; + checkcastNode = graph.add(new CheckCastNode(elementType, value, null, true)); + graph.addBeforeFixed(storeIndexed, checkcastNode); + value = checkcastNode; } } else { LoadHubNode arrayClass = graph.unique(new LoadHubNode(array, wordKind, boundsCheck.asNode())); @@ -624,9 +627,9 @@ * parts of the compiled method. */ FloatingReadNode arrayElementKlass = graph.unique(new FloatingReadNode(arrayClass, location, null, StampFactory.forKind(wordKind()), BeginNode.prevBegin(storeIndexed))); - CheckCastDynamicNode checkcast = graph.add(new CheckCastDynamicNode(arrayElementKlass, value, true)); - graph.addBeforeFixed(storeIndexed, checkcast); - value = checkcast; + checkcastDynamicNode = graph.add(new CheckCastDynamicNode(arrayElementKlass, value, true)); + graph.addBeforeFixed(storeIndexed, checkcastDynamicNode); + value = checkcastDynamicNode; } } BarrierType barrierType = getArrayStoreBarrierType(storeIndexed); @@ -635,6 +638,12 @@ memoryWrite.setStateAfter(storeIndexed.stateAfter()); graph.replaceFixedWithFixed(storeIndexed, memoryWrite); + // Lower the associated checkcast node. + if (checkcastNode != null) { + checkcastNode.lower(tool); + } else if (checkcastDynamicNode != null) { + checkcastDynamicSnippets.lower(checkcastDynamicNode); + } } else if (n instanceof UnsafeLoadNode) { if (graph.getGuardsPhase().ordinal() > StructuredGraph.GuardsStage.FLOATING_GUARDS.ordinal()) { UnsafeLoadNode load = (UnsafeLoadNode) n; @@ -831,8 +840,6 @@ } else if (n instanceof IntegerDivNode || n instanceof IntegerRemNode || n instanceof UnsignedDivNode || n instanceof UnsignedRemNode) { // Nothing to do for division nodes. The HotSpot signal handler catches divisions by // zero and the MIN_VALUE / -1 cases. - } else if (n instanceof UnwindNode || n instanceof DeoptimizeNode) { - // Nothing to do, using direct LIR lowering for these nodes. } else if (n instanceof BoxNode) { boxingSnippets.lower((BoxNode) n, tool); } else if (n instanceof UnboxNode) { diff -r 13b3c8cd5e52 -r 226ef8ab5bc0 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java Tue Sep 17 22:33:51 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java Wed Sep 18 00:15:35 2013 +0200 @@ -37,7 +37,7 @@ * */ @NodeInfo(shortName = "Deopt", nameTemplate = "Deopt {p#reason/s}") -public class DeoptimizeNode extends ControlSinkNode implements IterableNodeType, Lowerable, LIRLowerable, DeoptimizingNode { +public class DeoptimizeNode extends ControlSinkNode implements IterableNodeType, LIRLowerable, DeoptimizingNode { @Input private FrameState deoptState; @@ -59,11 +59,6 @@ } @Override - public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); - } - - @Override public void generate(LIRGeneratorTool gen) { gen.emitDeoptimize(action, this); } diff -r 13b3c8cd5e52 -r 226ef8ab5bc0 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java Tue Sep 17 22:33:51 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java Wed Sep 18 00:15:35 2013 +0200 @@ -80,10 +80,9 @@ if (graph().getGuardsPhase() == StructuredGraph.GuardsStage.FIXED_DEOPTS) { throw new GraalInternalError("Cannot create guards in after-guard lowering"); } - FixedGuardNode guard = graph().add(new FixedGuardNode(condition, reason, action, negated)); + GuardingNode guard = tool.createGuard(condition, reason, action, negated); PiNode pi = graph().unique(new PiNode(object, stamp(), guard)); - replaceAtUsages(pi); - graph().replaceFixedWithFixed(this, guard); + graph().replaceFixedWithFloating(this, pi); } @Override diff -r 13b3c8cd5e52 -r 226ef8ab5bc0 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java Tue Sep 17 22:33:51 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java Wed Sep 18 00:15:35 2013 +0200 @@ -29,7 +29,7 @@ /** * Unwinds the current frame to an exception handler in the caller frame. */ -public final class UnwindNode extends ControlSinkNode implements Lowerable, LIRLowerable { +public final class UnwindNode extends ControlSinkNode implements LIRLowerable { @Input private ValueNode exception; @@ -47,9 +47,4 @@ public void generate(LIRGeneratorTool gen) { gen.emitUnwind(gen.operand(exception())); } - - @Override - public void lower(LoweringTool tool) { - tool.getRuntime().lower(this, tool); - } } diff -r 13b3c8cd5e52 -r 226ef8ab5bc0 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Tue Sep 17 22:33:51 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Wed Sep 18 00:15:35 2013 +0200 @@ -744,14 +744,12 @@ try (TimerCloseable a = instantiationTimer.start()) { instantiationCounter.increment(); // Inline the snippet nodes, replacing parameters with the given args in the process - String name = snippet.name == null ? "{copy}" : snippet.name + "{copy}"; - StructuredGraph snippetCopy = new StructuredGraph(name, snippet.method()); StartNode entryPointNode = snippet.start(); FixedNode firstCFGNode = entryPointNode.next(); StructuredGraph replaceeGraph = replacee.graph(); IdentityHashMap replacements = bind(replaceeGraph, runtime, args); Map duplicates = replaceeGraph.addDuplicates(nodes, snippet, snippet.getNodeCount(), replacements); - Debug.dump(replaceeGraph, "After inlining snippet %s", snippetCopy.method()); + Debug.dump(replaceeGraph, "After inlining snippet %s", snippet.method()); // Re-wire the control flow graph around the replacee FixedNode firstCFGNodeDuplicate = (FixedNode) duplicates.get(firstCFGNode);