public abstract class TruffleCompilerImpl extends Object implements TruffleCompilerBase, CompilationWatchDog.EventHandler
| Modifier and Type | Class and Description |
|---|---|
static class |
TruffleCompilerImpl.CancellableTruffleCompilationTask
Wrapper around a
TruffleCompilationTask which also implements Cancellable to
allow co-operative canceling of truffle compilations. |
| Modifier and Type | Field and Description |
|---|---|
protected GraphBuilderConfiguration |
builderConfig |
static MemUseTrackerKey |
CodeInstallationMemUse |
protected org.graalvm.compiler.truffle.compiler.TruffleCompilerImpl.TrufflePostCodeInstallationTaskFactory |
codeInstallationTaskFactory |
static TimerKey |
CodeInstallationTime |
static MemUseTrackerKey |
CompilationMemUse |
static TimerKey |
CompilationTime |
protected TruffleCompilerConfiguration |
config |
static TimerKey |
EncodedGraphCacheEvictionTime |
static OptimisticOptimizations |
Optimizations |
static MemUseTrackerKey |
PartialEvaluationMemUse |
static TimerKey |
PartialEvaluationTime |
protected PartialEvaluator |
partialEvaluator |
FIRST_TIER_COMPILATION_SUFFIX, FIRST_TIER_INDEX, LAST_TIER_INDEX, SECOND_TIER_COMPILATION_SUFFIXDEFAULT, STUCK_COMPILATION_EXIT_CODE| Constructor and Description |
|---|
TruffleCompilerImpl(TruffleCompilerConfiguration config) |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCompilerConfigurationNameonException, onLongCompilationprotected TruffleCompilerConfiguration config
protected final GraphBuilderConfiguration builderConfig
protected final PartialEvaluator partialEvaluator
protected final org.graalvm.compiler.truffle.compiler.TruffleCompilerImpl.TrufflePostCodeInstallationTaskFactory codeInstallationTaskFactory
public static final OptimisticOptimizations Optimizations
public static final TimerKey PartialEvaluationTime
public static final TimerKey CompilationTime
public static final TimerKey CodeInstallationTime
public static final TimerKey EncodedGraphCacheEvictionTime
public static final MemUseTrackerKey PartialEvaluationMemUse
public static final MemUseTrackerKey CompilationMemUse
public static final MemUseTrackerKey CodeInstallationMemUse
public TruffleCompilerImpl(TruffleCompilerConfiguration config)
public TruffleCompilerConfiguration getConfig()
protected abstract PartialEvaluator createPartialEvaluator(TruffleCompilerConfiguration configuration)
public abstract TruffleCompilationIdentifier createCompilationIdentifier(CompilableTruffleAST compilable)
CompilationIdentifier for compilable.
Implementations of this method must guarantee that the CompilationIdentifier.Verbosity.ID for each returned
value is unique.protected abstract DebugContext createDebugContext(OptionValues options, CompilationIdentifier compilationId, CompilableTruffleAST compilable, PrintStream logStream)
public final TruffleCompilation openCompilation(CompilableTruffleAST compilable)
TruffleCompilercompilable. Each call results in a new compilation
object. The returned compilation object may be associated with external resources which are
only released by calling close.openCompilation in interface TruffleCompilercompilable - the Truffle AST to be compiledpublic final TruffleDebugContext openDebugContext(Map<String,Object> options, TruffleCompilation compilation)
TruffleCompilerclose() method should be called on
the returned object once the compilation is finished.openDebugContext in interface TruffleCompileroptions - the options for the debug contextcompilation - a compilation object created by
openCompilation to be used for a single compilation or null if the
returned context will be used for multiple Truffle compilationsTruffleDebugContextpublic static PartialEvaluatorConfiguration createPartialEvaluatorConfiguration(String name)
public final void doCompile(TruffleDebugContext truffleDebug, TruffleCompilation compilation, Map<String,Object> optionsMap, TruffleCompilationTask task, TruffleCompilerListener inListener)
TruffleCompilercompilable to machine code.doCompile in interface TruffleCompilertruffleDebug - a debug context to usecompilation - a compilation object created by
openCompilation to be used for the compilationoptionsMap - option values relevant to compilationtask - an object that holds information about the compilation process itself (e.g. which
tier, was the compilation canceled)inListener - a listener receiving events about compilation success or failurepublic void initialize(Map<String,Object> optionsMap, CompilableTruffleAST compilable, boolean firstInitialization)
TruffleCompilerinitialize in interface TruffleCompileroptionsMap - the options for initializationcompilable - the Truffle AST that triggered the initializationfirstInitialization - first initialization. For a multi-isolate compiler the
firstInitialization must be true for an initialization in the
first isolate and false for an initialization in the following isolates.protected TruffleTier newTruffleTier(org.graalvm.options.OptionValues options)
public void shutdown()
TruffleCompilershutdown in interface TruffleCompilerprotected abstract DiagnosticsOutputDirectory getDebugOutputDirectory()
protected abstract Map<CompilationWrapper.ExceptionAction,Integer> getCompilationProblemsPerAction()
public void compileAST(org.graalvm.options.OptionValues options,
DebugContext debug,
CompilableTruffleAST compilable,
CompilationIdentifier compilationId,
TruffleCompilerImpl.CancellableTruffleCompilationTask task,
TruffleCompilerListener listener)
public CompilationResult compilePEGraph(StructuredGraph graph, String name, PhaseSuite<HighTierContext> graphBuilderSuite, CompilableTruffleAST compilable, CompilationRequest compilationRequest, TruffleCompilerListener listener, TruffleCompilationTask task)
TruffleTier, i.e.
TruffleCompilerImpl.truffleTier(TruffleCompilationWrapper, DebugContext).graph - a graph resulting from partial evaluationname - the name to be used for the returned resultgraphBuilderSuite - phase suite to be used for creating new graphs during inliningcompilationRequest - listener - protected abstract InstalledCode createInstalledCode(CompilableTruffleAST compilable)
protected void exitHostVM(int status)
System.exit(int) in the runtime embedding the Graal compiler. This will be a
different runtime than Graal's runtime in the case of libgraal.protected abstract CompilationResult createCompilationResult(String name, CompilationIdentifier compilationIdentifier, CompilableTruffleAST compilable)
CompilationResult to be used for a Truffle compilation.public abstract PhaseSuite<HighTierContext> createGraphBuilderSuite(TruffleTierConfiguration tier)
public PartialEvaluator getPartialEvaluator()
getPartialEvaluator in interface TruffleCompilerBasepublic TruffleTier getTruffleTier()
getTruffleTier in interface TruffleCompilerBasepublic CompilableTruffleAST asCompilableTruffleAST(JavaConstant constant)
public void onStuckCompilation(CompilationWatchDog watchDog, Thread watched, CompilationIdentifier compilation, StackTraceElement[] stackTrace, int stuckTime)
CompilationWatchDog.EventHandlerCompilationWatchDog.EventHandler.STUCK_COMPILATION_EXIT_CODE.onStuckCompilation in interface CompilationWatchDog.EventHandlerwatchDog - the watch dog watching the compilationwatched - the watched compiler threadcompilation - the compilationstackTrace - snapshot stack trace for watchedstuckTime - seconds compilation appears to have been stuck forprotected CompilableTruffleAST getCompilable(CompilationResult result)
CompilableTruffleAST associated with result.result - a CompilationResult that may have a non-null
CompilableTruffleAST associated with itprotected void afterCodeInstallation(CompilationResult result, InstalledCode installedCode)
installedCode has been installed in the code cache.result - the result of compilationinstalledCode - code that has just been installed in the code cachepublic final SnippetReflectionProvider getSnippetReflection()
getSnippetReflection in interface TruffleCompilerBasepublic static org.graalvm.options.OptionValues getOptionsForCompiler(Map<String,Object> options)
PolyglotCompilerOptions passed to the
TruffleCompiler.doCompile(org.graalvm.compiler.truffle.common.TruffleDebugContext, org.graalvm.compiler.truffle.common.TruffleCompilation, java.util.Map<java.lang.String, java.lang.Object>, org.graalvm.compiler.truffle.common.TruffleCompilationTask, org.graalvm.compiler.truffle.common.TruffleCompilerListener) as a Map into
OptionValues.