Mercurial > hg > graal-compiler
changeset 23304:996bbeada100
made use of profiling consistent per compilation (GRAAL-1395)
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FinalizableSubclassTest.java Wed Jan 13 22:48:03 2016 +0100 @@ -22,6 +22,8 @@ */ package com.oracle.graal.compiler.test; +import static com.oracle.graal.nodes.StructuredGraph.NO_PROFILING_INFO; + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; @@ -70,7 +72,7 @@ Constructor<?>[] constructors = cl.getConstructors(); Assert.assertTrue(constructors.length == 1); final ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(constructors[0]); - StructuredGraph graph = new StructuredGraph(javaMethod, allowAssumptions); + StructuredGraph graph = new StructuredGraph(javaMethod, allowAssumptions, NO_PROFILING_INFO); GraphBuilderConfiguration conf = GraphBuilderConfiguration.getSnippetDefault(getDefaultGraphBuilderPlugins()); new GraphBuilderPhase.Instance(getMetaAccess(), getProviders().getStampProvider(), getProviders().getConstantReflection(), conf, OptimisticOptimizations.ALL, null).apply(graph);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Wed Jan 13 22:48:03 2016 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.compiler.test; -import static com.oracle.graal.compiler.GraalCompiler.getProfilingInfo; import static com.oracle.graal.compiler.GraalCompilerOptions.PrintCompilation; import static com.oracle.graal.nodes.ConstantNode.getConstantNodes; import static jdk.vm.ci.code.CodeUtil.getCallingConvention; @@ -95,10 +94,10 @@ import com.oracle.graal.nodes.ValueNode; import com.oracle.graal.nodes.cfg.Block; import com.oracle.graal.nodes.graphbuilderconf.GraphBuilderConfiguration; +import com.oracle.graal.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins; import com.oracle.graal.nodes.graphbuilderconf.GraphBuilderContext; import com.oracle.graal.nodes.graphbuilderconf.InvocationPlugin; import com.oracle.graal.nodes.graphbuilderconf.InvocationPlugins; -import com.oracle.graal.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins; import com.oracle.graal.nodes.spi.LoweringProvider; import com.oracle.graal.nodes.spi.Replacements; import com.oracle.graal.nodes.virtual.VirtualObjectNode; @@ -772,7 +771,7 @@ try (Scope s = Debug.scope("Compile", graphToCompile)) { CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graphToCompile.method(), false); Request<CompilationResult> request = new Request<>(graphToCompile, cc, installedCodeOwner, getProviders(), getBackend(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, - getProfilingInfo(graphToCompile), getSuites(), getLIRSuites(), new CompilationResult(), CompilationResultBuilderFactory.Default); + graphToCompile.getProfilingInfo(), getSuites(), getLIRSuites(), new CompilationResult(), CompilationResultBuilderFactory.Default); return GraalCompiler.compile(request); } catch (Throwable e) { throw Debug.handle(e);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java Wed Jan 13 22:48:03 2016 +0100 @@ -202,7 +202,7 @@ PhaseContext context = new PhaseContext(getProviders()); new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context); new FloatingReadPhase().apply(graph); - MidTierContext midContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.method().getProfilingInfo()); + MidTierContext midContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.getProfilingInfo()); new GuardLoweringPhase().apply(graph, midContext); new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.MID_TIER).apply(graph, midContext); new ValueAnchorCleanupPhase().apply(graph);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ImplicitNullCheckTest.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ImplicitNullCheckTest.java Wed Jan 13 22:48:03 2016 +0100 @@ -73,7 +73,7 @@ PhaseContext context = new PhaseContext(getProviders()); new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context); new FloatingReadPhase().apply(graph); - MidTierContext midTierContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.method().getProfilingInfo()); + MidTierContext midTierContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.getProfilingInfo()); new GuardLoweringPhase().apply(graph, midTierContext); Assert.assertEquals(0, graph.getNodes(DeoptimizeNode.TYPE).count());
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java Wed Jan 13 22:48:03 2016 +0100 @@ -23,7 +23,6 @@ package com.oracle.graal.compiler.test; import static com.oracle.graal.compiler.GraalCompiler.compileGraph; -import static com.oracle.graal.compiler.GraalCompiler.getProfilingInfo; import static com.oracle.graal.compiler.common.GraalOptions.OptAssumptions; import static jdk.vm.ci.code.CodeUtil.getCallingConvention; import static org.junit.Assert.assertNotNull; @@ -67,7 +66,7 @@ final ResolvedJavaMethod method = getResolvedJavaMethod("testMethod"); final StructuredGraph graph = parseEager(method, AllowAssumptions.YES); CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); - final CompilationResult cr = compileGraph(graph, cc, graph.method(), getProviders(), getBackend(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, getProfilingInfo(graph), + final CompilationResult cr = compileGraph(graph, cc, graph.method(), getProviders(), getBackend(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, graph.getProfilingInfo(), getSuites(), getLIRSuites(), new CompilationResult(), CompilationResultBuilderFactory.Default); for (Infopoint sp : cr.getInfopoints()) { assertNotNull(sp.reason); @@ -90,7 +89,7 @@ assertTrue(graphLineSPs > 0); CallingConvention cc = getCallingConvention(getCodeCache(), Type.JavaCallee, graph.method(), false); PhaseSuite<HighTierContext> graphBuilderSuite = getCustomGraphBuilderSuite(GraphBuilderConfiguration.getFullDebugDefault(getDefaultGraphBuilderPlugins())); - final CompilationResult cr = compileGraph(graph, cc, graph.method(), getProviders(), getBackend(), graphBuilderSuite, OptimisticOptimizations.ALL, getProfilingInfo(graph), getSuites(), + final CompilationResult cr = compileGraph(graph, cc, graph.method(), getProviders(), getBackend(), graphBuilderSuite, OptimisticOptimizations.ALL, graph.getProfilingInfo(), getSuites(), getLIRSuites(), new CompilationResult(), CompilationResultBuilderFactory.Default); int lineSPs = 0; for (Infopoint sp : cr.getInfopoints()) {
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java Wed Jan 13 22:48:03 2016 +0100 @@ -741,7 +741,7 @@ new FloatingReadPhase().apply(graph); new RemoveValueProxyPhase().apply(graph); - MidTierContext midContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.method().getProfilingInfo()); + MidTierContext midContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.getProfilingInfo()); new GuardLoweringPhase().apply(graph, midContext); new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.MID_TIER).apply(graph, midContext); new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.LOW_TIER).apply(graph, midContext);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SchedulingTest2.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/SchedulingTest2.java Wed Jan 13 22:48:03 2016 +0100 @@ -99,7 +99,7 @@ PhaseContext context = new PhaseContext(getProviders()); new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context); new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.MID_TIER).apply(graph, context); - MidTierContext midContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.method().getProfilingInfo()); + MidTierContext midContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.getProfilingInfo()); new GuardLoweringPhase().apply(graph, midContext); FrameStateAssignmentPhase phase = new FrameStateAssignmentPhase();
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/BackendTest.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/BackendTest.java Wed Jan 13 22:48:03 2016 +0100 @@ -48,7 +48,7 @@ @SuppressWarnings("try") protected LIRGenerationResult getLIRGenerationResult(final StructuredGraph graph) { try (Scope s = Debug.scope("FrontEnd")) { - GraalCompiler.emitFrontEnd(getProviders(), getBackend(), graph, getDefaultGraphBuilderSuite(), OptimisticOptimizations.NONE, graph.method().getProfilingInfo(), getSuites()); + GraalCompiler.emitFrontEnd(getProviders(), getBackend(), graph, getDefaultGraphBuilderSuite(), OptimisticOptimizations.NONE, graph.getProfilingInfo(), getSuites()); } catch (Throwable e) { throw Debug.handle(e); }
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/InvokeGraal.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/tutorial/InvokeGraal.java Wed Jan 13 22:48:03 2016 +0100 @@ -120,12 +120,12 @@ CallingConvention callingConvention = CodeUtil.getCallingConvention(codeCache, Type.JavaCallee, method, false); /* - * We want Graal to perform all speculative optimisitic optimizations, using the + * We want Graal to perform all speculative optimistic optimizations, using the * profiling information that comes with the method (collected by the interpreter) for * speculation. */ OptimisticOptimizations optimisticOpts = OptimisticOptimizations.ALL; - ProfilingInfo profilingInfo = method.getProfilingInfo(); + ProfilingInfo profilingInfo = graph.getProfilingInfo(method); /* The default class and configuration for compilation results. */ CompilationResult compilationResult = new CompilationResult();
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Wed Jan 13 22:48:03 2016 +0100 @@ -37,12 +37,10 @@ import jdk.vm.ci.code.RegisterConfig; import jdk.vm.ci.code.TargetDescription; import jdk.vm.ci.meta.Assumptions; -import jdk.vm.ci.meta.DefaultProfilingInfo; import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.ProfilingInfo; import jdk.vm.ci.meta.ResolvedJavaMethod; -import jdk.vm.ci.meta.TriState; import jdk.vm.ci.meta.VMConstant; import com.oracle.graal.compiler.LIRGenerationPhase.LIRGenerationContext; @@ -185,14 +183,6 @@ return r.compilationResult; } - public static ProfilingInfo getProfilingInfo(StructuredGraph graph) { - if (graph.method() != null) { - return graph.method().getProfilingInfo(); - } else { - return DefaultProfilingInfo.get(TriState.UNKNOWN); - } - } - /** * Builds the graph, optimizes it. */
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Wed Jan 13 22:48:03 2016 +0100 @@ -23,7 +23,6 @@ package com.oracle.graal.hotspot.test; import static com.oracle.graal.compiler.GraalCompiler.compileGraph; -import static com.oracle.graal.compiler.GraalCompiler.getProfilingInfo; import static com.oracle.graal.compiler.common.GraalOptions.ImmutableCode; import static com.oracle.graal.nodes.ConstantNode.getConstantNodes; import static jdk.vm.ci.code.CodeUtil.getCallingConvention; @@ -221,7 +220,7 @@ SuitesProvider suitesProvider = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getSuites(); final Suites suitesLocal = suitesProvider.getDefaultSuites(); final LIRSuites lirSuitesLocal = suitesProvider.getDefaultLIRSuites(); - final CompilationResult compResult = compileGraph(graph, cc, method, getProviders(), getBackend(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, getProfilingInfo(graph), + final CompilationResult compResult = compileGraph(graph, cc, method, getProviders(), getBackend(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, graph.getProfilingInfo(), suitesLocal, lirSuitesLocal, new CompilationResult(), CompilationResultBuilderFactory.Default); addMethod(method, compResult); return graph;
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotCryptoSubstitutionTest.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotCryptoSubstitutionTest.java Wed Jan 13 22:48:03 2016 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.graal.hotspot.test; +import static com.oracle.graal.nodes.StructuredGraph.NO_PROFILING_INFO; import static com.oracle.graal.nodes.graphbuilderconf.IntrinsicContext.CompilationContext.ROOT_COMPILATION; import static jdk.vm.ci.hotspot.HotSpotVMConfig.config; @@ -130,7 +131,7 @@ StructuredGraph subst = getReplacements().getSubstitution(installedCodeOwner, 0); ResolvedJavaMethod substMethod = subst == null ? null : subst.method(); if (substMethod != null) { - StructuredGraph graph = new StructuredGraph(substMethod, AllowAssumptions.YES); + StructuredGraph graph = new StructuredGraph(substMethod, AllowAssumptions.YES, NO_PROFILING_INFO); Plugins plugins = new Plugins(((HotSpotProviders) getProviders()).getGraphBuilderPlugins()); GraphBuilderConfiguration config = GraphBuilderConfiguration.getSnippetDefault(plugins); IntrinsicContext initialReplacementContext = new IntrinsicContext(installedCodeOwner, substMethod, ROOT_COMPILATION);
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java Wed Jan 13 22:48:03 2016 +0100 @@ -260,7 +260,7 @@ try (Scope s = Debug.scope("WriteBarrierAdditionTest", snippet)) { StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO); HighTierContext highContext = getDefaultHighTierContext(); - MidTierContext midContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.method().getProfilingInfo()); + MidTierContext midContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.getProfilingInfo()); new InliningPhase(new InlineEverythingPolicy(), new CanonicalizerPhase()).apply(graph, highContext); new CanonicalizerPhase().apply(graph, highContext); new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, highContext);
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierVerificationTest.java Wed Jan 13 22:48:03 2016 +0100 @@ -654,7 +654,7 @@ HighTierContext highTierContext = getDefaultHighTierContext(); new InliningPhase(new CanonicalizerPhase()).apply(graph, highTierContext); - MidTierContext midTierContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.method().getProfilingInfo()); + MidTierContext midTierContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.getProfilingInfo()); new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, highTierContext); new GuardLoweringPhase().apply(graph, midTierContext);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalCompiler.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalCompiler.java Wed Jan 13 22:48:03 2016 +0100 @@ -23,6 +23,7 @@ package com.oracle.graal.hotspot; import static com.oracle.graal.compiler.common.GraalOptions.OptAssumptions; +import static com.oracle.graal.nodes.StructuredGraph.NO_PROFILING_INFO; import static com.oracle.graal.nodes.graphbuilderconf.IntrinsicContext.CompilationContext.ROOT_COMPILATION; import static jdk.vm.ci.code.CallingConvention.Type.JavaCallee; import static jdk.vm.ci.code.CodeUtil.getCallingConvention; @@ -120,7 +121,7 @@ if (speculationLog != null) { speculationLog.collectFailedSpeculations(); } - graph = new StructuredGraph(method, entryBCI, AllowAssumptions.from(OptAssumptions.getValue()), speculationLog); + graph = new StructuredGraph(method, entryBCI, AllowAssumptions.from(OptAssumptions.getValue()), speculationLog, useProfilingInfo); } CallingConvention cc = getCallingConvention(providers.getCodeCache(), Type.JavaCallee, graph.method(), false); @@ -143,11 +144,11 @@ CompilationResult result = new CompilationResult(); result.setEntryBCI(entryBCI); boolean shouldDebugNonSafepoints = providers.getCodeCache().shouldDebugNonSafepoints(); - PhaseSuite<HighTierContext> graphBuilderSuite = configGraphBuilderSuite(providers.getSuites().getDefaultGraphBuilderSuite(), shouldDebugNonSafepoints, isOSR, useProfilingInfo); + PhaseSuite<HighTierContext> graphBuilderSuite = configGraphBuilderSuite(providers.getSuites().getDefaultGraphBuilderSuite(), shouldDebugNonSafepoints, isOSR); GraalCompiler.compileGraph(graph, cc, method, providers, backend, graphBuilderSuite, optimisticOpts, profilingInfo, suites, lirSuites, result, CompilationResultBuilderFactory.Default); if (!isOSR && useProfilingInfo) { - ProfilingInfo profile = method.getProfilingInfo(); + ProfilingInfo profile = profilingInfo; profile.setCompilerIRSize(StructuredGraph.class, graph.getNodeCount()); } @@ -166,7 +167,7 @@ ResolvedJavaMethod substMethod = replacements.getSubstitutionMethod(method); if (substMethod != null) { assert !substMethod.equals(method); - StructuredGraph graph = new StructuredGraph(substMethod, AllowAssumptions.YES); + StructuredGraph graph = new StructuredGraph(substMethod, AllowAssumptions.YES, NO_PROFILING_INFO); Plugins plugins = new Plugins(providers.getGraphBuilderPlugins()); GraphBuilderConfiguration config = GraphBuilderConfiguration.getSnippetDefault(plugins); IntrinsicContext initialReplacementContext = new IntrinsicContext(method, substMethod, ROOT_COMPILATION); @@ -197,31 +198,17 @@ * @param shouldDebugNonSafepoints specifies if extra debug info should be generated (default is * false) * @param isOSR specifies if extra OSR-specific post-processing is required (default is false) - * @param useProfilingInfo specifies if the graph builder should use profiling info (default is - * true) * @return a new suite derived from {@code suite} if any of the GBS parameters did not have a * default value otherwise {@code suite} */ - protected PhaseSuite<HighTierContext> configGraphBuilderSuite(PhaseSuite<HighTierContext> suite, boolean shouldDebugNonSafepoints, boolean isOSR, boolean useProfilingInfo) { - if (shouldDebugNonSafepoints || isOSR || !useProfilingInfo) { + protected PhaseSuite<HighTierContext> configGraphBuilderSuite(PhaseSuite<HighTierContext> suite, boolean shouldDebugNonSafepoints, boolean isOSR) { + if (shouldDebugNonSafepoints || isOSR) { PhaseSuite<HighTierContext> newGbs = suite.copy(); - if (shouldDebugNonSafepoints || !useProfilingInfo) { - // This complexity below is to ensure exactly one - // GraphBuilderConfiguration copy is made. + if (shouldDebugNonSafepoints) { GraphBuilderPhase graphBuilderPhase = (GraphBuilderPhase) newGbs.findPhase(GraphBuilderPhase.class).previous(); GraphBuilderConfiguration graphBuilderConfig = graphBuilderPhase.getGraphBuilderConfig(); - if (shouldDebugNonSafepoints) { - graphBuilderConfig = graphBuilderConfig.withDebugInfoMode(DebugInfoMode.Simple); - if (!useProfilingInfo) { - graphBuilderConfig.setUseProfiling(false); - } - } else { - assert !useProfilingInfo; - graphBuilderConfig = graphBuilderConfig.copy(); - graphBuilderConfig.setUseProfiling(false); - } - + graphBuilderConfig = graphBuilderConfig.withDebugInfoMode(DebugInfoMode.Simple); GraphBuilderPhase newGraphBuilderPhase = new GraphBuilderPhase(graphBuilderConfig); newGbs.findPhase(GraphBuilderPhase.class).set(newGraphBuilderPhase); }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/SnippetStub.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/SnippetStub.java Wed Jan 13 22:48:03 2016 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.graal.hotspot.stubs; +import static com.oracle.graal.nodes.StructuredGraph.NO_PROFILING_INFO; import static com.oracle.graal.nodes.graphbuilderconf.IntrinsicContext.CompilationContext.INLINE_AFTER_PARSING; import java.lang.reflect.Method; @@ -104,11 +105,10 @@ Plugins plugins = new Plugins(defaultPlugins); plugins.prependParameterPlugin(new ConstantBindingParameterPlugin(makeConstArgs(), metaAccess, providers.getSnippetReflection())); GraphBuilderConfiguration config = GraphBuilderConfiguration.getSnippetDefault(plugins); - config.setUseProfiling(false); // Stubs cannot have optimistic assumptions since they have // to be valid for the entire run of the VM. - final StructuredGraph graph = new StructuredGraph(method, AllowAssumptions.NO); + final StructuredGraph graph = new StructuredGraph(method, AllowAssumptions.NO, NO_PROFILING_INFO); graph.disableUnsafeAccessTracking(); if (SnippetGraphUnderConstruction != null) {
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java Wed Jan 13 22:48:03 2016 +0100 @@ -607,7 +607,7 @@ this.stampProvider = graphBuilderInstance.stampProvider; this.constantReflection = graphBuilderInstance.constantReflection; this.stream = new BytecodeStream(method.getCode()); - this.profilingInfo = (graphBuilderConfig.getUseProfiling() ? method.getProfilingInfo() : null); + this.profilingInfo = graph.useProfilingInfo() ? method.getProfilingInfo() : null; this.constantPool = method.getConstantPool(); this.method = method; this.intrinsicContext = intrinsicContext;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Wed Jan 13 22:48:03 2016 +0100 @@ -31,9 +31,12 @@ import jdk.vm.ci.meta.Assumptions; import jdk.vm.ci.meta.Assumptions.Assumption; +import jdk.vm.ci.meta.DefaultProfilingInfo; import jdk.vm.ci.meta.JavaMethod; +import jdk.vm.ci.meta.ProfilingInfo; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.SpeculationLog; +import jdk.vm.ci.meta.TriState; import jdk.vm.ci.runtime.JVMCICompiler; import com.oracle.graal.compiler.common.cfg.BlockMap; @@ -151,6 +154,7 @@ private GuardsStage guardsStage = GuardsStage.FLOATING_GUARDS; private boolean isAfterFloatingReadPhase = false; private boolean hasValueProxies = true; + private final boolean useProfilingInfo; /** * The assumptions made while constructing and transforming this graph. @@ -183,31 +187,49 @@ this(null, null, allowAssumptions); } + public static final boolean USE_PROFILING_INFO = true; + + public static final boolean NO_PROFILING_INFO = false; + + private static final SpeculationLog NO_SPECULATION_LOG = null; + /** * Creates a new Graph containing a single {@link AbstractBeginNode} as the {@link #start() * start} node. */ public StructuredGraph(String name, ResolvedJavaMethod method, AllowAssumptions allowAssumptions) { - this(name, method, uniqueGraphIds.incrementAndGet(), JVMCICompiler.INVOCATION_ENTRY_BCI, allowAssumptions, null); + this(name, method, uniqueGraphIds.incrementAndGet(), JVMCICompiler.INVOCATION_ENTRY_BCI, allowAssumptions, NO_SPECULATION_LOG, USE_PROFILING_INFO); } public StructuredGraph(String name, ResolvedJavaMethod method, AllowAssumptions allowAssumptions, SpeculationLog speculationLog) { - this(name, method, uniqueGraphIds.incrementAndGet(), JVMCICompiler.INVOCATION_ENTRY_BCI, allowAssumptions, speculationLog); + this(name, method, uniqueGraphIds.incrementAndGet(), JVMCICompiler.INVOCATION_ENTRY_BCI, allowAssumptions, speculationLog, USE_PROFILING_INFO); + } + + public StructuredGraph(String name, ResolvedJavaMethod method, AllowAssumptions allowAssumptions, SpeculationLog speculationLog, boolean useProfilingInfo) { + this(name, method, uniqueGraphIds.incrementAndGet(), JVMCICompiler.INVOCATION_ENTRY_BCI, allowAssumptions, speculationLog, useProfilingInfo); } public StructuredGraph(ResolvedJavaMethod method, AllowAssumptions allowAssumptions) { - this(null, method, uniqueGraphIds.incrementAndGet(), JVMCICompiler.INVOCATION_ENTRY_BCI, allowAssumptions, null); + this(null, method, uniqueGraphIds.incrementAndGet(), JVMCICompiler.INVOCATION_ENTRY_BCI, allowAssumptions, NO_SPECULATION_LOG, USE_PROFILING_INFO); + } + + public StructuredGraph(ResolvedJavaMethod method, AllowAssumptions allowAssumptions, boolean useProfilingInfo) { + this(null, method, uniqueGraphIds.incrementAndGet(), JVMCICompiler.INVOCATION_ENTRY_BCI, allowAssumptions, NO_SPECULATION_LOG, useProfilingInfo); } public StructuredGraph(ResolvedJavaMethod method, AllowAssumptions allowAssumptions, SpeculationLog speculationLog) { - this(null, method, uniqueGraphIds.incrementAndGet(), JVMCICompiler.INVOCATION_ENTRY_BCI, allowAssumptions, speculationLog); + this(null, method, uniqueGraphIds.incrementAndGet(), JVMCICompiler.INVOCATION_ENTRY_BCI, allowAssumptions, speculationLog, USE_PROFILING_INFO); } public StructuredGraph(ResolvedJavaMethod method, int entryBCI, AllowAssumptions allowAssumptions, SpeculationLog speculationLog) { - this(null, method, uniqueGraphIds.incrementAndGet(), entryBCI, allowAssumptions, speculationLog); + this(null, method, uniqueGraphIds.incrementAndGet(), entryBCI, allowAssumptions, speculationLog, USE_PROFILING_INFO); } - private StructuredGraph(String name, ResolvedJavaMethod method, long graphId, int entryBCI, AllowAssumptions allowAssumptions, SpeculationLog speculationLog) { + public StructuredGraph(ResolvedJavaMethod method, int entryBCI, AllowAssumptions allowAssumptions, SpeculationLog speculationLog, boolean useProfilingInfo) { + this(null, method, uniqueGraphIds.incrementAndGet(), entryBCI, allowAssumptions, speculationLog, useProfilingInfo); + } + + private StructuredGraph(String name, ResolvedJavaMethod method, long graphId, int entryBCI, AllowAssumptions allowAssumptions, SpeculationLog speculationLog, boolean useProfilingInfo) { super(name); this.setStart(add(new StartNode())); this.method = method; @@ -215,6 +237,7 @@ this.entryBCI = entryBCI; this.assumptions = allowAssumptions == AllowAssumptions.YES ? new Assumptions() : null; this.speculationLog = speculationLog; + this.useProfilingInfo = useProfilingInfo; } public void setLastSchedule(ScheduleResult result) { @@ -270,7 +293,7 @@ } /** - * Gets the method from which this graph was built. + * Gets the root method from which this graph was built. * * @return null if this method was not built from a method or the method is not available */ @@ -303,7 +326,7 @@ @Override protected Graph copy(String newName, Consumer<Map<Node, Node>> duplicationMapCallback) { AllowAssumptions allowAssumptions = AllowAssumptions.from(assumptions != null); - StructuredGraph copy = new StructuredGraph(newName, method, graphId, entryBCI, allowAssumptions, speculationLog); + StructuredGraph copy = new StructuredGraph(newName, method, graphId, entryBCI, allowAssumptions, speculationLog, useProfilingInfo); if (allowAssumptions == AllowAssumptions.YES && assumptions != null) { copy.assumptions.record(assumptions); } @@ -565,6 +588,32 @@ } /** + * Determines if {@link ProfilingInfo} is used during construction of this graph. + */ + public boolean useProfilingInfo() { + return hasValueProxies; + } + + /** + * Gets the profiling info for the {@linkplain #method() root method} of this graph. + */ + public ProfilingInfo getProfilingInfo() { + return getProfilingInfo(method()); + } + + /** + * Gets the profiling info for a given method that is or will be part of this graph, taking into + * account {@link #useProfilingInfo()}. + */ + public ProfilingInfo getProfilingInfo(ResolvedJavaMethod m) { + if (useProfilingInfo && m != null) { + return m.getProfilingInfo(); + } else { + return DefaultProfilingInfo.get(TriState.UNKNOWN); + } + } + + /** * Gets the object for recording assumptions while constructing of this graph. * * @return {@code null} if assumptions cannot be made for this graph
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/graphbuilderconf/GraphBuilderConfiguration.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/graphbuilderconf/GraphBuilderConfiguration.java Wed Jan 13 22:48:03 2016 +0100 @@ -146,7 +146,6 @@ private final ResolvedJavaType[] skippedExceptionTypes; private final DebugInfoMode debugInfoMode; private final boolean clearNonLiveLocals; - private boolean useProfiling; private final Plugins plugins; public static enum DebugInfoMode { @@ -181,7 +180,6 @@ this.debugInfoMode = debugInfoMode; this.skippedExceptionTypes = skippedExceptionTypes; this.clearNonLiveLocals = clearNonLiveLocals; - this.useProfiling = true; this.plugins = plugins; } @@ -193,18 +191,9 @@ public GraphBuilderConfiguration copy() { Plugins newPlugins = new Plugins(plugins); GraphBuilderConfiguration result = new GraphBuilderConfiguration(eagerResolving, omitAllExceptionEdges, omitAssertions, debugInfoMode, skippedExceptionTypes, clearNonLiveLocals, newPlugins); - result.useProfiling = useProfiling; return result; } - public boolean getUseProfiling() { - return useProfiling; - } - - public void setUseProfiling(boolean b) { - this.useProfiling = b; - } - public GraphBuilderConfiguration withEagerResolving(boolean newEagerResolving) { return new GraphBuilderConfiguration(newEagerResolving, omitAllExceptionEdges, omitAssertions, debugInfoMode, skippedExceptionTypes, clearNonLiveLocals, plugins); } @@ -279,9 +268,7 @@ } public static GraphBuilderConfiguration getSnippetDefault(Plugins plugins) { - GraphBuilderConfiguration config = new GraphBuilderConfiguration(true, true, false, DebugInfoMode.SafePointsOnly, EMPTY, GraalOptions.OptClearNonLiveLocals.getValue(), plugins); - config.setUseProfiling(false); - return config; + return new GraphBuilderConfiguration(true, true, false, DebugInfoMode.SafePointsOnly, EMPTY, GraalOptions.OptClearNonLiveLocals.getValue(), plugins); } public static GraphBuilderConfiguration getFullDebugDefault(Plugins plugins) {
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/AbstractInliningPolicy.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/policy/AbstractInliningPolicy.java Wed Jan 13 22:48:03 2016 +0100 @@ -87,7 +87,7 @@ int size = 0; for (int i = 0; i < info.numberOfMethods(); i++) { ResolvedJavaMethod m = info.methodAt(i); - ProfilingInfo profile = m.getProfilingInfo(); + ProfilingInfo profile = info.graph().getProfilingInfo(m); int compiledGraphSize = profile.getCompilerIRSize(StructuredGraph.class); if (compiledGraphSize > 0) { size += compiledGraphSize;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningData.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/inlining/walker/InliningData.java Wed Jan 13 22:48:03 2016 +0100 @@ -41,7 +41,6 @@ import jdk.vm.ci.meta.JavaTypeProfile; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; - import com.oracle.graal.compiler.common.type.ObjectStamp; import com.oracle.graal.debug.Debug; import com.oracle.graal.debug.DebugMetric; @@ -148,7 +147,7 @@ return "it is marked non-inlinable"; } else if (countRecursiveInlining(method) > MaximumRecursiveInlining.getValue()) { return "it exceeds the maximum recursive inlining depth"; - } else if (new OptimisticOptimizations(method.getProfilingInfo()).lessOptimisticThan(context.getOptimisticOptimizations())) { + } else if (new OptimisticOptimizations(rootGraph.getProfilingInfo(method)).lessOptimisticThan(context.getOptimisticOptimizations())) { return "the callee uses less optimistic optimizations than caller"; } else { return null;
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraphKit.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/GraphKit.java Wed Jan 13 22:48:03 2016 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.graal.replacements; +import static com.oracle.graal.nodes.StructuredGraph.NO_PROFILING_INFO; import static com.oracle.graal.nodes.graphbuilderconf.IntrinsicContext.CompilationContext.INLINE_AFTER_PARSING; import java.lang.reflect.Method; @@ -257,7 +258,7 @@ Plugins plugins = new Plugins(graphBuilderPlugins); GraphBuilderConfiguration config = GraphBuilderConfiguration.getSnippetDefault(plugins); - StructuredGraph calleeGraph = new StructuredGraph(method, AllowAssumptions.NO); + StructuredGraph calleeGraph = new StructuredGraph(method, AllowAssumptions.NO, NO_PROFILING_INFO); IntrinsicContext initialReplacementContext = new IntrinsicContext(method, method, INLINE_AFTER_PARSING); new GraphBuilderPhase.Instance(metaAccess, providers.getStampProvider(), providers.getConstantReflection(), config, OptimisticOptimizations.NONE, initialReplacementContext).apply(calleeGraph);
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Wed Jan 13 22:48:03 2016 +0100 @@ -27,6 +27,7 @@ import static com.oracle.graal.compiler.common.GraalOptions.UseSnippetGraphCache; import static com.oracle.graal.java.BytecodeParserOptions.InlineDuringParsing; import static com.oracle.graal.java.BytecodeParserOptions.InlineIntrinsicsDuringParsing; +import static com.oracle.graal.nodes.StructuredGraph.NO_PROFILING_INFO; import static com.oracle.graal.nodes.graphbuilderconf.IntrinsicContext.CompilationContext.INLINE_AFTER_PARSING; import static com.oracle.graal.phases.common.DeadCodeEliminationPhase.Optionality.Required; import static java.lang.String.format; @@ -606,7 +607,7 @@ protected StructuredGraph buildInitialGraph(final ResolvedJavaMethod methodToParse, Object[] args) { // Replacements cannot have optimistic assumptions since they have // to be valid for the entire run of the VM. - final StructuredGraph graph = new StructuredGraph(methodToParse, AllowAssumptions.NO); + final StructuredGraph graph = new StructuredGraph(methodToParse, AllowAssumptions.NO, NO_PROFILING_INFO); // They are not user code so they do not participate in unsafe access tracking graph.disableUnsafeAccessTracking();
--- a/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.truffle.hotspot/src/com/oracle/graal/truffle/hotspot/HotSpotTruffleRuntime.java Wed Jan 13 22:48:03 2016 +0100 @@ -23,7 +23,6 @@ package com.oracle.graal.truffle.hotspot; import static com.oracle.graal.compiler.GraalCompiler.compileGraph; -import static com.oracle.graal.compiler.GraalCompiler.getProfilingInfo; import static com.oracle.graal.hotspot.meta.HotSpotSuitesProvider.withSimpleDebugInfo; import static com.oracle.graal.truffle.TruffleCompilerOptions.TraceTruffleStackTraceLimit; import static com.oracle.graal.truffle.TruffleCompilerOptions.TraceTruffleTransferToInterpreter; @@ -72,8 +71,8 @@ import com.oracle.graal.nodes.StructuredGraph; import com.oracle.graal.nodes.StructuredGraph.AllowAssumptions; import com.oracle.graal.nodes.graphbuilderconf.GraphBuilderConfiguration; +import com.oracle.graal.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins; import com.oracle.graal.nodes.graphbuilderconf.InvocationPlugins; -import com.oracle.graal.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins; import com.oracle.graal.phases.BasePhase; import com.oracle.graal.phases.OptimisticOptimizations; import com.oracle.graal.phases.PhaseSuite; @@ -256,7 +255,7 @@ CallingConvention cc = getCallingConvention(codeCache, Type.JavaCallee, graph.method(), false); Backend backend = getHotSpotBackend(); CompilationResultBuilderFactory factory = getOptimizedCallTargetInstrumentationFactory(backend.getTarget().arch.getName()); - return compileGraph(graph, cc, javaMethod, providers, backend, graphBuilderSuite, OptimisticOptimizations.ALL, getProfilingInfo(graph), suites, lirSuites, new CompilationResult(), factory); + return compileGraph(graph, cc, javaMethod, providers, backend, graphBuilderSuite, OptimisticOptimizations.ALL, graph.getProfilingInfo(), suites, lirSuites, new CompilationResult(), factory); } private HotSpotBackend getHotSpotBackend() {
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Wed Jan 13 22:48:03 2016 +0100 @@ -22,6 +22,7 @@ */ package com.oracle.graal.truffle; +import static com.oracle.graal.nodes.StructuredGraph.NO_PROFILING_INFO; import static com.oracle.graal.truffle.TruffleCompilerOptions.PrintTruffleExpansionHistogram; import java.lang.invoke.MethodHandle; @@ -164,7 +165,7 @@ throw Debug.handle(e); } - final StructuredGraph graph = new StructuredGraph(callTarget.toString(), callRootMethod, allowAssumptions, callTarget.getSpeculationLog()); + final StructuredGraph graph = new StructuredGraph(callTarget.toString(), callRootMethod, allowAssumptions, callTarget.getSpeculationLog(), NO_PROFILING_INFO); assert graph != null : "no graph for root method"; try (Scope s = Debug.scope("CreateGraph", graph); Indent indent = Debug.logAndIndent("createGraph %s", graph)) { @@ -333,7 +334,6 @@ protected void doFastPE(OptimizedCallTarget callTarget, StructuredGraph graph) { GraphBuilderConfiguration newConfig = configForPartialEvaluation.copy(); - newConfig.setUseProfiling(false); Plugins plugins = newConfig.getPlugins(); plugins.prependParameterPlugin(new InterceptReceiverPlugin(callTarget)); callTarget.setInlining(new TruffleInlining(callTarget, new DefaultInliningPolicy())); @@ -362,7 +362,6 @@ LoopExplosionPlugin loopExplosionPlugin = new PELoopExplosionPlugin(); - newConfig.setUseProfiling(false); Plugins plugins = newConfig.getPlugins(); ReplacementsImpl replacements = (ReplacementsImpl) providers.getReplacements(); plugins.clearInlineInvokePlugins();
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompiler.java Tue Jan 12 17:56:53 2016 -0800 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompiler.java Wed Jan 13 22:48:03 2016 +0100 @@ -23,7 +23,6 @@ package com.oracle.graal.truffle; import static com.oracle.graal.compiler.GraalCompiler.compileGraph; -import static com.oracle.graal.compiler.GraalCompiler.getProfilingInfo; import static jdk.vm.ci.code.CodeUtil.getCallingConvention; import java.util.ArrayList; @@ -185,7 +184,7 @@ CodeCacheProvider codeCache = providers.getCodeCache(); CallingConvention cc = getCallingConvention(codeCache, Type.JavaCallee, graph.method(), false); CompilationResult compilationResult = new CompilationResult(name); - result = compileGraph(graph, cc, graph.method(), providers, backend, graphBuilderSuite, Optimizations, getProfilingInfo(graph), suites, lirSuites, compilationResult, factory); + result = compileGraph(graph, cc, graph.method(), providers, backend, graphBuilderSuite, Optimizations, graph.getProfilingInfo(), suites, lirSuites, compilationResult, factory); } catch (Throwable e) { throw Debug.handle(e); }