# HG changeset patch # User Gilles Duboscq # Date 1378833504 -7200 # Node ID 65cedae2647ed58589a5f97c36116452893af83a # Parent 809609e6abe64fde6316a390f44d948486c9f625# Parent 69881bec003c3833355e584481df5218e1968022 Merge diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java Tue Sep 10 19:18:24 2013 +0200 @@ -112,7 +112,7 @@ int getModifiers(); /** - * Checks whether this type is initialized. If a type is initialized it implies that is was + * Checks whether this type is initialized. If a type is initialized it implies that it was * {@link #isLinked() linked} and that the static initializer has run. * * @return {@code true} if this type is initialized diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java Tue Sep 10 19:18:24 2013 +0200 @@ -29,7 +29,6 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.spi.Lowerable.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -60,7 +59,7 @@ public void run() { StructuredGraph graph = parse(snippet); PhaseContext context = new PhaseContext(runtime(), new Assumptions(false), replacements); - new LoweringPhase(LoweringType.BEFORE_GUARDS, new CanonicalizerPhase(true)).apply(graph, context); + new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, context); new FloatingReadPhase().apply(graph); ReturnNode returnNode = null; diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java Tue Sep 10 19:18:24 2013 +0200 @@ -29,7 +29,6 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.java.*; -import com.oracle.graal.nodes.spi.Lowerable.LoweringType; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -96,7 +95,7 @@ new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); new CanonicalizerPhase(true).apply(graph, context); new DeadCodeEliminationPhase().apply(graph); - new LoweringPhase(LoweringType.BEFORE_GUARDS, new CanonicalizerPhase(true)).apply(graph, context); + new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, context); new ValueAnchorCleanupPhase().apply(graph); new LockEliminationPhase().apply(graph); return graph; diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java Tue Sep 10 19:18:24 2013 +0200 @@ -36,7 +36,6 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.spi.Lowerable.LoweringType; import com.oracle.graal.nodes.util.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; @@ -504,7 +503,7 @@ if (mode == TestMode.INLINED_WITHOUT_FRAMESTATES) { new InliningPhase(new CanonicalizerPhase(true)).apply(graph, context); } - new LoweringPhase(LoweringType.BEFORE_GUARDS, new CanonicalizerPhase(true)).apply(graph, context); + new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, context); if (mode == TestMode.WITHOUT_FRAMESTATES || mode == TestMode.INLINED_WITHOUT_FRAMESTATES) { for (Node node : graph.getNodes()) { if (node instanceof StateSplit) { @@ -523,8 +522,8 @@ MidTierContext midContext = new MidTierContext(runtime(), assumptions, replacements, runtime().getTarget(), OptimisticOptimizations.ALL); new GuardLoweringPhase().apply(graph, midContext); - new LoweringPhase(LoweringType.AFTER_GUARDS, new CanonicalizerPhase(true)).apply(graph, midContext); - new LoweringPhase(LoweringType.AFTER_FSA, new CanonicalizerPhase(true)).apply(graph, midContext); + new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, midContext); + new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, midContext); SchedulePhase schedule = new SchedulePhase(SchedulingStrategy.LATEST_OUT_OF_LOOPS, memsched); schedule.apply(graph); diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushNodesThroughPiTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushNodesThroughPiTest.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushNodesThroughPiTest.java Tue Sep 10 19:18:24 2013 +0200 @@ -30,7 +30,6 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.spi.Lowerable.LoweringType; import com.oracle.graal.nodes.type.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -94,7 +93,7 @@ StructuredGraph graph = parse(snippet); PhaseContext context = new PhaseContext(runtime(), new Assumptions(false), replacements); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true); - new LoweringPhase(LoweringType.BEFORE_GUARDS, canonicalizer).apply(graph, context); + new LoweringPhase(canonicalizer).apply(graph, context); canonicalizer.apply(graph, context); new PushThroughPiPhase().apply(graph); canonicalizer.apply(graph, context); diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java Tue Sep 10 19:18:24 2013 +0200 @@ -29,7 +29,6 @@ import com.oracle.graal.debug.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.spi.Lowerable.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -85,7 +84,7 @@ public void run() { StructuredGraph graph = parse(snippet); PhaseContext context = new PhaseContext(runtime(), new Assumptions(false), replacements); - new LoweringPhase(LoweringType.BEFORE_GUARDS, new CanonicalizerPhase(true)).apply(graph, context); + new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, context); new FloatingReadPhase().apply(graph); new EliminatePartiallyRedundantGuardsPhase(true, false).apply(graph); new ReadEliminationPhase().apply(graph); diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java Tue Sep 10 19:18:24 2013 +0200 @@ -27,7 +27,6 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.loop.phases.*; -import com.oracle.graal.nodes.spi.Lowerable.LoweringType; import com.oracle.graal.options.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; @@ -98,6 +97,6 @@ appendPhase(canonicalizer); } - appendPhase(new LoweringPhase(LoweringType.BEFORE_GUARDS, canonicalizer)); + appendPhase(new LoweringPhase(canonicalizer)); } } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LowTier.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LowTier.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/LowTier.java Tue Sep 10 19:18:24 2013 +0200 @@ -24,7 +24,6 @@ import static com.oracle.graal.phases.GraalOptions.*; -import com.oracle.graal.nodes.spi.Lowerable.LoweringType; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -34,7 +33,7 @@ public LowTier() { CanonicalizerPhase canonicalizer = new CanonicalizerPhase(!AOTCompilation.getValue()); - appendPhase(new LoweringPhase(LoweringType.AFTER_FSA, canonicalizer)); + appendPhase(new LoweringPhase(canonicalizer)); appendPhase(new ExpandLogicPhase()); diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/MidTier.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/MidTier.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/MidTier.java Tue Sep 10 19:18:24 2013 +0200 @@ -25,7 +25,6 @@ import static com.oracle.graal.phases.GraalOptions.*; import com.oracle.graal.loop.phases.*; -import com.oracle.graal.nodes.spi.Lowerable.LoweringType; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -86,7 +85,7 @@ appendPhase(new GuardLoweringPhase()); - appendPhase(new LoweringPhase(LoweringType.AFTER_GUARDS, canonicalizer)); + appendPhase(new LoweringPhase(canonicalizer)); appendPhase(new FrameStateAssignmentPhase()); diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java Tue Sep 10 19:18:24 2013 +0200 @@ -39,7 +39,6 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.spi.Lowerable.LoweringType; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; @@ -250,9 +249,9 @@ HighTierContext highContext = new HighTierContext(runtime(), new Assumptions(false), replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); MidTierContext midContext = new MidTierContext(runtime(), new Assumptions(false), replacements, runtime().getTarget(), OptimisticOptimizations.ALL); new InliningPhase(new InliningPhase.InlineEverythingPolicy(), new CanonicalizerPhase(true)).apply(graph, highContext); - new LoweringPhase(LoweringType.BEFORE_GUARDS, new CanonicalizerPhase(true)).apply(graph, highContext); + new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, highContext); new GuardLoweringPhase().apply(graph, midContext); - new LoweringPhase(LoweringType.AFTER_GUARDS, new CanonicalizerPhase(true)).apply(graph, midContext); + new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, midContext); new WriteBarrierAdditionPhase().apply(graph); Debug.dump(graph, "After Write Barrier Addition"); diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java Tue Sep 10 19:18:24 2013 +0200 @@ -36,7 +36,6 @@ import com.oracle.graal.hotspot.phases.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.spi.Lowerable.LoweringType; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.graph.*; @@ -637,10 +636,10 @@ MidTierContext midTierContext = new MidTierContext(runtime(), new Assumptions(false), replacements, runtime().getTarget(), OptimisticOptimizations.ALL); - new LoweringPhase(LoweringType.BEFORE_GUARDS, new CanonicalizerPhase(true)).apply(graph, highTierContext); + new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, highTierContext); new GuardLoweringPhase().apply(graph, midTierContext); new SafepointInsertionPhase().apply(graph); - new LoweringPhase(LoweringType.AFTER_GUARDS, new CanonicalizerPhase(true)).apply(graph, highTierContext); + new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, highTierContext); new WriteBarrierAdditionPhase().apply(graph); diff -r 809609e6abe6 -r 65cedae2647e 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 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Tue Sep 10 19:18:24 2013 +0200 @@ -85,7 +85,6 @@ import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.spi.Lowerable.LoweringType; import com.oracle.graal.nodes.type.*; import com.oracle.graal.nodes.virtual.*; import com.oracle.graal.phases.tiers.*; @@ -637,11 +636,11 @@ graph.replaceFixedWithFixed(storeIndexed, memoryWrite); } else if (n instanceof UnsafeLoadNode) { - if (tool.getLoweringType().ordinal() > LoweringType.BEFORE_GUARDS.ordinal()) { + if (graph.getGuardsPhase().ordinal() > StructuredGraph.GuardsPhase.FLOATING_GUARDS.ordinal()) { UnsafeLoadNode load = (UnsafeLoadNode) n; assert load.kind() != Kind.Illegal; boolean compressible = (!load.object().isNullConstant() && load.accessKind() == Kind.Object); - if (addReadBarrier(load, tool)) { + if (addReadBarrier(load)) { unsafeLoadSnippets.lower(load, tool); } else { IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, load.accessKind(), load.displacement(), load.offset(), graph, 1); @@ -676,14 +675,8 @@ StoreHubNode storeHub = (StoreHubNode) n; WriteNode hub = createWriteHub(graph, wordKind, storeHub.getObject(), storeHub.getValue()); graph.replaceFixed(storeHub, hub); - } else if (n instanceof FixedGuardNode) { - FixedGuardNode node = (FixedGuardNode) n; - GuardingNode guard = tool.createGuard(node.condition(), node.getReason(), node.getAction(), node.isNegated()); - ValueAnchorNode newAnchor = graph.add(new ValueAnchorNode(guard.asNode())); - node.replaceAtUsages(guard.asNode()); - graph.replaceFixedWithFixed(node, newAnchor); } else if (n instanceof CommitAllocationNode) { - if (tool.getLoweringType() == LoweringType.AFTER_GUARDS) { + if (graph.getGuardsPhase() == StructuredGraph.GuardsPhase.FIXED_DEOPTS) { CommitAllocationNode commit = (CommitAllocationNode) n; ValueNode[] allocations = new ValueNode[commit.getVirtualObjects().size()]; @@ -759,7 +752,7 @@ graph.removeFixed(commit); } } else if (n instanceof OSRStartNode) { - if (tool.getLoweringType() == LoweringType.AFTER_GUARDS) { + if (graph.getGuardsPhase() == StructuredGraph.GuardsPhase.FIXED_DEOPTS) { OSRStartNode osrStart = (OSRStartNode) n; StartNode newStart = graph.add(new StartNode()); LocalNode buffer = graph.unique(new LocalNode(0, StampFactory.forKind(wordKind()))); @@ -788,31 +781,31 @@ } else if (n instanceof CheckCastDynamicNode) { checkcastDynamicSnippets.lower((CheckCastDynamicNode) n); } else if (n instanceof InstanceOfNode) { - if (tool.getLoweringType() == LoweringType.AFTER_GUARDS) { + if (graph.getGuardsPhase() == StructuredGraph.GuardsPhase.FIXED_DEOPTS) { instanceofSnippets.lower((InstanceOfNode) n, tool); } } else if (n instanceof InstanceOfDynamicNode) { - if (tool.getLoweringType() == LoweringType.AFTER_GUARDS) { + if (graph.getGuardsPhase() == StructuredGraph.GuardsPhase.FIXED_DEOPTS) { instanceofSnippets.lower((InstanceOfDynamicNode) n, tool); } } else if (n instanceof NewInstanceNode) { - if (tool.getLoweringType() == LoweringType.AFTER_FSA) { + if (graph.getGuardsPhase() == StructuredGraph.GuardsPhase.AFTER_FSA) { newObjectSnippets.lower((NewInstanceNode) n); } } else if (n instanceof NewArrayNode) { - if (tool.getLoweringType() == LoweringType.AFTER_FSA) { + if (graph.getGuardsPhase() == StructuredGraph.GuardsPhase.AFTER_FSA) { newObjectSnippets.lower((NewArrayNode) n); } } else if (n instanceof DynamicNewArrayNode) { - if (tool.getLoweringType() == LoweringType.AFTER_FSA) { + if (graph.getGuardsPhase() == StructuredGraph.GuardsPhase.AFTER_FSA) { newObjectSnippets.lower((DynamicNewArrayNode) n); } } else if (n instanceof MonitorEnterNode) { - if (tool.getLoweringType() == LoweringType.AFTER_GUARDS) { + if (graph.getGuardsPhase() == StructuredGraph.GuardsPhase.FIXED_DEOPTS) { monitorSnippets.lower((MonitorEnterNode) n, tool); } } else if (n instanceof MonitorExitNode) { - if (tool.getLoweringType() == LoweringType.AFTER_GUARDS) { + if (graph.getGuardsPhase() == StructuredGraph.GuardsPhase.FIXED_DEOPTS) { monitorSnippets.lower((MonitorExitNode) n, tool); } } else if (n instanceof G1PreWriteBarrier) { @@ -830,7 +823,7 @@ } else if (n instanceof G1ArrayRangePostWriteBarrier) { writeBarrierSnippets.lower((G1ArrayRangePostWriteBarrier) n, tool); } else if (n instanceof NewMultiArrayNode) { - if (tool.getLoweringType() == LoweringType.AFTER_FSA) { + if (graph.getGuardsPhase() == StructuredGraph.GuardsPhase.AFTER_FSA) { newObjectSnippets.lower((NewMultiArrayNode) n); } } else if (n instanceof LoadExceptionObjectNode) { @@ -850,8 +843,8 @@ } } - private static boolean addReadBarrier(UnsafeLoadNode load, LoweringTool tool) { - if (useG1GC() && tool.getLoweringType() == LoweringType.AFTER_GUARDS && load.object().kind() == Kind.Object && load.accessKind() == Kind.Object && + private static boolean addReadBarrier(UnsafeLoadNode load) { + if (useG1GC() && load.graph().getGuardsPhase() == StructuredGraph.GuardsPhase.FIXED_DEOPTS && load.object().kind() == Kind.Object && load.accessKind() == Kind.Object && !ObjectStamp.isObjectAlwaysNull(load.object())) { ResolvedJavaType type = ObjectStamp.typeOrNull(load.object()); if (type != null && !type.isArray()) { diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CStringNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CStringNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/CStringNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -44,7 +44,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { byte[] formatBytes = string.getBytes(); long cstring = unsafe.allocateMemory(formatBytes.length + 1); for (int i = 0; i < formatBytes.length; i++) { diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteTargetNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteTargetNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/CallSiteTargetNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -66,7 +66,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { ConstantNode target = getConstantCallTarget(tool.getRuntime(), tool.assumptions()); if (target != null) { diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ReflectionGetCallerClassNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -47,7 +47,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { ConstantNode callerClassNode = getCallerClassNode(tool.getRuntime()); if (callerClassNode != null) { diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopyNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopyNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeArrayCopyNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -92,8 +92,8 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { - if (loweringType == LoweringType.AFTER_FSA) { + public void lower(LoweringTool tool) { + if (graph().getGuardsPhase() == StructuredGraph.GuardsPhase.AFTER_FSA) { UnsafeArrayCopySnippets.Templates templates = tool.getReplacements().getSnippetTemplateCache(UnsafeArrayCopySnippets.Templates.class); templates.lower(this); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractBeginNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractBeginNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractBeginNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -185,9 +185,4 @@ throw new UnsupportedOperationException(); } } - - @Override - public AbstractBeginNode asNode() { - return this; - } } diff -r 809609e6abe6 -r 65cedae2647e 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 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -59,7 +59,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -106,9 +106,12 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { - if (loweringType == LoweringType.BEFORE_GUARDS) { - tool.getRuntime().lower(this, tool); + public void lower(LoweringTool tool) { + if (graph().getGuardsPhase() == StructuredGraph.GuardsPhase.FLOATING_GUARDS) { + GuardingNode guard = tool.createGuard(condition(), getReason(), getAction(), isNegated()); + ValueAnchorNode newAnchor = graph().add(new ValueAnchorNode(guard.asNode())); + this.replaceAtUsages(guard.asNode()); + graph().replaceFixedWithFixed(this, newAnchor); } else { FixedNode next = next(); setNext(null); @@ -130,11 +133,6 @@ } @Override - public FixedGuardNode asNode() { - return this; - } - - @Override public boolean canDeoptimize() { return true; } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -35,4 +35,9 @@ assertTrue(this.successors().isNotEmpty() || this.predecessor() != null, "FixedNode should not float"); return super.verify(); } + + @Override + public FixedNode asNode() { + return this; + } } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FloatingGuardedNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FloatingGuardedNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FloatingGuardedNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -49,10 +49,4 @@ updateUsages(this.guard == null ? null : this.guard.asNode(), guard == null ? null : guard.asNode()); this.guard = guard; } - - @Override - public FloatingNode asNode() { - return this; - } - } diff -r 809609e6abe6 -r 65cedae2647e 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 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardingPiNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -76,8 +76,8 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { - if (loweringType == LoweringType.AFTER_GUARDS) { + public void lower(LoweringTool tool) { + if (graph().getGuardsPhase() == StructuredGraph.GuardsPhase.FIXED_DEOPTS) { throw new GraalInternalError("Cannot create guards in after-guard lowering"); } FixedGuardNode guard = graph().add(new FixedGuardNode(condition, reason, action, negated)); @@ -115,11 +115,6 @@ @ConstantNodeParameter DeoptimizationAction action, @ConstantNodeParameter Stamp stamp); @Override - public ValueNode asNode() { - return this; - } - - @Override public ValueNode getOriginalValue() { return object; } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -108,7 +108,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } @@ -133,11 +133,6 @@ } @Override - public FixedNode asNode() { - return this; - } - - @Override public FrameState stateDuring() { FrameState stateAfter = stateAfter(); if (stateAfter == null) { diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -119,11 +119,6 @@ } @Override - public FixedNode asNode() { - return this; - } - - @Override public void setNext(FixedNode x) { if (x != null) { this.setNext(AbstractBeginNode.begin(x)); @@ -133,7 +128,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -30,4 +30,22 @@ public LogicNode() { super(StampFactory.condition()); } + + public static LogicNode and(LogicNode a, LogicNode b, double shortCircuitProbability) { + return and(a, false, b, false, shortCircuitProbability); + } + + public static LogicNode and(LogicNode a, boolean negateA, LogicNode b, boolean negateB, double shortCircuitProbability) { + StructuredGraph graph = a.graph(); + ShortCircuitOrNode notAorNotB = graph.unique(new ShortCircuitOrNode(a, !negateA, b, !negateB, shortCircuitProbability)); + return graph.unique(new LogicNegationNode(notAorNotB)); + } + + public static LogicNode or(LogicNode a, LogicNode b, double shortCircuitProbability) { + return or(a, false, b, false, shortCircuitProbability); + } + + public static LogicNode or(LogicNode a, boolean negateA, LogicNode b, boolean negateB, double shortCircuitProbability) { + return a.graph().unique(new ShortCircuitOrNode(a, negateA, b, negateB, shortCircuitProbability)); + } } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -248,9 +248,4 @@ public boolean isLoopPhi() { return merge() instanceof LoopBeginNode; } - - @Override - public PhiNode asNode() { - return this; - } } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -120,8 +120,4 @@ public ValueNode getOriginalValue() { return value; } - - public ValueNode asNode() { - return this; - } } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ShortCircuitAndNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ShortCircuitAndNode.java Tue Sep 10 17:38:02 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2013, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.nodes; - -import com.oracle.graal.nodes.spi.*; - -/** - * The short-circuit AND (i.e. {@code &&} in Java) operator. - */ -public class ShortCircuitAndNode extends ShortCircuitBooleanNode implements Canonicalizable { - - public ShortCircuitAndNode(LogicNode x, boolean xNegated, LogicNode y, boolean yNegated, double shortCircuitProbability) { - super(x, xNegated, y, yNegated, shortCircuitProbability); - } - - @Override - public LogicNode canonical(CanonicalizerTool tool) { - ShortCircuitBooleanNode ret = canonicalizeNegation(); - if (ret != null) { - return ret; - } - - LogicNode x = getX(); - LogicNode y = getY(); - if (x == y) { - // @formatter:off - // a && a = a - // a && !a = false - // !a && a = false - // !a && !a = !a - // @formatter:on - if (isXNegated()) { - if (isYNegated()) { - // !a && !a = !a - return graph().unique(new LogicNegationNode(x)); - } else { - // !a && a = false - return LogicConstantNode.contradiction(graph()); - } - } else { - if (isYNegated()) { - // a && !a = false - return LogicConstantNode.contradiction(graph()); - } else { - // a && a = a - return x; - } - } - } - if (x instanceof LogicConstantNode) { - if (((LogicConstantNode) x).getValue() ^ isXNegated()) { - if (isYNegated()) { - return graph().unique(new LogicNegationNode(y)); - } else { - return y; - } - } else { - return LogicConstantNode.contradiction(graph()); - } - } - if (y instanceof LogicConstantNode) { - if (((LogicConstantNode) y).getValue() ^ isYNegated()) { - if (isXNegated()) { - return graph().unique(new LogicNegationNode(x)); - } else { - return x; - } - } else { - return LogicConstantNode.contradiction(graph()); - } - } - return this; - } - - @Override - protected ShortCircuitBooleanNode createCopy(LogicNode xCond, boolean xNeg, LogicNode yCond, boolean yNeg, double probability) { - return new ShortCircuitAndNode(xCond, xNeg, yCond, yNeg, probability); - } -} diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ShortCircuitBooleanNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ShortCircuitBooleanNode.java Tue Sep 10 17:38:02 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2013, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.nodes; - -import com.oracle.graal.graph.*; - -/** - * Base class for the short-circuit boolean operators. - */ -public abstract class ShortCircuitBooleanNode extends LogicNode implements Node.IterableNodeType { - - @Input private LogicNode x; - @Input private LogicNode y; - private boolean xNegated; - private boolean yNegated; - private double shortCircuitProbability; - - public ShortCircuitBooleanNode(LogicNode x, boolean xNegated, LogicNode y, boolean yNegated, double shortCircuitProbability) { - this.x = x; - this.xNegated = xNegated; - this.y = y; - this.yNegated = yNegated; - this.shortCircuitProbability = shortCircuitProbability; - } - - public LogicNode getX() { - return x; - } - - public LogicNode getY() { - return y; - } - - public boolean isXNegated() { - return xNegated; - } - - public boolean isYNegated() { - return yNegated; - } - - /** - * Gets the probability that the {@link #getY() y} part of this binary node is not - * evaluated. This is the probability that this operator will short-circuit its execution. - */ - public double getShortCircuitProbability() { - return shortCircuitProbability; - } - - protected abstract ShortCircuitBooleanNode createCopy(LogicNode xCond, boolean xNeg, LogicNode yCond, boolean yNeg, double probability); - - protected ShortCircuitBooleanNode canonicalizeNegation() { - LogicNode xCond = x; - boolean xNeg = xNegated; - while (xCond instanceof LogicNegationNode) { - xCond = ((LogicNegationNode) xCond).getInput(); - xNeg = !xNeg; - } - - LogicNode yCond = y; - boolean yNeg = yNegated; - while (yCond instanceof LogicNegationNode) { - yCond = ((LogicNegationNode) yCond).getInput(); - yNeg = !yNeg; - } - - if (xCond != x || yCond != y) { - return graph().unique(createCopy(xCond, xNeg, yCond, yNeg, shortCircuitProbability)); - } else { - return null; - } - } -} diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ShortCircuitOrNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ShortCircuitOrNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ShortCircuitOrNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -22,27 +22,79 @@ */ package com.oracle.graal.nodes; +import com.oracle.graal.graph.*; import com.oracle.graal.nodes.spi.*; -/** - * The short-circuit OR (i.e. {@code ||} in Java) operator. - */ -public class ShortCircuitOrNode extends ShortCircuitBooleanNode implements Canonicalizable { +public class ShortCircuitOrNode extends LogicNode implements Node.IterableNodeType, Canonicalizable { + + @Input private LogicNode x; + @Input private LogicNode y; + private boolean xNegated; + private boolean yNegated; + private double shortCircuitProbability; public ShortCircuitOrNode(LogicNode x, boolean xNegated, LogicNode y, boolean yNegated, double shortCircuitProbability) { - super(x, xNegated, y, yNegated, shortCircuitProbability); + this.x = x; + this.xNegated = xNegated; + this.y = y; + this.yNegated = yNegated; + this.shortCircuitProbability = shortCircuitProbability; + } + + public LogicNode getX() { + return x; + } + + public LogicNode getY() { + return y; + } + + public boolean isXNegated() { + return xNegated; + } + + public boolean isYNegated() { + return yNegated; + } + + /** + * Gets the probability that the {@link #getY() y} part of this binary node is not + * evaluated. This is the probability that this operator will short-circuit its execution. + */ + public double getShortCircuitProbability() { + return shortCircuitProbability; + } + + protected ShortCircuitOrNode canonicalizeNegation() { + LogicNode xCond = x; + boolean xNeg = xNegated; + while (xCond instanceof LogicNegationNode) { + xCond = ((LogicNegationNode) xCond).getInput(); + xNeg = !xNeg; + } + + LogicNode yCond = y; + boolean yNeg = yNegated; + while (yCond instanceof LogicNegationNode) { + yCond = ((LogicNegationNode) yCond).getInput(); + yNeg = !yNeg; + } + + if (xCond != x || yCond != y) { + return graph().unique(new ShortCircuitOrNode(xCond, xNeg, yCond, yNeg, shortCircuitProbability)); + } else { + return null; + } } @Override public LogicNode canonical(CanonicalizerTool tool) { - ShortCircuitBooleanNode ret = canonicalizeNegation(); + ShortCircuitOrNode ret = canonicalizeNegation(); if (ret != null) { return ret; } - LogicNode x = getX(); - LogicNode y = getY(); - if (x == y) { + if (getX() == getY()) { // @formatter:off // a || a = a // a || !a = true @@ -52,7 +104,7 @@ if (isXNegated()) { if (isYNegated()) { // !a || !a = !a - return graph().unique(new LogicNegationNode(x)); + return graph().unique(new LogicNegationNode(getX())); } else { // !a || a = true return LogicConstantNode.tautology(graph()); @@ -63,37 +115,32 @@ return LogicConstantNode.tautology(graph()); } else { // a || a = a - return x; + return getX(); } } } - if (x instanceof LogicConstantNode) { - if (((LogicConstantNode) x).getValue() ^ isXNegated()) { + if (getX() instanceof LogicConstantNode) { + if (((LogicConstantNode) getX()).getValue() ^ isXNegated()) { return LogicConstantNode.tautology(graph()); } else { if (isYNegated()) { - return graph().unique(new LogicNegationNode(y)); + return graph().unique(new LogicNegationNode(getY())); } else { - return y; + return getY(); } } } - if (y instanceof LogicConstantNode) { - if (((LogicConstantNode) y).getValue() ^ isYNegated()) { + if (getY() instanceof LogicConstantNode) { + if (((LogicConstantNode) getY()).getValue() ^ isYNegated()) { return LogicConstantNode.tautology(graph()); } else { if (isXNegated()) { - return graph().unique(new LogicNegationNode(x)); + return graph().unique(new LogicNegationNode(getX())); } else { - return x; + return getX(); } } } return this; } - - @Override - protected ShortCircuitBooleanNode createCopy(LogicNode xCond, boolean xNeg, LogicNode yCond, boolean yNeg, double probability) { - return new ShortCircuitOrNode(xCond, xNeg, yCond, yNeg, probability); - } } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Tue Sep 10 19:18:24 2013 +0200 @@ -37,6 +37,10 @@ */ public class StructuredGraph extends Graph { + public static enum GuardsPhase { + FLOATING_GUARDS, FIXED_DEOPTS, AFTER_FSA + } + public static final int INVOCATION_ENTRY_BCI = -1; public static final long INVALID_GRAPH_ID = -1; @@ -48,6 +52,7 @@ private final ResolvedJavaMethod method; private final long graphId; private final int entryBCI; + private GuardsPhase guardsPhase = GuardsPhase.FLOATING_GUARDS; /** * Creates a new Graph containing a single {@link AbstractBeginNode} as the {@link #start() @@ -386,4 +391,13 @@ singleEnd.replaceAndDelete(sux); } } + + public GuardsPhase getGuardsPhase() { + return guardsPhase; + } + + public void setGuardsPhase(GuardsPhase guardsPhase) { + assert guardsPhase.ordinal() >= this.guardsPhase.ordinal(); + this.guardsPhase = guardsPhase; + } } diff -r 809609e6abe6 -r 65cedae2647e 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 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -50,7 +50,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -140,4 +140,8 @@ assertTrue(kind() == kind().getStackKind(), "Should have a stack kind : %s", kind()); return super.verify(); } + + public ValueNode asNode() { + return this; + } } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/WriteBarrier.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/WriteBarrier.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/WriteBarrier.java Tue Sep 10 19:18:24 2013 +0200 @@ -53,8 +53,8 @@ } @Override - public void lower(LoweringTool generator, LoweringType loweringType) { - assert loweringType == LoweringType.AFTER_FSA; + public void lower(LoweringTool generator) { + assert graph().getGuardsPhase() == StructuredGraph.GuardsPhase.AFTER_FSA; generator.getRuntime().lower(this, generator); } } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -150,14 +150,22 @@ return null; } + //@formatter:off /* * In reassociate, complexity comes from the handling of IntegerSub (non commutative) which can - * be mixed with IntegerAdd. if first tries to find m1, m2 which match the criterion : (a o m2) - * o m1 (m2 o a) o m1 m1 o (a o m2) m1 o (m2 o a) It then produces 4 boolean for the -/+ case - * invertA : should the final expression be like *-a (rather than a+*) aSub : should the final - * expression be like a-* (rather than a+*) invertM1 : should the final expression contain -m1 + * be mixed with IntegerAdd. It first tries to find m1, m2 which match the criterion : + * (a o m2) o m1 + * (m2 o a) o m1 + * m1 o (a o m2) + * m1 o (m2 o a) + * It then produces 4 boolean for the -/+ cases: + * invertA : should the final expression be like *-a (rather than a+*) + * aSub : should the final expression be like a-* (rather than a+*) + * invertM1 : should the final expression contain -m1 * invertM2 : should the final expression contain -m2 + * */ + //@formatter:on /** * Tries to re-associate values which satisfy the criterion. For example with a constantness * criterion : (a + 2) + 1 => a + (1 + 2)
diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -235,7 +235,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -110,7 +110,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerRemNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -61,7 +61,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -48,7 +48,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { LogicNode equalComp; LogicNode lessComp; if (x().kind() == Kind.Double || x().kind() == Kind.Float) { diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedDivNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedDivNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedDivNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -62,7 +62,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRemNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRemNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/UnsignedRemNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -61,7 +61,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/debug/DynamicCounterNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -166,7 +166,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { if (!enabled) { throw new GraalInternalError("counter nodes shouldn't exist when not enabled"); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AccessNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AccessNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AccessNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -78,11 +78,6 @@ } @Override - public AccessNode asNode() { - return this; - } - - @Override public boolean canDeoptimize() { return nullCheck; } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -53,7 +53,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BranchProbabilityNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -123,7 +123,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { throw new GraalInternalError("Branch probability could not be injected, because the probability value did not reduce to a constant value."); } } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingAccessNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingAccessNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingAccessNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -70,11 +70,6 @@ } @Override - public FloatingAccessNode asNode() { - return this; - } - - @Override public boolean canDeoptimize() { return nullCheck; } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -58,8 +58,8 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { - if (loweringType == LoweringType.AFTER_GUARDS) { + public void lower(LoweringTool tool) { + if (graph().getGuardsPhase() == StructuredGraph.GuardsPhase.FIXED_DEOPTS) { tool.getRuntime().lower(this, tool); } } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadMethodNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadMethodNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadMethodNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -51,7 +51,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/NullCheckNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/NullCheckNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/NullCheckNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -54,9 +54,4 @@ public DeoptimizationReason getDeoptimizationReason() { return DeoptimizationReason.NullCheckException; } - - @Override - public ValueNode asNode() { - return this; - } } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/OSRStartNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/OSRStartNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/OSRStartNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -29,7 +29,7 @@ public class OSRStartNode extends StartNode implements Lowerable { @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/StoreHubNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/StoreHubNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/StoreHubNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -46,7 +46,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -48,7 +48,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -49,7 +49,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -68,7 +68,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -114,9 +114,4 @@ } tool.delete(); } - - @Override - public ValueNode asNode() { - return this; - } } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewArrayNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AbstractNewArrayNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -88,7 +88,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -83,7 +83,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -64,7 +64,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -62,7 +62,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -59,7 +59,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e 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 Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -96,7 +96,7 @@ * {@code LoweringPhase.checkUsagesAreScheduled()}. */ @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { InstanceOfNode typeTest = graph().add(new InstanceOfNode(type, object, profile)); Stamp stamp = StampFactory.declared(type); if (stamp() instanceof ObjectStamp && object().stamp() instanceof ObjectStamp) { @@ -118,7 +118,7 @@ } else { // TODO (ds) replace with probability of null-seen when available double shortCircuitProbability = NOT_FREQUENT_PROBABILITY; - condition = graph().unique(new ShortCircuitOrNode(graph().unique(new IsNullNode(object)), false, typeTest, false, shortCircuitProbability)); + condition = LogicNode.or(graph().unique(new IsNullNode(object)), typeTest, shortCircuitProbability); } } GuardingPiNode checkedObject = graph().add(new GuardingPiNode(object, condition, false, forStoreCheck ? ArrayStoreException : ClassCastException, InvalidateReprofile, stamp)); diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -78,7 +78,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -64,7 +64,7 @@ * runtime/interpreter would not have a valid location for the exception object to be rethrown. */ @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { if (isLowered()) { return; } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -50,7 +50,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -51,7 +51,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadExceptionObjectNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadExceptionObjectNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadExceptionObjectNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -44,7 +44,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -50,7 +50,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -51,7 +51,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -77,7 +77,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -62,7 +62,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/SelfReplacingMethodCallTargetNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/SelfReplacingMethodCallTargetNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/SelfReplacingMethodCallTargetNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -28,7 +28,7 @@ import com.oracle.graal.api.meta.ResolvedJavaMethod; import com.oracle.graal.graph.GraalInternalError; import com.oracle.graal.graph.NodeInputList; -import com.oracle.graal.nodes.ValueNode; +import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.LIRGeneratorTool; import com.oracle.graal.nodes.spi.Lowerable; import com.oracle.graal.nodes.spi.LoweringTool; @@ -68,7 +68,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { InvokeKind invokeKind = Modifier.isStatic(replacementTargetMethod.getModifiers()) ? InvokeKind.Static : InvokeKind.Special; MethodCallTargetNode replacement = graph().add( new MethodCallTargetNode(invokeKind, replacementTargetMethod, replacementArguments.toArray(new ValueNode[replacementArguments.size()]), replacementReturnType)); diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Lowerable.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Lowerable.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Lowerable.java Tue Sep 10 19:18:24 2013 +0200 @@ -22,11 +22,11 @@ */ package com.oracle.graal.nodes.spi; +import com.oracle.graal.nodes.*; + public interface Lowerable { - public enum LoweringType { - BEFORE_GUARDS, AFTER_GUARDS, AFTER_FSA - } + void lower(LoweringTool tool); - void lower(LoweringTool tool, LoweringType loweringType); + ValueNode asNode(); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringTool.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringTool.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringTool.java Tue Sep 10 19:18:24 2013 +0200 @@ -28,14 +28,11 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.nodes.extended.*; -import com.oracle.graal.nodes.spi.Lowerable.LoweringType; public interface LoweringTool { GraalCodeCacheProvider getRuntime(); - LoweringType getLoweringType(); - Replacements getReplacements(); GuardingNode createNullCheckGuard(GuardedNode guardedNode, ValueNode object); diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -65,7 +65,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { tool.getRuntime().lower(this, tool); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ExpandLogicPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ExpandLogicPhase.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ExpandLogicPhase.java Tue Sep 10 19:18:24 2013 +0200 @@ -31,33 +31,21 @@ @Override protected void run(StructuredGraph graph) { - for (ShortCircuitBooleanNode logic : graph.getNodes(ShortCircuitBooleanNode.class)) { + for (ShortCircuitOrNode logic : graph.getNodes(ShortCircuitOrNode.class)) { processBinary(logic); } - assert graph.getNodes(ShortCircuitBooleanNode.class).isEmpty(); + assert graph.getNodes(ShortCircuitOrNode.class).isEmpty(); } - private static void processBinary(ShortCircuitBooleanNode binary) { + private static void processBinary(ShortCircuitOrNode binary) { while (binary.usages().isNotEmpty()) { Node usage = binary.usages().first(); - if (usage instanceof ShortCircuitBooleanNode) { - processBinary((ShortCircuitBooleanNode) usage); + if (usage instanceof ShortCircuitOrNode) { + processBinary((ShortCircuitOrNode) usage); } else if (usage instanceof IfNode) { - if (binary instanceof ShortCircuitAndNode) { - processIf(binary.getX(), binary.isXNegated(), binary.getY(), binary.isYNegated(), (IfNode) usage, false, binary.getShortCircuitProbability()); - } else if (binary instanceof ShortCircuitOrNode) { - processIf(binary.getX(), !binary.isXNegated(), binary.getY(), !binary.isYNegated(), (IfNode) usage, true, binary.getShortCircuitProbability()); - } else { - throw GraalInternalError.shouldNotReachHere(); - } + processIf(binary.getX(), binary.isXNegated(), binary.getY(), binary.isYNegated(), (IfNode) usage, binary.getShortCircuitProbability()); } else if (usage instanceof ConditionalNode) { - if (binary instanceof ShortCircuitOrNode) { - processConditional(binary.getX(), binary.isXNegated(), binary.getY(), binary.isYNegated(), (ConditionalNode) usage, false); - } else if (binary instanceof ShortCircuitOrNode) { - processConditional(binary.getX(), !binary.isXNegated(), binary.getY(), !binary.isYNegated(), (ConditionalNode) usage, true); - } else { - throw GraalInternalError.shouldNotReachHere(); - } + processConditional(binary.getX(), binary.isXNegated(), binary.getY(), binary.isYNegated(), (ConditionalNode) usage); } else { throw GraalInternalError.shouldNotReachHere(); } @@ -65,33 +53,44 @@ binary.safeDelete(); } - private static void processIf(LogicNode x, boolean xNegated, LogicNode y, boolean yNegated, IfNode ifNode, boolean negateTargets, double shortCircuitProbability) { - AbstractBeginNode trueTarget = negateTargets ? ifNode.falseSuccessor() : ifNode.trueSuccessor(); - AbstractBeginNode falseTarget = negateTargets ? ifNode.trueSuccessor() : ifNode.falseSuccessor(); + private static void processIf(LogicNode x, boolean xNegated, LogicNode y, boolean yNegated, IfNode ifNode, double shortCircuitProbability) { + AbstractBeginNode trueTarget = ifNode.trueSuccessor(); + AbstractBeginNode falseTarget = ifNode.falseSuccessor(); double firstIfProbability = shortCircuitProbability; - double secondIfProbability = 1 - ifNode.probability(trueTarget); + /* + * P(Y | not(X)) = P(Y inter not(X)) / P(not(X)) = (P(X union Y) - P(X)) / (1 - P(X)) + * + * P(X) = shortCircuitProbability + * + * P(X union Y) = ifNode.probability(trueTarget) + */ + double secondIfProbability = (ifNode.probability(trueTarget) - shortCircuitProbability) / (1 - shortCircuitProbability); + secondIfProbability = Math.min(1.0, Math.max(0.0, secondIfProbability)); + if (Double.isNaN(secondIfProbability)) { + secondIfProbability = 0.5; + } ifNode.clearSuccessors(); Graph graph = ifNode.graph(); - MergeNode falseTargetMerge = graph.add(new MergeNode()); - falseTargetMerge.setNext(falseTarget); - EndNode firstFalseEnd = graph.add(new EndNode()); - EndNode secondFalseEnd = graph.add(new EndNode()); - falseTargetMerge.addForwardEnd(firstFalseEnd); - falseTargetMerge.addForwardEnd(secondFalseEnd); - AbstractBeginNode firstFalseTarget = AbstractBeginNode.begin(firstFalseEnd); - AbstractBeginNode secondFalseTarget = AbstractBeginNode.begin(secondFalseEnd); - AbstractBeginNode secondIf = AbstractBeginNode.begin(graph.add(new IfNode(y, yNegated ? firstFalseTarget : trueTarget, yNegated ? trueTarget : firstFalseTarget, secondIfProbability))); - IfNode firstIf = graph.add(new IfNode(x, xNegated ? secondFalseTarget : secondIf, xNegated ? secondIf : secondFalseTarget, firstIfProbability)); + MergeNode trueTargetMerge = graph.add(new MergeNode()); + trueTargetMerge.setNext(trueTarget); + EndNode firstTrueEnd = graph.add(new EndNode()); + EndNode secondTrueEnd = graph.add(new EndNode()); + trueTargetMerge.addForwardEnd(firstTrueEnd); + trueTargetMerge.addForwardEnd(secondTrueEnd); + AbstractBeginNode firstTrueTarget = AbstractBeginNode.begin(firstTrueEnd); + AbstractBeginNode secondTrueTarget = AbstractBeginNode.begin(secondTrueEnd); + AbstractBeginNode secondIf = AbstractBeginNode.begin(graph.add(new IfNode(y, yNegated ? falseTarget : secondTrueTarget, yNegated ? secondTrueTarget : falseTarget, secondIfProbability))); + IfNode firstIf = graph.add(new IfNode(x, xNegated ? secondIf : firstTrueTarget, xNegated ? firstTrueTarget : secondIf, firstIfProbability)); ifNode.replaceAtPredecessor(firstIf); ifNode.safeDelete(); } - private static void processConditional(LogicNode x, boolean xNegated, LogicNode y, boolean yNegated, ConditionalNode conditional, boolean negateTargets) { - ValueNode trueTarget = negateTargets ? conditional.falseValue() : conditional.trueValue(); - ValueNode falseTarget = negateTargets ? conditional.trueValue() : conditional.falseValue(); + private static void processConditional(LogicNode x, boolean xNegated, LogicNode y, boolean yNegated, ConditionalNode conditional) { + ValueNode trueTarget = conditional.trueValue(); + ValueNode falseTarget = conditional.falseValue(); Graph graph = conditional.graph(); ConditionalNode secondConditional = graph.unique(new ConditionalNode(y, yNegated ? falseTarget : trueTarget, yNegated ? trueTarget : falseTarget)); - ConditionalNode firstConditional = graph.unique(new ConditionalNode(x, xNegated ? falseTarget : secondConditional, xNegated ? secondConditional : falseTarget)); + ConditionalNode firstConditional = graph.unique(new ConditionalNode(x, xNegated ? secondConditional : trueTarget, xNegated ? trueTarget : secondConditional)); conditional.replaceAndDelete(firstConditional); } } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FrameStateAssignmentPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FrameStateAssignmentPhase.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FrameStateAssignmentPhase.java Tue Sep 10 19:18:24 2013 +0200 @@ -27,6 +27,7 @@ import com.oracle.graal.graph.*; import com.oracle.graal.graph.iterators.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.GuardsPhase; import com.oracle.graal.nodes.util.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.graph.*; @@ -77,6 +78,8 @@ protected void run(StructuredGraph graph) { assert checkFixedDeopts(graph); ReentrantNodeIterator.apply(new FrameStateAssignmentClosure(), graph.start(), null, null); + + graph.setGuardsPhase(GuardsPhase.AFTER_FSA); } private static boolean checkFixedDeopts(StructuredGraph graph) { diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/GuardLoweringPhase.java Tue Sep 10 19:18:24 2013 +0200 @@ -29,6 +29,7 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.StructuredGraph.GuardsPhase; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.nodes.extended.*; @@ -187,6 +188,8 @@ for (Block block : schedule.getCFG().getBlocks()) { processBlock(block, schedule, context.getTarget().implicitNullCheckLimit); } + + graph.setGuardsPhase(GuardsPhase.FIXED_DEOPTS); } private static void processBlock(Block block, SchedulePhase schedule, int implicitNullCheckLimit) { diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java Tue Sep 10 19:18:24 2013 +0200 @@ -35,7 +35,6 @@ import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.spi.Lowerable.LoweringType; import com.oracle.graal.nodes.type.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.schedule.*; @@ -73,11 +72,6 @@ } @Override - public LoweringType getLoweringType() { - return loweringType; - } - - @Override public GuardingNode createNullCheckGuard(GuardedNode guardedNode, ValueNode object) { if (ObjectStamp.isObjectNonNull(object)) { // Short cut creation of null check guard if the object is known to be non-null. @@ -101,8 +95,8 @@ @Override public GuardingNode createGuard(LogicNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action, boolean negated) { - if (loweringType != LoweringType.BEFORE_GUARDS) { - throw new GraalInternalError("Cannot create guards in after-guard lowering"); + if (condition.graph().getGuardsPhase().ordinal() > StructuredGraph.GuardsPhase.FLOATING_GUARDS.ordinal()) { + throw new GraalInternalError("Cannot create guards after guard lowering"); } if (OptEliminateGuards.getValue()) { for (Node usage : condition.usages()) { @@ -134,12 +128,9 @@ } } - private final LoweringType loweringType; private final CanonicalizerPhase canonicalizer; - public LoweringPhase(LoweringType loweringType, CanonicalizerPhase canonicalizer) { - super("Lowering (" + loweringType.name() + ")"); - this.loweringType = loweringType; + public LoweringPhase(CanonicalizerPhase canonicalizer) { this.canonicalizer = canonicalizer; } @@ -240,7 +231,7 @@ if (node instanceof Lowerable) { assert checkUsagesAreScheduled(node); - ((Lowerable) node).lower(loweringTool, loweringType); + ((Lowerable) node).lower(loweringTool); } if (!nextNode.isAlive()) { diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/InstanceOfSnippetsTemplates.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/InstanceOfSnippetsTemplates.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/InstanceOfSnippetsTemplates.java Tue Sep 10 19:18:24 2013 +0200 @@ -93,7 +93,7 @@ */ protected InstanceOfUsageReplacer createReplacer(FloatingNode instanceOf, Instantiation instantiation, Node usage, final StructuredGraph graph) { InstanceOfUsageReplacer replacer; - if (usage instanceof IfNode || usage instanceof FixedGuardNode || usage instanceof ShortCircuitBooleanNode || usage instanceof GuardingPiNode) { + if (usage instanceof IfNode || usage instanceof FixedGuardNode || usage instanceof ShortCircuitOrNode || usage instanceof GuardingPiNode) { replacer = new NonMaterializationUsageReplacer(instantiation, ConstantNode.forInt(1, graph), ConstantNode.forInt(0, graph), instanceOf, usage); } else { assert usage instanceof ConditionalNode : "unexpected usage of " + instanceOf + ": " + usage; diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/DirectObjectStoreNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -64,7 +64,7 @@ public static native void storeInt(Object obj, @ConstantNodeParameter int displacement, long offset, int value); @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, value.kind(), displacement, offset, graph(), 1); WriteNode write = graph().add(new WriteNode(object, value, location, BarrierType.NONE, value.kind() == Kind.Object)); graph().replaceFixedWithFixed(this, write); diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -79,7 +79,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { boolean nullCheck = false; StructuredGraph replacementGraph = getSnippetGraph(tool); if (replacementGraph == null) { diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java --- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java Tue Sep 10 19:18:24 2013 +0200 @@ -36,7 +36,6 @@ import com.oracle.graal.loop.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.java.*; -import com.oracle.graal.nodes.spi.Lowerable.LoweringType; import com.oracle.graal.phases.*; import com.oracle.graal.phases.PhasePlan.PhasePosition; import com.oracle.graal.phases.common.*; @@ -197,7 +196,7 @@ canonicalizer.apply(graph, context); new DeadCodeEliminationPhase().apply(graph); - new LoweringPhase(LoweringType.BEFORE_GUARDS, new CanonicalizerPhase(true)).apply(graph, context); + new LoweringPhase(new CanonicalizerPhase(true)).apply(graph, context); canonicalizer.apply(graph, context); new DeadCodeEliminationPhase().apply(graph); return graph; diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerAddExactNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -77,7 +77,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { IntegerExactArithmeticSplitNode.lower(tool, this); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerExactArithmeticSplitNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerExactArithmeticSplitNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerExactArithmeticSplitNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -29,7 +29,6 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.nodes.spi.Lowerable.*; import com.oracle.graal.nodes.type.*; public abstract class IntegerExactArithmeticSplitNode extends ControlSplitNode implements LIRGenLowerable { @@ -82,7 +81,7 @@ protected abstract Value generateArithmetic(LIRGeneratorTool generator); static void lower(LoweringTool tool, IntegerExactArithmeticNode node) { - if (tool.getLoweringType() == LoweringType.AFTER_GUARDS) { + if (node.asNode().graph().getGuardsPhase() == StructuredGraph.GuardsPhase.FIXED_DEOPTS) { FloatingNode floatingNode = (FloatingNode) node; FixedWithNextNode previous = tool.lastFixedNode(); FixedNode next = previous.next(); diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulExactNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulExactNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerMulExactNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -73,7 +73,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { IntegerExactArithmeticSplitNode.lower(tool, this); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/arithmetic/IntegerSubExactNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -77,7 +77,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { IntegerExactArithmeticSplitNode.lower(tool, this); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverInlineMacroNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverInlineMacroNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/asserts/NeverInlineMacroNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -33,7 +33,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { InvokeNode invoke = createInvoke(); graph().replaceFixedWithFixed(this, invoke); invoke.setUseForInlining(false); diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameGetNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameGetNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameGetNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -70,7 +70,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { assert !(getFrame() instanceof NewFrameNode); StructuredGraph structuredGraph = graph(); diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameSetNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameSetNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/frame/FrameSetNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -70,7 +70,7 @@ } @Override - public void lower(LoweringTool tool, LoweringType loweringType) { + public void lower(LoweringTool tool) { assert !(getFrame() instanceof NewFrameNode); StructuredGraph structuredGraph = graph(); diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomTypeCheckNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomTypeCheckNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/CustomTypeCheckNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -50,8 +50,8 @@ return customType; } - public void lower(LoweringTool tool, LoweringType loweringType) { - if (loweringType == LoweringType.BEFORE_GUARDS) { + public void lower(LoweringTool tool) { + if (graph().getGuardsPhase() == StructuredGraph.GuardsPhase.FLOATING_GUARDS) { this.replaceAtUsages(graph().unique(new IntegerEqualsNode(condition, ConstantNode.forInt(1, graph())))); this.safeDelete(); } diff -r 809609e6abe6 -r 65cedae2647e graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/TypeCastNode.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/TypeCastNode.java Tue Sep 10 17:38:02 2013 +0200 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/nodes/typesystem/TypeCastNode.java Tue Sep 10 19:18:24 2013 +0200 @@ -59,8 +59,8 @@ return customType; } - public void lower(LoweringTool tool, LoweringType loweringType) { - if (loweringType == LoweringType.BEFORE_GUARDS) { + public void lower(LoweringTool tool) { + if (graph().getGuardsPhase() == StructuredGraph.GuardsPhase.FLOATING_GUARDS) { ValueAnchorNode valueAnchorNode = graph().add(new ValueAnchorNode()); UnsafeCastNode unsafeCast = graph().unique(new UnsafeCastNode(object, this.stamp(), (GuardingNode) valueAnchorNode)); this.replaceAtUsages(unsafeCast);