diff --git a/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/PartialEvaluator.java b/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/PartialEvaluator.java index 1ce98d27e5f9..d6afee31ee30 100644 --- a/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/PartialEvaluator.java +++ b/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/PartialEvaluator.java @@ -92,7 +92,8 @@ public abstract class PartialEvaluator { // Configs - public final TruffleCompilerConfiguration config; + protected final TruffleCompilerConfiguration config; + // TODO GR-37097 Move to TruffleCompilerImpl volatile GraphBuilderConfiguration configForParsing; // Methods final ResolvedJavaMethod callDirectMethod; @@ -112,6 +113,7 @@ public abstract class PartialEvaluator { * Holds instrumentation options initialized in {@link #initialize(OptionValues)} method before * the first compilation. These options are not engine aware. */ + // TODO GR-37097 Move to TruffleCompilerImpl public volatile InstrumentPhase.InstrumentationConfiguration instrumentationCfg; /** * The instrumentation object is used by the Truffle instrumentation to count executions. The @@ -119,6 +121,7 @@ public abstract class PartialEvaluator { * options, and tests that need the instrumentation table need to override these options after * the TruffleRuntime object is created. */ + // TODO GR-37097 Move to TruffleCompilerImpl protected volatile InstrumentPhase.Instrumentation instrumentation; protected final TruffleConstantFieldProvider compilationLocalConstantProvider; diff --git a/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/TruffleCompilerImpl.java b/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/TruffleCompilerImpl.java index cdd71604071f..c9f13af31556 100644 --- a/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/TruffleCompilerImpl.java +++ b/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/TruffleCompilerImpl.java @@ -116,7 +116,6 @@ import jdk.vm.ci.meta.JavaConstant; import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.ResolvedJavaType; -import jdk.vm.ci.meta.SpeculationLog; /** * Coordinates partial evaluation of a Truffle AST and subsequent compilation via Graal. @@ -130,7 +129,8 @@ public abstract class TruffleCompilerImpl implements TruffleCompilerBase { private volatile ExpansionStatistics expansionStatistics; private volatile boolean expansionStatisticsInitialized; private volatile boolean initialized; - TruffleTier truffleTier; + // Effectivelly final, but initialized in #initialize + private TruffleTier truffleTier; public static final OptimisticOptimizations Optimizations = ALL.remove( UseExceptionProbability, @@ -327,7 +327,7 @@ public void initialize(Map optionsMap, CompilableTruffleAST comp // Hook for SVM protected TruffleTier newTruffleTier(org.graalvm.options.OptionValues options) { return new TruffleTier(options, partialEvaluator, - new InstrumentationSuite(partialEvaluator.instrumentationCfg, partialEvaluator.config.snippetReflection(), partialEvaluator.getInstrumentation()), + new InstrumentationSuite(partialEvaluator.instrumentationCfg, config.snippetReflection(), partialEvaluator.getInstrumentation()), new PostPartialEvaluationSuite(options.get(IterativePartialEscape))); } @@ -545,6 +545,10 @@ private StructuredGraph truffleTier(TruffleCompilationWrapper wrapper, DebugCont try (DebugCloseable a = PartialEvaluationTime.start(debug); DebugCloseable c = PartialEvaluationMemUse.start(debug); PerformanceInformationHandler handler = PerformanceInformationHandler.install(wrapper.options)) { + /* + * TODO GR-37097 Merge TruffleTierConfiguration and TruffleCompilationWrapper so that + * there is one place where compilation data lives + */ TruffleTierContext context = new TruffleTierContext(partialEvaluator, wrapper, debug, handler); try (Scope s = context.debug.scope("CreateGraph", context.graph); Indent indent = context.debug.logAndIndent("evaluate %s", context.graph);) { diff --git a/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/TruffleTierContext.java b/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/TruffleTierContext.java index 1f6dfaf5612b..04e2ad389e18 100644 --- a/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/TruffleTierContext.java +++ b/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/TruffleTierContext.java @@ -79,7 +79,8 @@ public TruffleTierContext(PartialEvaluator partialEvaluator, OptionValues option } public TruffleTierContext(PartialEvaluator partialEvaluator, TruffleCompilerImpl.TruffleCompilationWrapper wrapper, DebugContext debug, PerformanceInformationHandler handler) { - this(partialEvaluator, wrapper.options, debug, wrapper.compilable, partialEvaluator.rootForCallTarget(wrapper.compilable), wrapper.compilationId, getSpeculationLog(wrapper), wrapper.task, handler); + this(partialEvaluator, wrapper.options, debug, wrapper.compilable, partialEvaluator.rootForCallTarget(wrapper.compilable), wrapper.compilationId, getSpeculationLog(wrapper), wrapper.task, + handler); } public boolean isFirstTier() { diff --git a/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/InstrumentPhase.java b/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/InstrumentPhase.java index 4ee82d41f02e..0a40ae1d1eb2 100644 --- a/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/InstrumentPhase.java +++ b/compiler/src/org.graalvm.compiler.truffle.compiler/src/org/graalvm/compiler/truffle/compiler/phases/InstrumentPhase.java @@ -63,7 +63,6 @@ import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.MetaUtil; -// TODO: make sure the subclasses of this are thread-safe public abstract class InstrumentPhase extends BasePhase { private static boolean checkMethodExists(String declaringClassName, String methodName) { diff --git a/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleSupport.java b/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleSupport.java index bd091eb54ab5..3ad044551c1c 100644 --- a/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleSupport.java +++ b/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleSupport.java @@ -104,10 +104,7 @@ protected static TruffleCompilerConfiguration createSubstrateTruffleCompilerConf PartialEvaluatorConfiguration peConfig = TruffleCompilerImpl.createPartialEvaluatorConfiguration(compilerConfigurationName); final TruffleTierConfiguration lastTier = new TruffleTierConfiguration(peConfig, GraalSupport.getRuntimeConfig().getBackendForNormalMethod(), GraalSupport.getRuntimeConfig().getProviders(), GraalSupport.getSuites(), GraalSupport.getLIRSuites()); - final TruffleCompilerConfiguration truffleCompilerConfig = new TruffleCompilerConfiguration(runtime, graphBuilderPlugins, snippetReflectionProvider, firstTier, lastTier); - return truffleCompilerConfig; - -// return new SubstrateTruffleCompilerImpl(truffleCompilerConfig); + return new TruffleCompilerConfiguration(runtime, graphBuilderPlugins, snippetReflectionProvider, firstTier, lastTier); } public static boolean isIsolatedCompilation() { diff --git a/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/api/SubstrateTruffleCompilerImpl.java b/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/api/SubstrateTruffleCompilerImpl.java index 9ecc4dbc1f1a..1c9656cb54cd 100644 --- a/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/api/SubstrateTruffleCompilerImpl.java +++ b/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/api/SubstrateTruffleCompilerImpl.java @@ -86,7 +86,7 @@ public void initialize(Map optionsMap, CompilableTruffleAST comp @Override protected TruffleTier newTruffleTier(org.graalvm.options.OptionValues options) { return new TruffleTier(options, partialEvaluator, - new InstrumentationSuite(partialEvaluator.instrumentationCfg, partialEvaluator.config.snippetReflection(), partialEvaluator.getInstrumentation()), + new InstrumentationSuite(partialEvaluator.instrumentationCfg, config.snippetReflection(), partialEvaluator.getInstrumentation()), new SubstratePostPartialEvaluationSuite(options.get(IterativePartialEscape))); }