# HG changeset patch # User twisti # Date 1375640943 25200 # Node ID ebaef68b38f95bd6662193d9e9c1901c92064dbb # Parent d0c9278fe4716afb77f85da199f01fcb67cd66b8# Parent 769ad79b8e0c53c2349c9638bf2a249629d087df Merge diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -307,8 +307,8 @@ private void processMethod(final String snippet) { graph = parse(snippet); Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements); - new InliningPhase(runtime(), null, replacements, assumptions, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); + HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + new InliningPhase().apply(graph, context); new PartialEscapePhase(false, new CanonicalizerPhase(true)).apply(graph, context); } @@ -324,9 +324,9 @@ graph = parse(snippet); Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements); + HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true); - new InliningPhase(runtime(), null, replacements, assumptions, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); + new InliningPhase().apply(graph, context); if (loopPeeling) { new LoopTransformHighPhase().apply(graph); } @@ -338,7 +338,7 @@ canonicalizer.apply(graph, context); StructuredGraph referenceGraph = parse(referenceSnippet); - new InliningPhase(runtime(), null, replacements, assumptions, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(referenceGraph); + new InliningPhase().apply(referenceGraph, context); new DeadCodeEliminationPhase().apply(referenceGraph); new CanonicalizerPhase(true).apply(referenceGraph, context); diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/DegeneratedLoopsTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/DegeneratedLoopsTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/DegeneratedLoopsTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -29,6 +29,7 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; +import com.oracle.graal.phases.tiers.*; /** * In the following tests, the usages of local variable "a" are replaced with the integer constant @@ -81,8 +82,9 @@ public void run() { StructuredGraph graph = parse(snippet); - new InliningPhase(runtime(), null, replacements, new Assumptions(false), null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); - new CanonicalizerPhase.Instance(runtime(), new Assumptions(false), true).apply(graph); + HighTierContext context = new HighTierContext(runtime(), new Assumptions(false), replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + new InliningPhase().apply(graph, context); + new CanonicalizerPhase(true).apply(graph, context); Debug.dump(graph, "Graph"); StructuredGraph referenceGraph = parse(REFERENCE_SNIPPET); Debug.dump(referenceGraph, "ReferenceGraph"); diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -39,6 +39,7 @@ import com.oracle.graal.nodes.java.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; +import com.oracle.graal.phases.tiers.*; public class FinalizableSubclassTest extends GraalCompilerTest { @@ -67,8 +68,9 @@ GraphBuilderConfiguration conf = GraphBuilderConfiguration.getSnippetDefault(); new GraphBuilderPhase(runtime, conf, OptimisticOptimizations.ALL).apply(graph); - new InliningPhase(runtime(), null, replacements, assumptions, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); - new CanonicalizerPhase.Instance(runtime(), assumptions, true).apply(graph); + HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + new InliningPhase().apply(graph, context); + new CanonicalizerPhase(true).apply(graph, context); return graph; } diff -r d0c9278fe471 -r ebaef68b38f9 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 Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -59,7 +59,7 @@ public void run() { StructuredGraph graph = parse(snippet); - HighTierContext context = new HighTierContext(runtime(), new Assumptions(false), replacements); + PhaseContext context = new PhaseContext(runtime(), new Assumptions(false), replacements); new LoweringPhase(LoweringType.BEFORE_GUARDS).apply(graph, context); new FloatingReadPhase().apply(graph); diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -403,16 +403,6 @@ } /** - * Can be overridden to modify the compilation phases applied for a test. - * - * @param method the method being compiled - * @param graph the graph being compiled - * @param phasePlan the phase plan to be edited - */ - protected void editPhasePlan(ResolvedJavaMethod method, StructuredGraph graph, PhasePlan phasePlan) { - } - - /** * Gets installed code for a given method and graph, compiling it first if necessary. * * @param forceCompile specifies whether to ignore any previous code cached for the (method, @@ -442,7 +432,6 @@ PhasePlan phasePlan = new PhasePlan(); GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); - editPhasePlan(method, graph, phasePlan); CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); final CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, method, runtime, replacements, backend, runtime().getTarget(), null, phasePlan, OptimisticOptimizations.ALL, new SpeculationLog(), suites, new CompilationResult()); diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeExceptionTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeExceptionTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeExceptionTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -30,6 +30,7 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; +import com.oracle.graal.phases.tiers.*; public class InvokeExceptionTest extends GraalCompilerTest { @@ -65,8 +66,9 @@ hints.put(invoke, 1000d); } Assumptions assumptions = new Assumptions(false); - new InliningPhase(runtime(), hints, replacements, assumptions, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); - new CanonicalizerPhase.Instance(runtime(), assumptions, true).apply(graph); + HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + new InliningPhase(hints).apply(graph, context); + new CanonicalizerPhase(true).apply(graph, context); new DeadCodeEliminationPhase().apply(graph); } } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeHintsTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeHintsTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InvokeHintsTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -30,6 +30,7 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; +import com.oracle.graal.phases.tiers.*; public class InvokeHintsTest extends GraalCompilerTest { @@ -76,8 +77,9 @@ } Assumptions assumptions = new Assumptions(false); - new InliningPhase(runtime(), hints, replacements, assumptions, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); - new CanonicalizerPhase.Instance(runtime(), assumptions, true).apply(graph); + HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + new InliningPhase(hints).apply(graph, context); + new CanonicalizerPhase(true).apply(graph, context); new DeadCodeEliminationPhase().apply(graph); StructuredGraph referenceGraph = parse(REFERENCE_SNIPPET); assertEquals(referenceGraph, graph); diff -r d0c9278fe471 -r ebaef68b38f9 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 Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LockEliminationTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -91,11 +91,12 @@ StructuredGraph graph = parse(method); PhasePlan phasePlan = getDefaultPhasePlan(); Assumptions assumptions = new Assumptions(true); - new CanonicalizerPhase.Instance(runtime(), assumptions, true).apply(graph); - new InliningPhase(runtime(), null, replacements, assumptions, null, phasePlan, OptimisticOptimizations.ALL).apply(graph); - new CanonicalizerPhase.Instance(runtime(), assumptions, true).apply(graph); + HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, phasePlan, OptimisticOptimizations.ALL); + new CanonicalizerPhase(true).apply(graph, context); + new InliningPhase().apply(graph, context); + new CanonicalizerPhase(true).apply(graph, context); new DeadCodeEliminationPhase().apply(graph); - new LoweringPhase(LoweringType.BEFORE_GUARDS).apply(graph, new PhaseContext(runtime, assumptions, replacements)); + new LoweringPhase(LoweringType.BEFORE_GUARDS).apply(graph, context); new ValueAnchorCleanupPhase().apply(graph); new LockEliminationPhase().apply(graph); return graph; diff -r d0c9278fe471 -r ebaef68b38f9 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 Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -499,10 +499,10 @@ @Override public SchedulePhase call() throws Exception { Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements); + HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); new CanonicalizerPhase(true).apply(graph, context); if (mode == TestMode.INLINED_WITHOUT_FRAMESTATES) { - new InliningPhase(runtime(), null, replacements, assumptions, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); + new InliningPhase().apply(graph, context); } new LoweringPhase(LoweringType.BEFORE_GUARDS).apply(graph, context); if (mode == TestMode.WITHOUT_FRAMESTATES || mode == TestMode.INLINED_WITHOUT_FRAMESTATES) { diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MonitorGraphTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MonitorGraphTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MonitorGraphTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -35,6 +35,7 @@ import com.oracle.graal.nodes.java.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; +import com.oracle.graal.phases.tiers.*; /** * In the following tests, the usages of local variable "a" are replaced with the integer constant @@ -93,8 +94,9 @@ hints.put(invoke, 1000d); } Assumptions assumptions = new Assumptions(false); - new InliningPhase(runtime(), hints, replacements, assumptions, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); - new CanonicalizerPhase.Instance(runtime(), assumptions, true).apply(graph); + HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + new InliningPhase(hints).apply(graph, context); + new CanonicalizerPhase(true).apply(graph, context); new DeadCodeEliminationPhase().apply(graph); return graph; } diff -r d0c9278fe471 -r ebaef68b38f9 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 Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/PushNodesThroughPiTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -90,7 +90,7 @@ private StructuredGraph compileTestSnippet(final String snippet) { StructuredGraph graph = parse(snippet); - HighTierContext context = new HighTierContext(runtime(), new Assumptions(false), replacements); + PhaseContext context = new PhaseContext(runtime(), new Assumptions(false), replacements); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true); new LoweringPhase(LoweringType.BEFORE_GUARDS).apply(graph, context); canonicalizer.apply(graph, context); diff -r d0c9278fe471 -r ebaef68b38f9 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 Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReadAfterCheckCastTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -84,7 +84,7 @@ // structure changes significantly public void run() { StructuredGraph graph = parse(snippet); - HighTierContext context = new HighTierContext(runtime(), new Assumptions(false), replacements); + PhaseContext context = new PhaseContext(runtime(), new Assumptions(false), replacements); new LoweringPhase(LoweringType.BEFORE_GUARDS).apply(graph, context); new FloatingReadPhase().apply(graph); new EliminatePartiallyRedundantGuardsPhase(true, false).apply(graph); diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EarlyReadEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EarlyReadEliminationTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EarlyReadEliminationTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -41,8 +41,8 @@ protected void processMethod(final String snippet) { graph = parse(snippet); Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements); - new InliningPhase(runtime(), null, replacements, assumptions, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); + HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + new InliningPhase().apply(graph, context); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true); new EarlyReadEliminationPhase(canonicalizer).apply(graph, context); } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -217,8 +217,8 @@ new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph); Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements); - new InliningPhase(runtime(), null, replacements, assumptions, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); + HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + new InliningPhase().apply(graph, context); new DeadCodeEliminationPhase().apply(graph); new PartialEscapePhase(iterativeEscapeAnalysis, new CanonicalizerPhase(true)).apply(graph, context); Assert.assertEquals(1, graph.getNodes(ReturnNode.class).count()); diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -88,7 +88,7 @@ private void processMethod(final String snippet) { graph = parse(snippet); - HighTierContext context = new HighTierContext(runtime(), new Assumptions(false), replacements); - new IterativeInliningPhase(null, getDefaultPhasePlan(), OptimisticOptimizations.ALL, new CanonicalizerPhase(true)).apply(graph, context); + HighTierContext context = new HighTierContext(runtime(), new Assumptions(false), replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + new IterativeInliningPhase(new CanonicalizerPhase(true)).apply(graph, context); } } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -243,8 +243,8 @@ protected void processMethod(final String snippet) { graph = parse(snippet); Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements); - new InliningPhase(runtime(), null, replacements, assumptions, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); + HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + new InliningPhase().apply(graph, context); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true); new PartialEscapePhase(false, true, canonicalizer).apply(graph, context); } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PartialEscapeAnalysisTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PartialEscapeAnalysisTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PartialEscapeAnalysisTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -159,8 +159,8 @@ StructuredGraph graph = parse(snippet); Assumptions assumptions = new Assumptions(false); - HighTierContext context = new HighTierContext(runtime(), assumptions, replacements); - new InliningPhase(runtime(), null, replacements, assumptions, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); + HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + new InliningPhase().apply(graph, context); new DeadCodeEliminationPhase().apply(graph); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(true); canonicalizer.apply(graph, context); diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java --- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -36,6 +36,7 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; +import com.oracle.graal.phases.tiers.*; import com.oracle.graal.test.*; public class InliningTest extends GraalCompilerTest { @@ -236,11 +237,12 @@ StructuredGraph graph = eagerInfopointMode ? parseDebug(method) : parse(method); PhasePlan phasePlan = getDefaultPhasePlan(eagerInfopointMode); Assumptions assumptions = new Assumptions(true); + HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, phasePlan, OptimisticOptimizations.ALL); Debug.dump(graph, "Graph"); - new CanonicalizerPhase.Instance(runtime(), assumptions, true).apply(graph); - new InliningPhase(runtime(), null, replacements, assumptions, null, phasePlan, OptimisticOptimizations.ALL).apply(graph); + new CanonicalizerPhase(true).apply(graph, context); + new InliningPhase().apply(graph, context); Debug.dump(graph, "Graph"); - new CanonicalizerPhase.Instance(runtime(), assumptions, true).apply(graph); + new CanonicalizerPhase(true).apply(graph, context); new DeadCodeEliminationPhase().apply(graph); return graph; } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Sun Aug 04 11:29:03 2013 -0700 @@ -40,28 +40,18 @@ import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.util.*; -import com.oracle.graal.options.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.PhasePlan.PhasePosition; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.graph.*; import com.oracle.graal.phases.schedule.*; import com.oracle.graal.phases.tiers.*; -import com.oracle.graal.phases.verify.*; -import com.oracle.graal.virtual.phases.ea.*; /** * Static methods for orchestrating the compilation of a {@linkplain StructuredGraph graph}. */ public class GraalCompiler { - // @formatter:off - @Option(help = "") - public static final OptionValue VerifyUsageWithEquals = new OptionValue<>(true); - @Option(help = "Enable inlining") - public static final OptionValue Inline = new OptionValue<>(true); - // @formatter:on - /** * Requests compilation of a given graph. * @@ -138,34 +128,8 @@ } else { Debug.dump(graph, "initial state"); } - if (VerifyUsageWithEquals.getValue()) { - new VerifyUsageWithEquals(runtime, Value.class).apply(graph); - new VerifyUsageWithEquals(runtime, Register.class).apply(graph); - } - CanonicalizerPhase canonicalizer = new CanonicalizerPhase(!AOTCompilation.getValue()); - HighTierContext highTierContext = new HighTierContext(runtime, assumptions, replacements); - - if (OptCanonicalizer.getValue()) { - canonicalizer.apply(graph, highTierContext); - } - - if (Inline.getValue() && !plan.isPhaseDisabled(InliningPhase.class)) { - if (IterativeInlining.getValue()) { - new IterativeInliningPhase(cache, plan, optimisticOpts, canonicalizer).apply(graph, highTierContext); - } else { - new InliningPhase(runtime, null, replacements, assumptions, cache, plan, optimisticOpts).apply(graph); - new DeadCodeEliminationPhase().apply(graph); - - if (ConditionalElimination.getValue() && OptCanonicalizer.getValue()) { - canonicalizer.apply(graph, highTierContext); - new IterativeConditionalEliminationPhase().apply(graph, highTierContext); - } - } - } - TypeProfileProxyNode.cleanFromGraph(graph); - - plan.runPhases(PhasePosition.HIGH_LEVEL, graph); + HighTierContext highTierContext = new HighTierContext(runtime, assumptions, replacements, cache, plan, optimisticOpts); suites.getHighTier().apply(graph, highTierContext); MidTierContext midTierContext = new MidTierContext(runtime, assumptions, replacements, target, optimisticOpts); diff -r d0c9278fe471 -r ebaef68b38f9 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 Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/HighTier.java Sun Aug 04 11:29:03 2013 -0700 @@ -24,18 +24,54 @@ import static com.oracle.graal.phases.GraalOptions.*; +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.*; import com.oracle.graal.phases.tiers.*; +import com.oracle.graal.phases.verify.*; import com.oracle.graal.virtual.phases.ea.*; public class HighTier extends PhaseSuite { + // @formatter:off + @Option(help = "") + public static final OptionValue VerifyUsageWithEquals = new OptionValue<>(true); + @Option(help = "Enable inlining") + public static final OptionValue Inline = new OptionValue<>(true); + // @formatter:on + public HighTier() { CanonicalizerPhase canonicalizer = new CanonicalizerPhase(!AOTCompilation.getValue()); + if (VerifyUsageWithEquals.getValue()) { + appendPhase(new VerifyUsageWithEquals(Value.class)); + appendPhase(new VerifyUsageWithEquals(Register.class)); + } + + if (OptCanonicalizer.getValue()) { + appendPhase(canonicalizer); + } + + if (Inline.getValue()) { + if (IterativeInlining.getValue()) { + appendPhase(new IterativeInliningPhase(canonicalizer)); + } else { + appendPhase(new InliningPhase()); + appendPhase(new DeadCodeEliminationPhase()); + + if (ConditionalElimination.getValue() && OptCanonicalizer.getValue()) { + appendPhase(canonicalizer); + appendPhase(new IterativeConditionalEliminationPhase()); + } + } + } + + appendPhase(new CleanTypeProfileProxyPhase()); + if (FullUnroll.getValue()) { appendPhase(new LoopFullUnrollPhase(!AOTCompilation.getValue())); } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java --- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -202,7 +202,6 @@ PhasePlan phasePlan = new PhasePlan(); GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL); phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase); - editPhasePlan(method, graph, phasePlan); CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false); // create suites everytime, as we modify options for the compiler final Suites suitesLocal = Graal.getRequiredCapability(SuitesProvider.class).createSuites(); diff -r d0c9278fe471 -r ebaef68b38f9 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 Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -207,6 +207,27 @@ test2("testUnsafeLoad", wr, new Long(16), new Integer(16)); } + static Object[] src = new Object[1]; + static Object[] dst = new Object[1]; + + static { + for (int i = 0; i < src.length; i++) { + src[i] = new Object(); + } + for (int i = 0; i < dst.length; i++) { + dst[i] = new Object(); + } + } + + public static void testArrayCopy(Object a, Object b, Object c) throws Exception { + System.arraycopy(a, 0, b, 0, (int) c); + } + + @Test + public void test11() throws Exception { + test2("testArrayCopy", src, dst, dst.length); + } + public static Object testUnsafeLoad(Object a, Object b, Object c) throws Exception { final int offset = (c == null ? 0 : ((Integer) c).intValue()); final long displacement = (b == null ? 0 : ((Long) b).longValue()); @@ -225,8 +246,8 @@ public void run() { StructuredGraph graph = parse(snippet); - HighTierContext context = new HighTierContext(runtime(), new Assumptions(false), replacements); - new InliningPhase(runtime(), replacements, context.getAssumptions(), null, getDefaultPhasePlan(), OptimisticOptimizations.ALL, new InliningPhase.InlineEverythingPolicy()).apply(graph); + HighTierContext context = new HighTierContext(runtime(), new Assumptions(false), replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + new InliningPhase(new InliningPhase.InlineEverythingPolicy()).apply(graph, context); new LoweringPhase(LoweringType.BEFORE_GUARDS).apply(graph, context); new WriteBarrierAdditionPhase().apply(graph); Debug.dump(graph, "After Write Barrier Addition"); diff -r d0c9278fe471 -r ebaef68b38f9 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 Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -632,8 +632,8 @@ public AssertionError call() { final StructuredGraph graph = parse(snippet); - HighTierContext highTierContext = new HighTierContext(runtime(), new Assumptions(false), replacements); - new InliningPhase(runtime(), null, replacements, new Assumptions(false), null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); + HighTierContext highTierContext = new HighTierContext(runtime(), new Assumptions(false), replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL); + new InliningPhase().apply(graph, highTierContext); MidTierContext midTierContext = new MidTierContext(runtime(), new Assumptions(false), replacements, runtime().getTarget(), OptimisticOptimizations.ALL); diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Sun Aug 04 11:29:03 2013 -0700 @@ -506,6 +506,7 @@ public long vmErrorAddress; public long writeBarrierPreAddress; public long writeBarrierPostAddress; + public long validateObject; public long javaTimeMillisAddress; public long javaTimeNanosAddress; public long arithmeticSinAddress; diff -r d0c9278fe471 -r ebaef68b38f9 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 Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Sun Aug 04 11:29:03 2013 -0700 @@ -311,6 +311,8 @@ linkForeignCall(r, OSR_MIGRATION_END, c.osrMigrationEndAddress, DONT_PREPEND_THREAD, LEAF, NOT_REEXECUTABLE, NO_LOCATIONS); linkForeignCall(r, G1WBPRECALL, c.writeBarrierPreAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS); linkForeignCall(r, G1WBPOSTCALL, c.writeBarrierPostAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS); + linkForeignCall(r, VALIDATEOBJECT, c.validateObject, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS); + if (IntrinsifyObjectMethods.getValue()) { r.registerSubstitutions(ObjectSubstitutions.class); } @@ -634,18 +636,20 @@ graph.replaceFixedWithFixed(storeIndexed, memoryWrite); } else if (n instanceof UnsafeLoadNode) { - UnsafeLoadNode load = (UnsafeLoadNode) n; - assert load.kind() != Kind.Illegal; - boolean compressible = (!load.object().isNullConstant() && load.accessKind() == Kind.Object); - if (addReadBarrier(load, tool)) { - unsafeLoadSnippets.lower(load, tool); - } else { - IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, load.accessKind(), load.displacement(), load.offset(), graph, 1); - ReadNode memoryRead = graph.add(new ReadNode(load.object(), location, load.stamp(), BarrierType.NONE, compressible)); - // An unsafe read must not float outside its block otherwise - // it may float above an explicit null check on its object. - memoryRead.setGuard(AbstractBeginNode.prevBegin(load)); - graph.replaceFixedWithFixed(load, memoryRead); + if (tool.getLoweringType() != LoweringType.BEFORE_GUARDS) { + UnsafeLoadNode load = (UnsafeLoadNode) n; + assert load.kind() != Kind.Illegal; + boolean compressible = (!load.object().isNullConstant() && load.accessKind() == Kind.Object); + if (addReadBarrier(load, tool)) { + unsafeLoadSnippets.lower(load, tool); + } else { + IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, load.accessKind(), load.displacement(), load.offset(), graph, 1); + ReadNode memoryRead = graph.add(new ReadNode(load.object(), location, load.stamp(), BarrierType.NONE, compressible)); + // An unsafe read must not float outside its block otherwise + // it may float above an explicit null check on its object. + memoryRead.setGuard(AbstractBeginNode.prevBegin(load)); + graph.replaceFixedWithFixed(load, memoryRead); + } } } else if (n instanceof UnsafeStoreNode) { UnsafeStoreNode store = (UnsafeStoreNode) n; @@ -885,7 +889,7 @@ private static BarrierType getFieldStoreBarrierType(StoreFieldNode storeField) { BarrierType barrierType = BarrierType.NONE; - if (storeField.field().getKind() == Kind.Object && !storeField.value().objectStamp().alwaysNull()) { + if (storeField.field().getKind() == Kind.Object) { barrierType = BarrierType.IMPRECISE; } return barrierType; @@ -893,7 +897,7 @@ private static BarrierType getArrayStoreBarrierType(StoreIndexedNode store) { BarrierType barrierType = BarrierType.NONE; - if (store.elementKind() == Kind.Object && !store.value().objectStamp().alwaysNull()) { + if (store.elementKind() == Kind.Object) { barrierType = BarrierType.PRECISE; } return barrierType; @@ -901,12 +905,12 @@ private static BarrierType getUnsafeStoreBarrierType(UnsafeStoreNode store) { BarrierType barrierType = BarrierType.NONE; - if (store.value().kind() == Kind.Object && !store.value().objectStamp().alwaysNull()) { + if (store.value().kind() == Kind.Object) { ResolvedJavaType type = store.object().objectStamp().type(); - if (type != null && type.isArray()) { + if (type != null && !type.isArray()) { + barrierType = BarrierType.IMPRECISE; + } else { barrierType = BarrierType.PRECISE; - } else { - barrierType = BarrierType.IMPRECISE; } } return barrierType; @@ -914,12 +918,12 @@ private static BarrierType getCompareAndSwapBarrier(CompareAndSwapNode cas) { BarrierType barrierType = BarrierType.NONE; - if (cas.expected().kind() == Kind.Object && !cas.newValue().objectStamp().alwaysNull()) { + if (cas.expected().kind() == Kind.Object) { ResolvedJavaType type = cas.object().objectStamp().type(); - if (type != null && type.isArray()) { + if (type != null && !type.isArray()) { + barrierType = BarrierType.IMPRECISE; + } else { barrierType = BarrierType.PRECISE; - } else { - barrierType = BarrierType.IMPRECISE; } } return barrierType; diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java Sun Aug 04 11:29:03 2013 -0700 @@ -25,6 +25,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.*; import com.oracle.graal.phases.*; +import com.oracle.graal.phases.tiers.*; /** * Checks for illegal object constants in a graph processed for AOT compilation. The only legal @@ -33,10 +34,10 @@ * * @see LoadJavaMirrorWithKlassPhase */ -public class AheadOfTimeVerificationPhase extends VerifyPhase { +public class AheadOfTimeVerificationPhase extends VerifyPhase { @Override - protected boolean verify(StructuredGraph graph) { + protected boolean verify(StructuredGraph graph, PhaseContext context) { for (ConstantNode node : graph.getNodes().filter(ConstantNode.class)) { assert !isObject(node) || isNullReference(node) || isInternedString(node) : "illegal object constant: " + node; } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java Sun Aug 04 11:29:03 2013 -0700 @@ -56,7 +56,7 @@ private static void addReadNodeBarriers(ReadNode node, StructuredGraph graph) { if (node.getBarrierType() == BarrierType.PRECISE) { assert useG1GC(); - G1ReferentFieldReadBarrier barrier = graph.add(new G1ReferentFieldReadBarrier(node.object(), node, node.location(), false, false)); + G1ReferentFieldReadBarrier barrier = graph.add(new G1ReferentFieldReadBarrier(node.object(), node, node.location(), false)); graph.addAfterFixed(node, barrier); } else { assert node.getBarrierType() == BarrierType.NONE : "Non precise read barrier has been attached to read node."; @@ -75,7 +75,7 @@ } graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(node.object(), node.value(), node.location(), true))); } else { - graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), node.location(), true))); + graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), node.value(), node.location(), true))); } } else if (barrierType == BarrierType.IMPRECISE) { if (useG1GC()) { @@ -85,7 +85,7 @@ graph.addBeforeFixed(node, preBarrier); graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(node.object(), node.value(), node.location(), false))); } else { - graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), node.location(), false))); + graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), node.value(), node.location(), false))); } } else { assert barrierType == BarrierType.NONE; @@ -100,14 +100,14 @@ graph.addBeforeFixed(node, graph.add(new G1PreWriteBarrier(node.object(), node.getExpectedValue(), node.getLocation(), false, false))); graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(node.object(), node.getNewValue(), node.getLocation(), true))); } else { - graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), node.getLocation(), true))); + graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), node.getNewValue(), node.getLocation(), true))); } } else if (barrierType == BarrierType.IMPRECISE) { if (useG1GC()) { graph.addBeforeFixed(node, graph.add(new G1PreWriteBarrier(node.object(), node.getExpectedValue(), node.getLocation(), false, false))); graph.addAfterFixed(node, graph.add(new G1PostWriteBarrier(node.object(), node.getNewValue(), node.getLocation(), false))); } else { - graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), node.getLocation(), false))); + graph.addAfterFixed(node, graph.add(new SerialWriteBarrier(node.object(), node.getNewValue(), node.getLocation(), false))); } } else { assert barrierType == BarrierType.NONE; diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyNode.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/ArrayCopyNode.java Sun Aug 04 11:29:03 2013 -0700 @@ -83,7 +83,7 @@ } // the canonicalization before loop unrolling is needed to propagate the length into // additions, etc. - HighTierContext context = new HighTierContext(tool.getRuntime(), tool.assumptions(), tool.getReplacements()); + PhaseContext context = new PhaseContext(tool.getRuntime(), tool.assumptions(), tool.getReplacements()); new CanonicalizerPhase(true).apply(snippetGraph, context); new LoopFullUnrollPhase(true).apply(snippetGraph, context); new CanonicalizerPhase(true).apply(snippetGraph, context); diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeLoadSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeLoadSnippets.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/UnsafeLoadSnippets.java Sun Aug 04 11:29:03 2013 -0700 @@ -26,6 +26,7 @@ import static com.oracle.graal.replacements.SnippetTemplate.*; import com.oracle.graal.api.code.*; +import com.oracle.graal.hotspot.nodes.*; import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; @@ -39,11 +40,12 @@ @Snippet public static Object lowerUnsafeLoad(Object object, long offset, int disp) { + Object fixedObject = FixedValueAnchorNode.getObject(object); long displacement = disp + offset; if (object instanceof java.lang.ref.Reference && referentOffset() == displacement) { - return Word.fromObject(object).readObject((int) displacement, BarrierType.PRECISE, true); + return Word.fromObject(fixedObject).readObject((int) displacement, BarrierType.PRECISE, true); } else { - return Word.fromObject(object).readObject((int) displacement, BarrierType.NONE, true); + return Word.fromObject(fixedObject).readObject((int) displacement, BarrierType.NONE, true); } } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/WriteBarrierSnippets.java Sun Aug 04 11:29:03 2013 -0700 @@ -50,16 +50,30 @@ private static final SnippetCounter.Group countersWriteBarriers = SnippetCounters.getValue() ? new SnippetCounter.Group("WriteBarriers") : null; private static final SnippetCounter serialFieldWriteBarrierCounter = new SnippetCounter(countersWriteBarriers, "serialFieldWriteBarrier", "Number of Serial Field Write Barriers"); private static final SnippetCounter serialArrayWriteBarrierCounter = new SnippetCounter(countersWriteBarriers, "serialArrayWriteBarrier", "Number of Serial Array Write Barriers"); + private static final SnippetCounter g1AttemptedPostWriteBarrierCounter = new SnippetCounter(countersWriteBarriers, "g1AttemptedPostWriteBarrierCounter", + "Number of attempted G1 Post Write Barriers"); + private static final SnippetCounter g1AttemptedPreWriteBarrierCounter = new SnippetCounter(countersWriteBarriers, "g1AttemptedPreWriteBarrierCounter", "Number of G1 attempted Pre Write Barriers"); + private static final SnippetCounter g1AttemptedRefFieldBarrierCounter = new SnippetCounter(countersWriteBarriers, "g1AttemptedPreWriteBarrierCounter", + "Number of G1 attempted Ref Field Read Barriers"); + private static final SnippetCounter g1EffectivePostWriteBarrierCounter = new SnippetCounter(countersWriteBarriers, "g1EffectivePostWriteBarrierCounter", + "Number of effective G1 Post Write Barriers"); + private static final SnippetCounter g1EffectivePreWriteBarrierCounter = new SnippetCounter(countersWriteBarriers, "g1EffectivePreWriteBarrierCounter", "Number of G1 effective Pre Write Barriers"); + private static final SnippetCounter g1EffectiveRefFieldBarrierCounter = new SnippetCounter(countersWriteBarriers, "g1EffectiveRefFieldBarrierCounter", + "Number of G1 effective Ref Field Read Barriers"); @Snippet - public static void serialArrayWriteBarrier(Object obj, Object location, @ConstantParameter boolean usePrecise) { - Object object = FixedValueAnchorNode.getObject(obj); + public static void serialWriteBarrier(Object object, Object location, @ConstantParameter boolean usePrecise, @ConstantParameter boolean alwaysNull) { + // No barriers are added if we are always storing a null. + if (alwaysNull) { + return; + } + Object fixedObject = FixedValueAnchorNode.getObject(object); Pointer oop; if (usePrecise) { - oop = Word.fromArray(object, location); + oop = Word.fromArray(fixedObject, location); serialArrayWriteBarrierCounter.inc(); } else { - oop = Word.fromObject(object); + oop = Word.fromObject(fixedObject); serialFieldWriteBarrierCounter.inc(); } Word base = (Word) oop.unsignedShiftRight(cardTableShift()); @@ -75,6 +89,9 @@ @Snippet public static void serialArrayRangeWriteBarrier(Object object, int startIndex, int length) { + if (length == 0) { + return; + } Object dest = FixedValueAnchorNode.getObject(object); int cardShift = cardTableShift(); long cardStart = cardTableStart(); @@ -124,9 +141,17 @@ log(trace, "[%d] G1-Pre Thread %p Previous Object %p\n ", gcCycle, thread.rawValue(), previousOop.rawValue()); verifyOop(previousOop.toObject()); } + g1AttemptedPreWriteBarrierCounter.inc(); + } else { + g1AttemptedRefFieldBarrierCounter.inc(); } // If the previous value is null the barrier should not be issued. if (probability(FREQUENT_PROBABILITY, previousOop.notEqual(0))) { + if (doLoad) { + g1EffectivePreWriteBarrierCounter.inc(); + } else { + g1EffectiveRefFieldBarrierCounter.inc(); + } // If the thread-local SATB buffer is full issue a native call which will // initialize a new one and add the entry. if (probability(FREQUENT_PROBABILITY, indexValue.notEqual(0))) { @@ -143,24 +168,28 @@ } @Snippet - public static void g1PostWriteBarrier(Object object, Object value, Object location, @ConstantParameter boolean usePrecise, @ConstantParameter boolean trace) { + public static void g1PostWriteBarrier(Object object, Object value, Object location, @ConstantParameter boolean usePrecise, @ConstantParameter boolean alwaysNull, @ConstantParameter boolean trace) { + // No barriers are added if we are always storing a null. + if (alwaysNull) { + return; + } Word thread = thread(); Object fixedObject = FixedValueAnchorNode.getObject(object); Object fixedValue = FixedValueAnchorNode.getObject(value); verifyOop(fixedObject); verifyOop(fixedValue); - Word oop = (Word) Word.fromObject(fixedObject); - Word field; + validateObject(fixedObject, fixedValue); + Word oop; if (usePrecise) { - field = (Word) Word.fromArray(fixedObject, location); + oop = (Word) Word.fromArray(fixedObject, location); } else { - field = oop; + oop = (Word) Word.fromObject(fixedObject); } int gcCycle = 0; if (trace) { gcCycle = (int) Word.unsigned(HotSpotReplacementsUtil.gcTotalCollectionsAddress()).readLong(0); log(trace, "[%d] G1-Post Thread: %p Object: %p\n", gcCycle, thread.rawValue(), Word.fromObject(fixedObject).rawValue()); - log(trace, "[%d] G1-Post Thread: %p Field: %p\n", gcCycle, thread.rawValue(), field.rawValue()); + log(trace, "[%d] G1-Post Thread: %p Field: %p\n", gcCycle, thread.rawValue(), oop.rawValue()); } Word writtenValue = (Word) Word.fromObject(fixedValue); Word bufferAddress = thread.readWord(g1CardQueueBufferOffset()); @@ -168,11 +197,11 @@ Word indexValue = thread.readWord(g1CardQueueIndexOffset()); // The result of the xor reveals whether the installed pointer crosses heap regions. // In case it does the write barrier has to be issued. - Word xorResult = (field.xor(writtenValue)).unsignedShiftRight(logOfHeapRegionGrainBytes()); + Word xorResult = (oop.xor(writtenValue)).unsignedShiftRight(logOfHeapRegionGrainBytes()); // Calculate the address of the card to be enqueued to the // thread local card queue. - Word cardBase = field.unsignedShiftRight(cardTableShift()); + Word cardBase = oop.unsignedShiftRight(cardTableShift()); long startAddress = cardTableStart(); int displacement = 0; if (((int) startAddress) == startAddress) { @@ -182,12 +211,14 @@ } Word cardAddress = cardBase.add(displacement); + g1AttemptedPostWriteBarrierCounter.inc(); if (probability(LIKELY_PROBABILITY, xorResult.notEqual(0))) { // If the written value is not null continue with the barrier addition. if (probability(FREQUENT_PROBABILITY, writtenValue.notEqual(0))) { byte cardByte = cardAddress.readByte(0); // If the card is already dirty, (hence already enqueued) skip the insertion. if (probability(LIKELY_PROBABILITY, cardByte != (byte) 0)) { + g1EffectivePostWriteBarrierCounter.inc(); log(trace, "[%d] G1-Post Thread: %p Card: %p \n", gcCycle, thread.rawValue(), Word.unsigned(cardByte).rawValue()); cardAddress.writeByte(0, (byte) 0); // If the thread local card queue is full, issue a native call which will @@ -209,31 +240,31 @@ @Snippet public static void g1ArrayRangePreWriteBarrier(Object object, int startIndex, int length) { - Object dest = FixedValueAnchorNode.getObject(object); Word thread = thread(); byte markingValue = thread.readByte(g1SATBQueueMarkingOffset()); + // If the concurrent marker is not enabled or the vector length is zero, return. + if (markingValue == (byte) 0 || length == 0) { + return; + } + Object dest = FixedValueAnchorNode.getObject(object); Word bufferAddress = thread.readWord(g1SATBQueueBufferOffset()); Word indexAddress = thread.add(g1SATBQueueIndexOffset()); - Word indexValue = indexAddress.readWord(0); - - // If the concurrent marker is not enabled return. - if (markingValue == (byte) 0) { - return; - } - Word oop; + long dstAddr = GetObjectAddressNode.get(dest); + long indexValue = indexAddress.readWord(0).rawValue(); final int scale = arrayIndexScale(Kind.Object); int header = arrayBaseOffset(Kind.Object); for (int i = startIndex; i < length; i++) { - Word address = (Word) Word.fromObject(dest).add(header).add(Word.unsigned(i * (long) scale)); - oop = (Word) Word.fromObject(address.readObject(0, BarrierType.NONE, true)); + long address = dstAddr + header + (i * scale); + Pointer oop = Word.fromObject(Word.unsigned(address).readObject(0, BarrierType.NONE, true)); + verifyOop(oop.toObject()); if (oop.notEqual(0)) { - if (indexValue.notEqual(0)) { - Word nextIndex = indexValue.subtract(wordSize()); - Word logAddress = bufferAddress.add(nextIndex); + if (indexValue != 0) { + indexValue = indexValue - wordSize(); + Word logAddress = bufferAddress.add(Word.unsigned(indexValue)); // Log the object to be marked as well as update the SATB's buffer next index. logAddress.writeWord(0, oop); - indexAddress.writeWord(0, nextIndex); + indexAddress.writeWord(0, Word.unsigned(indexValue)); } else { g1PreBarrierStub(G1WBPRECALL, oop.toObject()); } @@ -243,11 +274,14 @@ @Snippet public static void g1ArrayRangePostWriteBarrier(Object object, int startIndex, int length) { + if (length == 0) { + return; + } Object dest = FixedValueAnchorNode.getObject(object); Word thread = thread(); Word bufferAddress = thread.readWord(g1CardQueueBufferOffset()); Word indexAddress = thread.add(g1CardQueueIndexOffset()); - Word indexValue = thread.readWord(g1CardQueueIndexOffset()); + long indexValue = thread.readWord(g1CardQueueIndexOffset()).rawValue(); int cardShift = cardTableShift(); long cardStart = cardTableStart(); @@ -266,13 +300,13 @@ cardAddress.writeByte(0, (byte) 0); // If the thread local card queue is full, issue a native call which will // initialize a new one and add the card entry. - if (indexValue.notEqual(0)) { - Word nextIndex = indexValue.subtract(wordSize()); - Word logAddress = bufferAddress.add(nextIndex); + if (indexValue != 0) { + indexValue = indexValue - wordSize(); + Word logAddress = bufferAddress.add(Word.unsigned(indexValue)); // Log the object to be scanned as well as update // the card queue's next index. logAddress.writeWord(0, cardAddress); - indexAddress.writeWord(0, nextIndex); + indexAddress.writeWord(0, Word.unsigned(indexValue)); } else { g1PostBarrierStub(G1WBPOSTCALL, cardAddress); } @@ -292,10 +326,9 @@ public static class Templates extends AbstractTemplates { - private final SnippetInfo serialArrayWriteBarrier = snippet(WriteBarrierSnippets.class, "serialArrayWriteBarrier"); + private final SnippetInfo serialWriteBarrier = snippet(WriteBarrierSnippets.class, "serialWriteBarrier"); private final SnippetInfo serialArrayRangeWriteBarrier = snippet(WriteBarrierSnippets.class, "serialArrayRangeWriteBarrier"); private final SnippetInfo g1PreWriteBarrier = snippet(WriteBarrierSnippets.class, "g1PreWriteBarrier"); - private final SnippetInfo g1ReferentReadBarrier = snippet(WriteBarrierSnippets.class, "g1PreWriteBarrier"); private final SnippetInfo g1PostWriteBarrier = snippet(WriteBarrierSnippets.class, "g1PostWriteBarrier"); private final SnippetInfo g1ArrayRangePreWriteBarrier = snippet(WriteBarrierSnippets.class, "g1ArrayRangePreWriteBarrier"); @@ -305,12 +338,13 @@ super(runtime, replacements, target); } - public void lower(SerialWriteBarrier arrayWriteBarrier, @SuppressWarnings("unused") LoweringTool tool) { - Arguments args = new Arguments(serialArrayWriteBarrier); - args.add("obj", arrayWriteBarrier.getObject()); - args.add("location", arrayWriteBarrier.getLocation()); - args.addConst("usePrecise", arrayWriteBarrier.usePrecise()); - template(args).instantiate(runtime, arrayWriteBarrier, DEFAULT_REPLACER, args); + public void lower(SerialWriteBarrier writeBarrier, @SuppressWarnings("unused") LoweringTool tool) { + Arguments args = new Arguments(serialWriteBarrier); + args.add("object", writeBarrier.getObject()); + args.add("location", writeBarrier.getLocation()); + args.addConst("usePrecise", writeBarrier.usePrecise()); + args.addConst("alwaysNull", writeBarrier.getValue().objectStamp().alwaysNull()); + template(args).instantiate(runtime, writeBarrier, DEFAULT_REPLACER, args); } public void lower(SerialArrayRangeWriteBarrier arrayRangeWriteBarrier, @SuppressWarnings("unused") LoweringTool tool) { @@ -338,7 +372,7 @@ args.add("expectedObject", readBarrier.getExpectedObject()); args.add("location", readBarrier.getLocation()); args.addConst("doLoad", readBarrier.doLoad()); - args.addConst("nullCheck", readBarrier.getNullCheck()); + args.addConst("nullCheck", false); args.addConst("trace", traceBarrier()); template(args).instantiate(runtime, readBarrier, DEFAULT_REPLACER, args); } @@ -349,6 +383,7 @@ args.add("value", writeBarrierPost.getValue()); args.add("location", writeBarrierPost.getLocation()); args.addConst("usePrecise", writeBarrierPost.usePrecise()); + args.addConst("alwaysNull", writeBarrierPost.getValue().objectStamp().alwaysNull()); args.addConst("trace", traceBarrier()); template(args).instantiate(runtime, writeBarrierPost, DEFAULT_REPLACER, args); } @@ -394,4 +429,23 @@ private static boolean traceBarrier() { return GraalOptions.GCDebugStartCycle.getValue() > 0 && ((int) Word.unsigned(HotSpotReplacementsUtil.gcTotalCollectionsAddress()).readLong(0) > GraalOptions.GCDebugStartCycle.getValue()); } + + /** + * Validation helper method which performs sanity checks on write operations. The addresses of + * both the object and the value being written are checked in order to determine if they reside + * in a valid heap region. If an object is stale, an invalid access is performed in order to + * prematurely crash the VM and debug the stack trace of the faulty method. + */ + private static void validateObject(Object parent, Object child) { + if (verifyOops() && child != null && !validateOop(VALIDATEOBJECT, parent, child)) { + log(true, "Verification ERROR, Parent: %p Child: %p\n", Word.fromObject(parent).rawValue(), Word.fromObject(child).rawValue()); + DirectObjectStoreNode.storeWord(null, 0, 0, Word.zero()); + } + } + + public static final ForeignCallDescriptor VALIDATEOBJECT = new ForeignCallDescriptor("validate_object", boolean.class, Word.class, Word.class); + + @NodeIntrinsic(ForeignCallNode.class) + private static native boolean validateOop(@ConstantNodeParameter ForeignCallDescriptor descriptor, Object parent, Object object); + } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopFullUnrollPhase.java --- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopFullUnrollPhase.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopFullUnrollPhase.java Sun Aug 04 11:29:03 2013 -0700 @@ -28,7 +28,7 @@ import com.oracle.graal.phases.*; import com.oracle.graal.phases.tiers.*; -public class LoopFullUnrollPhase extends BasePhase { +public class LoopFullUnrollPhase extends BasePhase { private static final DebugMetric FULLY_UNROLLED_LOOPS = Debug.metric("FullUnrolls"); private final boolean canonicalizeReads; @@ -38,7 +38,7 @@ } @Override - protected void run(StructuredGraph graph, HighTierContext context) { + protected void run(StructuredGraph graph, PhaseContext context) { if (graph.hasLoops()) { boolean peeled; do { diff -r d0c9278fe471 -r ebaef68b38f9 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 Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java Sun Aug 04 11:29:03 2013 -0700 @@ -84,16 +84,18 @@ public void simplify(SimplifierTool tool) { if (condition instanceof LogicConstantNode) { LogicConstantNode c = (LogicConstantNode) condition; - if (c.getValue() != negated) { - this.replaceAtUsages(BeginNode.prevBegin(this)); - graph().removeFixed(this); - } else { - FixedWithNextNode predecessor = (FixedWithNextNode) predecessor(); + if (c.getValue() == negated) { + FixedNode next = this.next(); + if (next != null) { + tool.deleteBranch(next); + } + DeoptimizeNode deopt = graph().add(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, reason)); deopt.setDeoptimizationState(getDeoptimizationState()); - tool.deleteBranch(this); - predecessor.setNext(deopt); + setNext(deopt); } + this.replaceAtUsages(BeginNode.prevBegin(this)); + graph().removeFixed(this); } } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/G1ReferentFieldReadBarrier.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/G1ReferentFieldReadBarrier.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/G1ReferentFieldReadBarrier.java Sun Aug 04 11:29:03 2013 -0700 @@ -22,7 +22,6 @@ */ package com.oracle.graal.nodes; -import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.extended.*; /** @@ -31,14 +30,11 @@ * {@code UnsafeLoadNode}). The return value of the read is passed to the snippet implementing the * read barrier and consequently is added to the SATB queue if the concurrent marker is enabled. */ -public class G1ReferentFieldReadBarrier extends WriteBarrier implements DeoptimizingNode { +public class G1ReferentFieldReadBarrier extends WriteBarrier { @Input private ValueNode expectedObject; private final boolean doLoad; - @Input private FrameState deoptimizationState; - private final boolean nullCheck; - public ValueNode getExpectedObject() { return expectedObject; } @@ -47,35 +43,9 @@ return doLoad; } - public boolean getNullCheck() { - return nullCheck; - } - - public G1ReferentFieldReadBarrier(ValueNode object, ValueNode expectedObject, LocationNode location, boolean doLoad, boolean nullCheck) { + public G1ReferentFieldReadBarrier(ValueNode object, ValueNode expectedObject, LocationNode location, boolean doLoad) { super(object, location, true); this.doLoad = doLoad; - this.nullCheck = nullCheck; this.expectedObject = expectedObject; } - - @Override - public boolean canDeoptimize() { - return nullCheck; - } - - @Override - public FrameState getDeoptimizationState() { - return deoptimizationState; - } - - @Override - public void setDeoptimizationState(FrameState state) { - updateUsages(deoptimizationState, state); - deoptimizationState = state; - } - - @Override - public DeoptimizationReason getDeoptimizationReason() { - return DeoptimizationReason.NullCheckException; - } } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SerialWriteBarrier.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SerialWriteBarrier.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/SerialWriteBarrier.java Sun Aug 04 11:29:03 2013 -0700 @@ -26,7 +26,14 @@ public class SerialWriteBarrier extends WriteBarrier { - public SerialWriteBarrier(ValueNode object, LocationNode location, boolean precise) { + @Input private ValueNode value; + + public ValueNode getValue() { + return value; + } + + public SerialWriteBarrier(ValueNode object, ValueNode value, LocationNode location, boolean precise) { super(object, location, precise); + this.value = value; } } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java Sun Aug 04 11:29:03 2013 -0700 @@ -118,13 +118,6 @@ return this; } - public static void cleanFromGraph(StructuredGraph graph) { - for (TypeProfileProxyNode proxy : graph.getNodes(TypeProfileProxyNode.class)) { - graph.replaceFloating(proxy, proxy.getObject()); - } - assert graph.getNodes(TypeProfileProxyNode.class).count() == 0; - } - @Override public ValueNode getOriginalValue() { return object; diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/AbstractInliningPhase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/AbstractInliningPhase.java Sun Aug 04 11:29:03 2013 -0700 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 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.phases.common; + +import com.oracle.graal.phases.*; +import com.oracle.graal.phases.tiers.*; + +/** + * Common superclass for phases that perform inlining. + */ +public abstract class AbstractInliningPhase extends BasePhase { +} diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CleanTypeProfileProxyPhase.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CleanTypeProfileProxyPhase.java Sun Aug 04 11:29:03 2013 -0700 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 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.phases.common; + +import com.oracle.graal.nodes.*; +import com.oracle.graal.phases.*; + +public class CleanTypeProfileProxyPhase extends Phase { + + @Override + protected void run(StructuredGraph graph) { + for (TypeProfileProxyNode proxy : graph.getNodes(TypeProfileProxyNode.class)) { + graph.replaceFloating(proxy, proxy.getObject()); + } + assert graph.getNodes(TypeProfileProxyNode.class).count() == 0; + } +} diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java Sun Aug 04 11:29:03 2013 -0700 @@ -38,17 +38,17 @@ import com.oracle.graal.nodes.type.*; import com.oracle.graal.nodes.util.*; import com.oracle.graal.options.*; -import com.oracle.graal.phases.*; import com.oracle.graal.phases.PhasePlan.PhasePosition; import com.oracle.graal.phases.common.CanonicalizerPhase.CustomCanonicalizer; import com.oracle.graal.phases.common.InliningUtil.InlineInfo; import com.oracle.graal.phases.common.InliningUtil.Inlineable; +import com.oracle.graal.phases.common.InliningUtil.InlineableGraph; import com.oracle.graal.phases.common.InliningUtil.InlineableMacroNode; -import com.oracle.graal.phases.common.InliningUtil.InlineableGraph; import com.oracle.graal.phases.common.InliningUtil.InliningPolicy; import com.oracle.graal.phases.graph.*; +import com.oracle.graal.phases.tiers.*; -public class InliningPhase extends Phase { +public class InliningPhase extends AbstractInliningPhase { static class Options { @@ -58,15 +58,9 @@ // @formatter:on } - private final PhasePlan plan; - private final MetaAccessProvider runtime; - private final Assumptions compilationAssumptions; - private final Replacements replacements; - private final GraphCache cache; private final InliningPolicy inliningPolicy; - private final OptimisticOptimizations optimisticOpts; + private final CustomCanonicalizer customCanonicalizer; - private CustomCanonicalizer customCanonicalizer; private int inliningCount; private int maxMethodPerInlining = Integer.MAX_VALUE; @@ -76,33 +70,24 @@ private static final DebugMetric metricInliningStoppedByMaxDesiredSize = Debug.metric("InliningStoppedByMaxDesiredSize"); private static final DebugMetric metricInliningRuns = Debug.metric("Runs"); - public InliningPhase(MetaAccessProvider runtime, Map hints, Replacements replacements, Assumptions assumptions, GraphCache cache, PhasePlan plan, - OptimisticOptimizations optimisticOpts) { - this(runtime, replacements, assumptions, cache, plan, optimisticOpts, hints); + public InliningPhase() { + this(new GreedyInliningPolicy(null), null); + } + + public InliningPhase(CustomCanonicalizer canonicalizer) { + this(new GreedyInliningPolicy(null), canonicalizer); } - private InliningPhase(MetaAccessProvider runtime, Replacements replacements, Assumptions assumptions, GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts, - Map hints) { - this.runtime = runtime; - this.replacements = replacements; - this.compilationAssumptions = assumptions; - this.cache = cache; - this.plan = plan; - this.inliningPolicy = new GreedyInliningPolicy(replacements, hints); - this.optimisticOpts = optimisticOpts; + public InliningPhase(Map hints) { + this(new GreedyInliningPolicy(hints), null); } - public InliningPhase(MetaAccessProvider runtime, Replacements replacements, Assumptions assumptions, GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts, InliningPolicy policy) { - this.runtime = runtime; - this.replacements = replacements; - this.compilationAssumptions = assumptions; - this.cache = cache; - this.plan = plan; - this.inliningPolicy = policy; - this.optimisticOpts = optimisticOpts; + public InliningPhase(InliningPolicy policy) { + this(policy, null); } - public void setCustomCanonicalizer(CustomCanonicalizer customCanonicalizer) { + private InliningPhase(InliningPolicy policy, CustomCanonicalizer customCanonicalizer) { + this.inliningPolicy = policy; this.customCanonicalizer = customCanonicalizer; } @@ -123,19 +108,21 @@ } @Override - protected void run(final StructuredGraph graph) { - final InliningData data = new InliningData(graph, compilationAssumptions); + protected void run(final StructuredGraph graph, final HighTierContext context) { + final InliningData data = new InliningData(graph, context.getAssumptions()); while (data.hasUnprocessedGraphs()) { final MethodInvocation currentInvocation = data.currentInvocation(); GraphInfo graphInfo = data.currentGraph(); - if (!currentInvocation.isRoot() && !inliningPolicy.isWorthInlining(currentInvocation.callee(), data.inliningDepth(), currentInvocation.probability(), currentInvocation.relevance(), false)) { + if (!currentInvocation.isRoot() && + !inliningPolicy.isWorthInlining(context.getReplacements(), currentInvocation.callee(), data.inliningDepth(), currentInvocation.probability(), + currentInvocation.relevance(), false)) { int remainingGraphs = currentInvocation.totalGraphs() - currentInvocation.processedGraphs(); assert remainingGraphs > 0; data.popGraphs(remainingGraphs); data.popInvocation(); } else if (graphInfo.hasRemainingInvokes() && inliningPolicy.continueInlining(graphInfo.graph())) { - processNextInvoke(data, graphInfo); + processNextInvoke(data, graphInfo, context); } else { data.popGraph(); if (!currentInvocation.isRoot()) { @@ -148,7 +135,7 @@ @Override public void run() { - tryToInline(data.currentGraph(), currentInvocation, parentInvoke, data.inliningDepth() + 1); + tryToInline(data.currentGraph(), currentInvocation, parentInvoke, data.inliningDepth() + 1, context); } }); @@ -164,11 +151,11 @@ /** * Process the next invoke and enqueue all its graphs for processing. */ - private void processNextInvoke(InliningData data, GraphInfo graphInfo) { + private void processNextInvoke(InliningData data, GraphInfo graphInfo, HighTierContext context) { Invoke invoke = graphInfo.popInvoke(); MethodInvocation callerInvocation = data.currentInvocation(); Assumptions parentAssumptions = callerInvocation.assumptions(); - InlineInfo info = InliningUtil.getInlineInfo(data, invoke, maxMethodPerInlining, replacements, parentAssumptions, optimisticOpts); + InlineInfo info = InliningUtil.getInlineInfo(data, invoke, maxMethodPerInlining, context.getReplacements(), parentAssumptions, context.getOptimisticOptimizations()); if (info != null) { double invokeProbability = graphInfo.invokeProbability(invoke); @@ -176,7 +163,7 @@ MethodInvocation calleeInvocation = data.pushInvocation(info, parentAssumptions, invokeProbability, invokeRelevance); for (int i = 0; i < info.numberOfMethods(); i++) { - Inlineable elem = getInlineableElement(info.methodAt(i), info.invoke(), calleeInvocation.assumptions()); + Inlineable elem = getInlineableElement(info.methodAt(i), info.invoke(), calleeInvocation.assumptions(), context); info.setInlinableElement(i, elem); if (elem instanceof InlineableGraph) { data.pushGraph(((InlineableGraph) elem).getGraph(), invokeProbability * info.probabilityAt(i), invokeRelevance * info.relevanceAt(i)); @@ -188,32 +175,32 @@ } } - private void tryToInline(GraphInfo callerGraphInfo, MethodInvocation calleeInfo, MethodInvocation parentInvocation, int inliningDepth) { + private void tryToInline(GraphInfo callerGraphInfo, MethodInvocation calleeInfo, MethodInvocation parentInvocation, int inliningDepth, HighTierContext context) { InlineInfo callee = calleeInfo.callee(); Assumptions callerAssumptions = parentInvocation.assumptions(); - if (inliningPolicy.isWorthInlining(callee, inliningDepth, calleeInfo.probability(), calleeInfo.relevance(), true)) { - doInline(callerGraphInfo, calleeInfo, callerAssumptions); - } else if (optimisticOpts.devirtualizeInvokes()) { - callee.tryToDevirtualizeInvoke(runtime, callerAssumptions); + if (inliningPolicy.isWorthInlining(context.getReplacements(), callee, inliningDepth, calleeInfo.probability(), calleeInfo.relevance(), true)) { + doInline(callerGraphInfo, calleeInfo, callerAssumptions, context); + } else if (context.getOptimisticOptimizations().devirtualizeInvokes()) { + callee.tryToDevirtualizeInvoke(context.getRuntime(), callerAssumptions); } metricInliningConsidered.increment(); } - private void doInline(GraphInfo callerGraphInfo, MethodInvocation calleeInfo, Assumptions callerAssumptions) { + private void doInline(GraphInfo callerGraphInfo, MethodInvocation calleeInfo, Assumptions callerAssumptions, HighTierContext context) { StructuredGraph callerGraph = callerGraphInfo.graph(); int markBeforeInlining = callerGraph.getMark(); InlineInfo callee = calleeInfo.callee(); try { List invokeUsages = callee.invoke().asNode().usages().snapshot(); - callee.inline(runtime, callerAssumptions, replacements); + callee.inline(context.getRuntime(), callerAssumptions, context.getReplacements()); callerAssumptions.record(calleeInfo.assumptions()); metricInliningRuns.increment(); Debug.dump(callerGraph, "after %s", callee); if (OptCanonicalizer.getValue()) { int markBeforeCanonicalization = callerGraph.getMark(); - new CanonicalizerPhase.Instance(runtime, callerAssumptions, !AOTCompilation.getValue(), invokeUsages, markBeforeInlining, customCanonicalizer).apply(callerGraph); + new CanonicalizerPhase.Instance(context.getRuntime(), callerAssumptions, !AOTCompilation.getValue(), invokeUsages, markBeforeInlining, customCanonicalizer).apply(callerGraph); // process invokes that are possibly created during canonicalization for (Node newNode : callerGraph.getNewNodes(markBeforeCanonicalization)) { @@ -236,27 +223,27 @@ } } - private Inlineable getInlineableElement(final ResolvedJavaMethod method, Invoke invoke, Assumptions assumptions) { - Class macroNodeClass = InliningUtil.getMacroNodeClass(replacements, method); + private static Inlineable getInlineableElement(final ResolvedJavaMethod method, Invoke invoke, Assumptions assumptions, HighTierContext context) { + Class macroNodeClass = InliningUtil.getMacroNodeClass(context.getReplacements(), method); if (macroNodeClass != null) { return new InlineableMacroNode(macroNodeClass); } else { - return new InlineableGraph(buildGraph(method, invoke, assumptions)); + return new InlineableGraph(buildGraph(method, invoke, assumptions, context)); } } - private StructuredGraph buildGraph(final ResolvedJavaMethod method, final Invoke invoke, final Assumptions assumptions) { + private static StructuredGraph buildGraph(final ResolvedJavaMethod method, final Invoke invoke, final Assumptions assumptions, final HighTierContext context) { final StructuredGraph newGraph; final boolean parseBytecodes; // TODO (chaeubl): copying the graph is only necessary if it is modified or if it contains // any invokes - StructuredGraph intrinsicGraph = InliningUtil.getIntrinsicGraph(replacements, method); + StructuredGraph intrinsicGraph = InliningUtil.getIntrinsicGraph(context.getReplacements(), method); if (intrinsicGraph != null) { newGraph = intrinsicGraph.copy(); parseBytecodes = false; } else { - StructuredGraph cachedGraph = getCachedGraph(method); + StructuredGraph cachedGraph = getCachedGraph(method, context); if (cachedGraph != null) { newGraph = cachedGraph.copy(); parseBytecodes = false; @@ -271,7 +258,7 @@ @Override public StructuredGraph call() throws Exception { if (parseBytecodes) { - parseBytecodes(newGraph, assumptions); + parseBytecodes(newGraph, assumptions, context); } boolean callerHasMoreInformationAboutArguments = false; @@ -280,7 +267,7 @@ ValueNode arg = args.get(localNode.index()); if (arg.isConstant()) { Constant constant = arg.asConstant(); - newGraph.replaceFloating(localNode, ConstantNode.forConstant(constant, runtime, newGraph)); + newGraph.replaceFloating(localNode, ConstantNode.forConstant(constant, context.getRuntime(), newGraph)); callerHasMoreInformationAboutArguments = true; } else { Stamp joinedStamp = localNode.stamp().join(arg.stamp()); @@ -298,7 +285,7 @@ } if (OptCanonicalizer.getValue()) { - new CanonicalizerPhase.Instance(runtime, assumptions, !AOTCompilation.getValue()).apply(newGraph); + new CanonicalizerPhase.Instance(context.getRuntime(), assumptions, !AOTCompilation.getValue()).apply(newGraph); } return newGraph; @@ -306,9 +293,9 @@ }); } - private StructuredGraph getCachedGraph(ResolvedJavaMethod method) { - if (CacheGraphs.getValue() && cache != null) { - StructuredGraph cachedGraph = cache.get(method); + private static StructuredGraph getCachedGraph(ResolvedJavaMethod method, HighTierContext context) { + if (CacheGraphs.getValue() && context.getGraphCache() != null) { + StructuredGraph cachedGraph = context.getGraphCache().get(method); if (cachedGraph != null) { return cachedGraph; } @@ -316,22 +303,22 @@ return null; } - private StructuredGraph parseBytecodes(StructuredGraph newGraph, Assumptions assumptions) { + private static StructuredGraph parseBytecodes(StructuredGraph newGraph, Assumptions assumptions, HighTierContext context) { boolean hasMatureProfilingInfo = newGraph.method().getProfilingInfo().isMature(); - if (plan != null) { - plan.runPhases(PhasePosition.AFTER_PARSING, newGraph); + if (context.getPhasePlan() != null) { + context.getPhasePlan().runPhases(PhasePosition.AFTER_PARSING, newGraph); } assert newGraph.start().next() != null : "graph needs to be populated during PhasePosition.AFTER_PARSING"; new DeadCodeEliminationPhase().apply(newGraph); if (OptCanonicalizer.getValue()) { - new CanonicalizerPhase.Instance(runtime, assumptions, !AOTCompilation.getValue()).apply(newGraph); + new CanonicalizerPhase.Instance(context.getRuntime(), assumptions, !AOTCompilation.getValue()).apply(newGraph); } - if (CacheGraphs.getValue() && cache != null) { - cache.put(newGraph.copy(), hasMatureProfilingInfo); + if (CacheGraphs.getValue() && context.getGraphCache() != null) { + context.getGraphCache().put(newGraph.copy(), hasMatureProfilingInfo); } return newGraph; } @@ -347,11 +334,9 @@ private abstract static class AbstractInliningPolicy implements InliningPolicy { - protected final Replacements replacements; protected final Map hints; - public AbstractInliningPolicy(Replacements replacements, Map hints) { - this.replacements = replacements; + public AbstractInliningPolicy(Map hints) { this.hints = hints; } @@ -367,15 +352,15 @@ return 1; } - protected boolean isIntrinsic(InlineInfo info) { + protected boolean isIntrinsic(Replacements replacements, InlineInfo info) { if (AlwaysInlineIntrinsics.getValue()) { - return onlyIntrinsics(info); + return onlyIntrinsics(replacements, info); } else { - return onlyForcedIntrinsics(info); + return onlyForcedIntrinsics(replacements, info); } } - private boolean onlyIntrinsics(InlineInfo info) { + private static boolean onlyIntrinsics(Replacements replacements, InlineInfo info) { for (int i = 0; i < info.numberOfMethods(); i++) { if (!InliningUtil.canIntrinsify(replacements, info.methodAt(i))) { return false; @@ -384,7 +369,7 @@ return true; } - private boolean onlyForcedIntrinsics(InlineInfo info) { + private static boolean onlyForcedIntrinsics(Replacements replacements, InlineInfo info) { for (int i = 0; i < info.numberOfMethods(); i++) { if (!InliningUtil.canIntrinsify(replacements, info.methodAt(i))) { return false; @@ -433,8 +418,8 @@ private static final class GreedyInliningPolicy extends AbstractInliningPolicy { - public GreedyInliningPolicy(Replacements replacements, Map hints) { - super(replacements, hints); + public GreedyInliningPolicy(Map hints) { + super(hints); } public boolean continueInlining(StructuredGraph currentGraph) { @@ -447,12 +432,12 @@ } @Override - public boolean isWorthInlining(InlineInfo info, int inliningDepth, double probability, double relevance, boolean fullyProcessed) { + public boolean isWorthInlining(Replacements replacements, InlineInfo info, int inliningDepth, double probability, double relevance, boolean fullyProcessed) { if (InlineEverything.getValue()) { return InliningUtil.logInlinedMethod(info, inliningDepth, fullyProcessed, "inline everything"); } - if (isIntrinsic(info)) { + if (isIntrinsic(replacements, info)) { return InliningUtil.logInlinedMethod(info, inliningDepth, fullyProcessed, "intrinsic"); } @@ -501,7 +486,7 @@ return true; } - public boolean isWorthInlining(InlineInfo info, int inliningDepth, double probability, double relevance, boolean fullyProcessed) { + public boolean isWorthInlining(Replacements replacements, InlineInfo info, int inliningDepth, double probability, double relevance, boolean fullyProcessed) { return true; } } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Sun Aug 04 11:29:03 2013 -0700 @@ -66,7 +66,7 @@ boolean continueInlining(StructuredGraph graph); - boolean isWorthInlining(InlineInfo info, int inliningDepth, double probability, double relevance, boolean fullyProcessed); + boolean isWorthInlining(Replacements replacements, InlineInfo info, int inliningDepth, double probability, double relevance, boolean fullyProcessed); } public interface Inlineable { @@ -708,7 +708,7 @@ if (opportunities > 0) { metricInliningTailDuplication.increment(); Debug.log("MultiTypeGuardInlineInfo starting tail duplication (%d opportunities)", opportunities); - TailDuplicationPhase.tailDuplicate(returnMerge, TailDuplicationPhase.TRUE_DECISION, replacementNodes, new HighTierContext(runtime, assumptions, replacements)); + TailDuplicationPhase.tailDuplicate(returnMerge, TailDuplicationPhase.TRUE_DECISION, replacementNodes, new PhaseContext(runtime, assumptions, replacements)); } } } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhasePlan.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhasePlan.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhasePlan.java Sun Aug 04 11:29:03 2013 -0700 @@ -49,13 +49,11 @@ * A compiler extension phase can chose to run at the end of periods 1-3. */ public static enum PhasePosition { - AFTER_PARSING, - HIGH_LEVEL + AFTER_PARSING } // @formatter:on @SuppressWarnings("unchecked") private final ArrayList[] phases = new ArrayList[PhasePosition.values().length]; - private final Set> disabledPhases = new HashSet<>(); public void addPhase(PhasePosition pos, Phase phase) { if (phases[pos.ordinal()] == null) { @@ -71,12 +69,4 @@ } } } - - public void disablePhase(Class clazz) { - disabledPhases.add(clazz); - } - - public boolean isPhaseDisabled(Class clazz) { - return disabledPhases.contains(clazz); - } } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/VerifyPhase.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/VerifyPhase.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/VerifyPhase.java Sun Aug 04 11:29:03 2013 -0700 @@ -26,16 +26,16 @@ /*** * This phase serves as a verification, in order to check the graph for certain properties. The - * {@link #verify(StructuredGraph)} method will be used as an assertion, and implements the actual - * check. Instead of returning false, it is also valid to throw an {@link AssertionError} in the - * implemented {@link #verify(StructuredGraph)} method. + * {@link #verify(StructuredGraph, Object)} method will be used as an assertion, and implements the + * actual check. Instead of returning false, it is also valid to throw an {@link AssertionError} in + * the implemented {@link #verify(StructuredGraph, Object)} method. */ -public abstract class VerifyPhase extends Phase { +public abstract class VerifyPhase extends BasePhase { @Override - protected final void run(StructuredGraph graph) { - assert verify(graph); + protected final void run(StructuredGraph graph, C context) { + assert verify(graph, context); } - protected abstract boolean verify(StructuredGraph graph); + protected abstract boolean verify(StructuredGraph graph, C context); } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/HighTierContext.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/HighTierContext.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/HighTierContext.java Sun Aug 04 11:29:03 2013 -0700 @@ -25,10 +25,31 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.spi.*; +import com.oracle.graal.phases.*; public class HighTierContext extends PhaseContext { - public HighTierContext(MetaAccessProvider runtime, Assumptions assumptions, Replacements replacements) { + private final PhasePlan plan; + + private final GraphCache cache; + private final OptimisticOptimizations optimisticOpts; + + public HighTierContext(MetaAccessProvider runtime, Assumptions assumptions, Replacements replacements, GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts) { super(runtime, assumptions, replacements); + this.plan = plan; + this.cache = cache; + this.optimisticOpts = optimisticOpts; + } + + public PhasePlan getPhasePlan() { + return plan; + } + + public GraphCache getGraphCache() { + return cache; + } + + public OptimisticOptimizations getOptimisticOptimizations() { + return optimisticOpts; } } diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java Sun Aug 04 11:29:03 2013 -0700 @@ -27,23 +27,22 @@ import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.type.*; import com.oracle.graal.phases.*; +import com.oracle.graal.phases.tiers.*; /** * For certain types object identity should not be used for object equality check. This phase checks * the correct usage of the given type. Equality checks with == or != (except null checks) results * in an {@link AssertionError}. */ -public class VerifyUsageWithEquals extends VerifyPhase { +public class VerifyUsageWithEquals extends VerifyPhase { - private MetaAccessProvider runtime; - private Class klass; + private final Class klass; - public VerifyUsageWithEquals(MetaAccessProvider runtime, Class klass) { - this.runtime = runtime; + public VerifyUsageWithEquals(Class klass) { this.klass = klass; } - private boolean isAssignableType(ValueNode node) { + private boolean isAssignableType(ValueNode node, MetaAccessProvider runtime) { if (node.stamp() instanceof ObjectStamp) { ResolvedJavaType valueType = runtime.lookupJavaType(klass); ResolvedJavaType nodeType = node.objectStamp().type(); @@ -59,8 +58,8 @@ return node.isConstant() && node.asConstant().isNull(); } - private boolean checkUsage(ValueNode x, ValueNode y) { - return isAssignableType(x) && !isNullConstant(y); + private boolean checkUsage(ValueNode x, ValueNode y, MetaAccessProvider runtime) { + return isAssignableType(x, runtime) && !isNullConstant(y); } private static boolean isEqualsMethod(StructuredGraph graph) { @@ -69,12 +68,12 @@ } @Override - protected boolean verify(StructuredGraph graph) { + protected boolean verify(StructuredGraph graph, PhaseContext context) { for (ObjectEqualsNode cn : graph.getNodes().filter(ObjectEqualsNode.class)) { if (!isEqualsMethod(graph)) { // bail out if we compare an object of type klass with == or != (except null checks) - assert !(checkUsage(cn.x(), cn.y()) && checkUsage(cn.y(), cn.x())) : "Verifcation of " + klass.getName() + " usage failed: Comparing " + cn.x() + " and" + cn.y() + " in " + - graph.method() + " must use .equals() for object equality, not '==' or '!='"; + assert !(checkUsage(cn.x(), cn.y(), context.getRuntime()) && checkUsage(cn.y(), cn.x(), context.getRuntime())) : "Verifcation of " + klass.getName() + " usage failed: Comparing " + + cn.x() + " and" + cn.y() + " in " + graph.method() + " must use .equals() for object equality, not '==' or '!='"; } } return true; diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CompiledExceptionHandlerTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CompiledExceptionHandlerTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/CompiledExceptionHandlerTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -26,11 +26,9 @@ import org.junit.*; -import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.test.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.java.*; -import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; /** @@ -38,9 +36,8 @@ */ public class CompiledExceptionHandlerTest extends GraalCompilerTest { - @Override - protected void editPhasePlan(ResolvedJavaMethod method, StructuredGraph graph, PhasePlan phasePlan) { - phasePlan.disablePhase(InliningPhase.class); + public CompiledExceptionHandlerTest() { + suites.getHighTier().findPhase(AbstractInliningPhase.class).remove(); } @Override diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/DeoptimizeOnExceptionTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/DeoptimizeOnExceptionTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/DeoptimizeOnExceptionTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -24,10 +24,7 @@ import org.junit.*; -import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.test.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; /** @@ -35,9 +32,8 @@ */ public class DeoptimizeOnExceptionTest extends GraalCompilerTest { - @Override - protected void editPhasePlan(ResolvedJavaMethod method, StructuredGraph graph, PhasePlan phasePlan) { - phasePlan.disablePhase(InliningPhase.class); + public DeoptimizeOnExceptionTest() { + suites.getHighTier().findPhase(AbstractInliningPhase.class).remove(); } private static void raiseException(String m1, String m2, String m3, String m4, String m5) { diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InstanceOfTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InstanceOfTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InstanceOfTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -30,7 +30,6 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.java.*; -import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.replacements.test.CheckCastTest.Depth12; import com.oracle.graal.replacements.test.CheckCastTest.Depth13; @@ -42,9 +41,8 @@ */ public class InstanceOfTest extends TypeCheckTest { - @Override - protected void editPhasePlan(ResolvedJavaMethod method, StructuredGraph graph, PhasePlan phasePlan) { - phasePlan.disablePhase(InliningPhase.class); + public InstanceOfTest() { + suites.getHighTier().findPhase(AbstractInliningPhase.class).remove(); } @Override diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InvokeTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InvokeTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/InvokeTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -24,10 +24,7 @@ import org.junit.*; -import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.test.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; /** @@ -35,9 +32,8 @@ */ public class InvokeTest extends GraalCompilerTest { - @Override - protected void editPhasePlan(ResolvedJavaMethod method, StructuredGraph graph, PhasePlan phasePlan) { - phasePlan.disablePhase(InliningPhase.class); + public InvokeTest() { + suites.getHighTier().findPhase(AbstractInliningPhase.class).remove(); } public interface I { diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MethodSubstitutionTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MethodSubstitutionTest.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/MethodSubstitutionTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -34,6 +34,7 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; +import com.oracle.graal.phases.tiers.*; /** * Tests if {@link MethodSubstitution}s are inlined correctly. Most test cases only assert that @@ -50,10 +51,11 @@ StructuredGraph graph = parse(snippet); PhasePlan phasePlan = getDefaultPhasePlan(); Assumptions assumptions = new Assumptions(true); + HighTierContext context = new HighTierContext(runtime(), assumptions, replacements, null, phasePlan, OptimisticOptimizations.ALL); Debug.dump(graph, "Graph"); - new InliningPhase(runtime(), null, replacements, assumptions, null, phasePlan, OptimisticOptimizations.ALL).apply(graph); + new InliningPhase().apply(graph, context); Debug.dump(graph, "Graph"); - new CanonicalizerPhase.Instance(runtime(), assumptions, true).apply(graph); + new CanonicalizerPhase(true).apply(graph, context); new DeadCodeEliminationPhase().apply(graph); assertNotInGraph(graph, Invoke.class); diff -r d0c9278fe471 -r ebaef68b38f9 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 Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/PartialEvaluationTest.java Sun Aug 04 11:29:03 2013 -0700 @@ -106,7 +106,7 @@ public StructuredGraph call() { StructuredGraph resultGraph = partialEvaluator.createGraph(compilable, assumptions); CanonicalizerPhase canonicalizer = new CanonicalizerPhase(canonicalizeReads); - HighTierContext context = new HighTierContext(runtime, assumptions, replacements); + PhaseContext context = new PhaseContext(runtime, assumptions, replacements); if (resultGraph.hasLoops()) { boolean unrolled; @@ -186,15 +186,16 @@ canonicalizerPhase.apply(graph); new DeadCodeEliminationPhase().apply(graph); - InliningPhase inliningPhase = new InliningPhase(runtime, null, replacements, assumptions, null, plan, OptimisticOptimizations.NONE); - inliningPhase.apply(graph); + HighTierContext context = new HighTierContext(runtime, assumptions, replacements, null, plan, OptimisticOptimizations.NONE); + InliningPhase inliningPhase = new InliningPhase(); + inliningPhase.apply(graph, context); removeFrameStates(graph); new ConvertDeoptimizeToGuardPhase().apply(graph); canonicalizerPhase.apply(graph); new DeadCodeEliminationPhase().apply(graph); - new LoweringPhase(LoweringType.BEFORE_GUARDS).apply(graph, new PhaseContext(runtime, assumptions, replacements)); + new LoweringPhase(LoweringType.BEFORE_GUARDS).apply(graph, context); canonicalizerPhase.apply(graph); new DeadCodeEliminationPhase().apply(graph); return graph; diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Sun Aug 04 11:29:03 2013 -0700 @@ -160,9 +160,9 @@ canonicalizerPhase.apply(graph); new DeadCodeEliminationPhase().apply(graph); - InliningPhase inliningPhase = new InliningPhase(metaAccessProvider, null, replacements, assumptions, cache, plan, OptimisticOptimizations.NONE); - inliningPhase.setCustomCanonicalizer(customCanonicalizer); - inliningPhase.apply(graph); + HighTierContext context = new HighTierContext(metaAccessProvider, assumptions, replacements, cache, plan, OptimisticOptimizations.NONE); + InliningPhase inliningPhase = new InliningPhase(customCanonicalizer); + inliningPhase.apply(graph, context); // Convert deopt to guards. new ConvertDeoptimizeToGuardPhase().apply(graph); @@ -177,7 +177,7 @@ // EA frame and clean up. new VerifyFrameDoesNotEscapePhase().apply(graph, false); - new PartialEscapePhase(false, new CanonicalizerPhase(!AOTCompilation.getValue())).apply(graph, new HighTierContext(metaAccessProvider, assumptions, replacements)); + new PartialEscapePhase(false, new CanonicalizerPhase(!AOTCompilation.getValue())).apply(graph, new PhaseContext(metaAccessProvider, assumptions, replacements)); new VerifyNoIntrinsicsLeftPhase().apply(graph, false); for (MaterializeFrameNode materializeNode : graph.getNodes(MaterializeFrameNode.class).snapshot()) { materializeNode.replaceAtUsages(materializeNode.getFrame()); diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java Sun Aug 04 11:29:03 2013 -0700 @@ -110,7 +110,7 @@ optimizeGraph(newGraph, tmpAssumptions); - HighTierContext context = new HighTierContext(metaAccessProvider, tmpAssumptions, replacements); + PhaseContext context = new PhaseContext(metaAccessProvider, tmpAssumptions, replacements); PartialEscapePhase partialEscapePhase = new PartialEscapePhase(false, new CanonicalizerPhase(true)); partialEscapePhase.apply(newGraph, context); @@ -155,7 +155,7 @@ CanonicalizerPhase.Instance canonicalizerPhase = new CanonicalizerPhase.Instance(metaAccessProvider, assumptions, !AOTCompilation.getValue(), null, null); EarlyReadEliminationPhase earlyRead = new EarlyReadEliminationPhase(new CanonicalizerPhase(true)); - HighTierContext context = new HighTierContext(metaAccessProvider, assumptions, replacements); + PhaseContext context = new PhaseContext(metaAccessProvider, assumptions, replacements); Integer maxNodes = TruffleCompilerOptions.TruffleOperationCacheMaxNodes.getValue(); contractGraph(newGraph, eliminate, convertDeoptimizeToGuardPhase, canonicalizerPhase, earlyRead, context); @@ -180,7 +180,7 @@ } private static void contractGraph(StructuredGraph newGraph, ConditionalEliminationPhase eliminate, ConvertDeoptimizeToGuardPhase convertDeoptimizeToGuardPhase, - CanonicalizerPhase.Instance canonicalizerPhase, EarlyReadEliminationPhase earlyRead, HighTierContext context) { + CanonicalizerPhase.Instance canonicalizerPhase, EarlyReadEliminationPhase earlyRead, PhaseContext context) { // Canonicalize / constant propagate. canonicalizerPhase.apply(newGraph); diff -r d0c9278fe471 -r ebaef68b38f9 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/IterativeInliningPhase.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/IterativeInliningPhase.java Sun Aug 04 11:26:16 2013 -0700 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/IterativeInliningPhase.java Sun Aug 04 11:29:03 2013 -0700 @@ -29,23 +29,14 @@ import com.oracle.graal.debug.*; import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.spi.*; -import com.oracle.graal.phases.*; import com.oracle.graal.phases.common.*; import com.oracle.graal.phases.tiers.*; -public class IterativeInliningPhase extends BasePhase { +public class IterativeInliningPhase extends AbstractInliningPhase { - private final PhasePlan plan; - - private final GraphCache cache; - private final OptimisticOptimizations optimisticOpts; private final CanonicalizerPhase canonicalizer; - public IterativeInliningPhase(GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts, CanonicalizerPhase canonicalizer) { - this.cache = cache; - this.plan = plan; - this.optimisticOpts = optimisticOpts; + public IterativeInliningPhase(CanonicalizerPhase canonicalizer) { this.canonicalizer = canonicalizer; } @@ -75,9 +66,9 @@ Map hints = PEAInliningHints.getValue() ? PartialEscapePhase.getHints(graph) : null; - InliningPhase inlining = new InliningPhase(context.getRuntime(), hints, context.getReplacements(), context.getAssumptions(), cache, plan, optimisticOpts); + InliningPhase inlining = new InliningPhase(hints); inlining.setMaxMethodsPerInlining(simple ? 1 : Integer.MAX_VALUE); - inlining.apply(graph); + inlining.apply(graph, context); progress |= inlining.getInliningCount() > 0; new DeadCodeEliminationPhase().apply(graph); diff -r d0c9278fe471 -r ebaef68b38f9 src/share/vm/code/codeCache.cpp --- a/src/share/vm/code/codeCache.cpp Sun Aug 04 11:26:16 2013 -0700 +++ b/src/share/vm/code/codeCache.cpp Sun Aug 04 11:29:03 2013 -0700 @@ -304,15 +304,6 @@ } } -#ifdef GRAAL -void CodeCache::alive_nmethods_do_graal_methods(OopClosure* closure) { - assert_locked_or_safepoint(CodeCache_lock); - FOR_ALL_ALIVE_NMETHODS(nm) { - nm->mark_graal_reference(closure); - } -} -#endif - int CodeCache::alignment_unit() { return (int)_heap->alignment_unit(); } diff -r d0c9278fe471 -r ebaef68b38f9 src/share/vm/code/codeCache.hpp --- a/src/share/vm/code/codeCache.hpp Sun Aug 04 11:26:16 2013 -0700 +++ b/src/share/vm/code/codeCache.hpp Sun Aug 04 11:29:03 2013 -0700 @@ -85,12 +85,7 @@ static void blobs_do(CodeBlobClosure* f); // iterates over all CodeBlobs static void nmethods_do(void f(nmethod* nm)); // iterates over all nmethods static void alive_nmethods_do(void f(nmethod* nm)); // iterates over all alive nmethods -#ifdef GRAAL - //Special method iterating and marking all HotSpotNMethods which are weakly referenced by nmethods. - //This has to be done since the HotSpotNMethods are only referenced from within the nmethods and the GC - //believes they are dead since they are not marked. - static void alive_nmethods_do_graal_methods(OopClosure* closure); -#endif + // Lookup static CodeBlob* find_blob(void* start); static nmethod* find_nmethod(void* start); diff -r d0c9278fe471 -r ebaef68b38f9 src/share/vm/code/nmethod.cpp --- a/src/share/vm/code/nmethod.cpp Sun Aug 04 11:26:16 2013 -0700 +++ b/src/share/vm/code/nmethod.cpp Sun Aug 04 11:29:03 2013 -0700 @@ -1861,14 +1861,6 @@ #endif } -#ifdef GRAAL -void nmethod::mark_graal_reference(OopClosure* f) { - if (_graal_installed_code != NULL) { - f->do_oop((oop*) &_graal_installed_code); - } -} -#endif - // Iterate over metadata calling this function. Used by RedefineClasses void nmethod::metadata_do(void f(Metadata*)) { address low_boundary = verified_entry_point(); diff -r d0c9278fe471 -r ebaef68b38f9 src/share/vm/code/nmethod.hpp --- a/src/share/vm/code/nmethod.hpp Sun Aug 04 11:26:16 2013 -0700 +++ b/src/share/vm/code/nmethod.hpp Sun Aug 04 11:29:03 2013 -0700 @@ -747,10 +747,6 @@ nm->metadata_do(Metadata::mark_on_stack); } void metadata_do(void f(Metadata*)); - -#ifdef GRAAL - void mark_graal_reference(OopClosure* f); -#endif }; // Locks an nmethod so its code will not get removed and it will not diff -r d0c9278fe471 -r ebaef68b38f9 src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Sun Aug 04 11:26:16 2013 -0700 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Sun Aug 04 11:29:03 2013 -0700 @@ -5127,12 +5127,20 @@ // Walk the code cache w/o buffering, because StarTask cannot handle // unaligned oop locations. - G1FilteredCodeBlobToOopClosure eager_scan_code_roots(this, scan_non_heap_roots); + G1FilteredCodeBlobToOopClosure eager_scan_cs_code_roots(this, scan_non_heap_roots); + + // Scan all code roots from stack + CodeBlobToOopClosure eager_scan_all_code_roots(scan_non_heap_roots, true); + CodeBlobToOopClosure* blobs = &eager_scan_cs_code_roots; + if (UseNewCode && g1_policy()->during_initial_mark_pause()) { + // during initial-mark we need to take care to follow all code roots + blobs = &eager_scan_all_code_roots; + } process_strong_roots(false, // no scoping; this is parallel code is_scavenging, so, &buf_scan_non_heap_roots, - &eager_scan_code_roots, + blobs, scan_klasses ); diff -r d0c9278fe471 -r ebaef68b38f9 src/share/vm/graal/graalCompilerToVM.cpp --- a/src/share/vm/graal/graalCompilerToVM.cpp Sun Aug 04 11:26:16 2013 -0700 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Sun Aug 04 11:29:03 2013 -0700 @@ -859,6 +859,7 @@ set_address("writeBarrierPreAddress", GraalRuntime::write_barrier_pre); set_address("writeBarrierPostAddress", GraalRuntime::write_barrier_post); set_address("gcTotalCollectionsAddress", (jlong)(address)(Universe::heap()->total_collections_address())); + set_address("validateObject", GraalRuntime::validate_object); BarrierSet* bs = Universe::heap()->barrier_set(); switch (bs->kind()) { diff -r d0c9278fe471 -r ebaef68b38f9 src/share/vm/graal/graalRuntime.cpp --- a/src/share/vm/graal/graalRuntime.cpp Sun Aug 04 11:26:16 2013 -0700 +++ b/src/share/vm/graal/graalRuntime.cpp Sun Aug 04 11:29:03 2013 -0700 @@ -372,6 +372,21 @@ thread->dirty_card_queue().enqueue(card_addr); JRT_END +JRT_LEAF(jboolean, GraalRuntime::validate_object(JavaThread* thread,oopDesc* parent, oopDesc* child)) + bool ret = true; + if(!Universe::heap()->is_in_closed_subset(parent)) { + tty->print_cr("Parent Object "INTPTR_FORMAT" not in heap", parent); + parent->print(); + ret=false; + } + if(!Universe::heap()->is_in_closed_subset(child)) { + tty->print_cr("Child Object "INTPTR_FORMAT" not in heap", child); + child->print(); + ret=false; + } + return (jint)ret; +JRT_END + JRT_ENTRY(void, GraalRuntime::vm_error(JavaThread* thread, oop where, oop format, jlong value)) ResourceMark rm; assert(where == NULL || java_lang_String::is_instance(where), "must be"); diff -r d0c9278fe471 -r ebaef68b38f9 src/share/vm/graal/graalRuntime.hpp --- a/src/share/vm/graal/graalRuntime.hpp Sun Aug 04 11:26:16 2013 -0700 +++ b/src/share/vm/graal/graalRuntime.hpp Sun Aug 04 11:29:03 2013 -0700 @@ -55,6 +55,7 @@ static void log_object(JavaThread* thread, oop msg, jint flags); static void write_barrier_pre(JavaThread* thread, oopDesc* obj); static void write_barrier_post(JavaThread* thread, void* card); + static jboolean validate_object(JavaThread* thread, oopDesc* parent, oopDesc* child); }; #endif // SHARE_VM_GRAAL_GRAAL_RUNTIME_HPP diff -r d0c9278fe471 -r ebaef68b38f9 src/share/vm/memory/referenceProcessor.cpp --- a/src/share/vm/memory/referenceProcessor.cpp Sun Aug 04 11:26:16 2013 -0700 +++ b/src/share/vm/memory/referenceProcessor.cpp Sun Aug 04 11:29:03 2013 -0700 @@ -34,10 +34,6 @@ #include "oops/oop.inline.hpp" #include "runtime/java.hpp" #include "runtime/jniHandles.hpp" -#ifdef GRAAL -#include "code/codeCache.hpp" -#include "code/nmethod.hpp" -#endif ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL; ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy = NULL; @@ -267,9 +263,6 @@ task_executor->set_single_threaded_mode(); } process_phaseJNI(is_alive, keep_alive, complete_gc); -#ifdef GRAAL - process_phaseGraalNMethods(keep_alive, complete_gc); -#endif } return ReferenceProcessorStats(soft_count, weak_count, final_count, phantom_count); @@ -312,15 +305,6 @@ complete_gc->do_void(); } -#ifdef GRAAL -void ReferenceProcessor::process_phaseGraalNMethods(OopClosure* keep_alive, - VoidClosure* complete_gc) { - CodeCache::alive_nmethods_do_graal_methods(keep_alive); - complete_gc->do_void(); -} - -#endif - template bool enqueue_discovered_ref_helper(ReferenceProcessor* ref, AbstractRefProcTaskExecutor* task_executor) { diff -r d0c9278fe471 -r ebaef68b38f9 src/share/vm/memory/referenceProcessor.hpp --- a/src/share/vm/memory/referenceProcessor.hpp Sun Aug 04 11:26:16 2013 -0700 +++ b/src/share/vm/memory/referenceProcessor.hpp Sun Aug 04 11:29:03 2013 -0700 @@ -301,10 +301,6 @@ void process_phaseJNI(BoolObjectClosure* is_alive, OopClosure* keep_alive, VoidClosure* complete_gc); -#ifdef GRAAL - void process_phaseGraalNMethods(OopClosure* keep_alive, - VoidClosure* complete_gc); -#endif // Work methods used by the method process_discovered_reflist // Phase1: keep alive all those referents that are otherwise