Class OptimizedTruffleRuntime
java.lang.Object
com.oracle.truffle.runtime.OptimizedTruffleRuntime
- All Implemented Interfaces:
com.oracle.truffle.api.TruffleRuntime, com.oracle.truffle.compiler.TruffleCompilerRuntime
- Direct Known Subclasses:
HotSpotTruffleRuntime
public abstract class OptimizedTruffleRuntime
extends Object
implements com.oracle.truffle.api.TruffleRuntime, com.oracle.truffle.compiler.TruffleCompilerRuntime
Implementation of the Truffle runtime when running on top of Graal. There is only one per VM.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumfinal classstatic classNested classes/interfaces inherited from interface com.oracle.truffle.compiler.TruffleCompilerRuntime
com.oracle.truffle.compiler.TruffleCompilerRuntime.InlineKind, com.oracle.truffle.compiler.TruffleCompilerRuntime.LoopExplosionKind -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.oracle.truffle.compiler.TruffleCompilationSupportprotected org.graalvm.options.OptionDescriptorsprotected OptimizedCallTargetprotected OptimizedTruffleRuntime.KnownMethodsstatic final intstatic final org.graalvm.home.Versionstatic final intstatic final org.graalvm.home.Versionprotected com.oracle.truffle.compiler.TruffleCompiler -
Constructor Summary
ConstructorsConstructorDescriptionOptimizedTruffleRuntime(com.oracle.truffle.compiler.TruffleCompilationSupport compilationSupport, Iterable<Class<?>> extraLookupTypes) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(OptimizedTruffleRuntimeListener listener) com.oracle.truffle.compiler.TruffleCompilableasCompilableTruffleAST(jdk.vm.ci.meta.JavaConstant constant) protected abstract <T> TvoidNotifies this runtime when a Truffle AST is being executed in the Truffle interpreter even though compiled code is available for the AST.protected voidUsed only to reset state for native image compilation.final intfinal com.oracle.truffle.api.Assumptionfinal com.oracle.truffle.api.AssumptioncreateAssumption(String name) protected abstract OptimizedCallTargetcom.oracle.truffle.api.nodes.LoopNodecreateLoopNode(com.oracle.truffle.api.nodes.RepeatingNode repeatingNode) final com.oracle.truffle.api.frame.MaterializedFramecreateMaterializedFrame(Object[] arguments) final com.oracle.truffle.api.frame.MaterializedFramecreateMaterializedFrame(Object[] arguments, com.oracle.truffle.api.frame.FrameDescriptor frameDescriptor) protected abstract OptimizedCallTargetcreateOptimizedCallTarget(OptimizedCallTarget source, com.oracle.truffle.api.nodes.RootNode rootNode) abstract jdk.vm.ci.meta.SpeculationLogstatic <T> ThreadLocal<T> createTerminatingThreadLocal(Supplier<T> initialValue, Consumer<T> onThreadTermination) final com.oracle.truffle.api.frame.VirtualFramecreateVirtualFrame(Object[] arguments, com.oracle.truffle.api.frame.FrameDescriptor frameDescriptor) protected final voiddoCompile(OptimizedCallTarget callTarget, AbstractCompilationTask task) final booleanvoidfinishCompilation(OptimizedCallTarget optimizedCallTarget, CompilationTask task, boolean mayBeAsynchronous) voidflushCompilations(EngineData engine) protected abstract jdk.vm.ci.meta.JavaConstantprotected intgetArrayBaseOffset(Class<?> componentType) protected intgetArrayIndexScale(Class<?> componentType) protected intgetBaseInstanceSize(Class<?> type) <T> TgetCapability(Class<T> capability) Returns the current host compilation activity mode.intabstract BackgroundCompileQueuefinal StringThis method allows retrieval of the compiler configuration without requiring to initialize theTruffleCompilerwithgetTruffleCompiler.protected longgetCompilerIdleDelay(OptimizedCallTarget callTarget) Gets the time in milliseconds an idle compiler thread will wait for new tasks before terminating.com.oracle.truffle.compiler.ConstantFieldInfogetConstantFieldInfo(jdk.vm.ci.meta.ResolvedJavaField field) final EngineCacheSupportprotected static EngineDatagetEngineData(com.oracle.truffle.api.nodes.RootNode rootNode) UseOptimizedCallTarget.enginewhenever possible as it's much faster.protected abstract com.oracle.truffle.api.impl.AbstractFastThreadLocalprotected int[]getFieldOffsets(Class<?> type, boolean includePrimitive, boolean includeSuperclasses) booleangetFrameMaterializeCalled(com.oracle.truffle.api.frame.FrameDescriptor descriptor) Accessor for non-public state inFrameDescriptor.com.oracle.truffle.compiler.HostMethodInfogetHostMethodInfo(jdk.vm.ci.meta.ResolvedJavaMethod method) Returns a set of classes that need to be initialized before compilations can be performed.protected final LoopNodeFactorygetName()protected intcom.oracle.truffle.compiler.PartialEvaluationMethodInfogetPartialEvaluationMethodInfo(jdk.vm.ci.meta.ResolvedJavaMethod method) static OptimizedTruffleRuntimeUtility method that casts the singletonTruffleRuntime.protected abstract jdk.vm.ci.code.stack.StackIntrospectionlongprotected com.oracle.truffle.api.impl.TVMCI.Test<?, ?> abstract com.oracle.truffle.api.impl.ThreadLocalHandshakeabstract com.oracle.truffle.compiler.TruffleCompilergetTruffleCompiler(com.oracle.truffle.compiler.TruffleCompilable compilable) protected OptimizedTVMCIgetTvmci()final voidfinal voidinitializeKnownMethods(jdk.vm.ci.meta.MetaAccessProvider metaAccess) protected voidbooleanisSuppressedFailure(com.oracle.truffle.compiler.TruffleCompilable compilable, Supplier<String> serializedException) booleanisValueType(jdk.vm.ci.meta.ResolvedJavaType type) final <T> TiterateFrames(com.oracle.truffle.api.frame.FrameInstanceVisitor<T> visitor, int skipFrames) final com.oracle.truffle.compiler.TruffleCompilerOptionDescriptor[]protected EngineCacheSupportloadEngineCacheSupport(List<org.graalvm.options.OptionDescriptors> options) voidvoidmarkFrameMaterializeCalled(com.oracle.truffle.api.frame.FrameDescriptor descriptor) Accessor for non-public state inFrameDescriptor.final com.oracle.truffle.compiler.TruffleCompilerprotected voidonEngineCreated(EngineData engine) protected final AutoCloseableGets a closeable that will be used in a try-with-resources statement surrounding the run-loop of a Truffle compiler thread.Consumer<com.oracle.truffle.compiler.OptimizedAssumptionDependency> registerOptimizedAssumptionDependency(jdk.vm.ci.meta.JavaConstant optimizedAssumptionConstant) voidjdk.vm.ci.meta.ResolvedJavaTyperesolveType(jdk.vm.ci.meta.MetaAccessProvider metaAccess, String className, boolean required) final voidfinal AtomicLongsubmitForCompilation(OptimizedCallTarget optimizedCallTarget, boolean lastTierCompilation) final StringvalidateCompilerOption(String key, String value) voidwaitForCompilation(OptimizedCallTarget optimizedCallTarget, long timeout) voidwaitForCompilation(OptimizedCallTarget optimizedCallTarget, long timeout, BooleanSupplier cancelledPredicate) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.oracle.truffle.compiler.TruffleCompilerRuntime
formatEvent, log, logEvent, logEvent, onCodeInstallation, resolveTypeMethods inherited from interface com.oracle.truffle.api.TruffleRuntime
createDirectCallNode, createIndirectCallNode, isProfilingEnabled, iterateFrames, notifyTransferToInterpreter
-
Field Details
-
MIN_COMPILER_VERSION
public static final org.graalvm.home.Version MIN_COMPILER_VERSION -
MIN_JDK_VERSION
public static final int MIN_JDK_VERSION- See Also:
-
MAX_JDK_VERSION
public static final int MAX_JDK_VERSION- See Also:
-
NEXT_VERSION_UPDATE
public static final org.graalvm.home.Version NEXT_VERSION_UPDATE -
truffleCompiler
protected volatile com.oracle.truffle.compiler.TruffleCompiler truffleCompiler -
initializeCallTarget
-
knownMethods
-
engineOptions
protected volatile org.graalvm.options.OptionDescriptors engineOptions -
compilationSupport
protected final com.oracle.truffle.compiler.TruffleCompilationSupport compilationSupport
-
-
Constructor Details
-
OptimizedTruffleRuntime
-
-
Method Details
-
clearState
protected void clearState()Used only to reset state for native image compilation. -
getRuntime
Utility method that casts the singletonTruffleRuntime. -
initializeEngineCacheSupport
-
loadEngineCacheSupport
protected EngineCacheSupport loadEngineCacheSupport(List<org.graalvm.options.OptionDescriptors> options) -
getThreadLocalHandshake
public abstract com.oracle.truffle.api.impl.ThreadLocalHandshake getThreadLocalHandshake() -
getName
- Specified by:
getNamein interfacecom.oracle.truffle.api.TruffleRuntime
-
getLookupTypes
-
getCompilerConfigurationName
This method allows retrieval of the compiler configuration without requiring to initialize theTruffleCompilerwithgetTruffleCompiler. -
getTruffleCompiler
public abstract com.oracle.truffle.compiler.TruffleCompiler getTruffleCompiler(com.oracle.truffle.compiler.TruffleCompilable compilable) -
listCompilerOptions
public final com.oracle.truffle.compiler.TruffleCompilerOptionDescriptor[] listCompilerOptions() -
existsCompilerOption
-
validateCompilerOption
-
getTvmci
-
getTestTvmci
protected com.oracle.truffle.api.impl.TVMCI.Test<?,?> getTestTvmci() -
asCompilableTruffleAST
public com.oracle.truffle.compiler.TruffleCompilable asCompilableTruffleAST(jdk.vm.ci.meta.JavaConstant constant) - Specified by:
asCompilableTruffleASTin interfacecom.oracle.truffle.compiler.TruffleCompilerRuntime
-
registerOptimizedAssumptionDependency
public Consumer<com.oracle.truffle.compiler.OptimizedAssumptionDependency> registerOptimizedAssumptionDependency(jdk.vm.ci.meta.JavaConstant optimizedAssumptionConstant) - Specified by:
registerOptimizedAssumptionDependencyin interfacecom.oracle.truffle.compiler.TruffleCompilerRuntime
-
forObject
-
asObject
-
newTruffleCompiler
public final com.oracle.truffle.compiler.TruffleCompiler newTruffleCompiler() -
getConstantFieldInfo
public com.oracle.truffle.compiler.ConstantFieldInfo getConstantFieldInfo(jdk.vm.ci.meta.ResolvedJavaField field) - Specified by:
getConstantFieldInfoin interfacecom.oracle.truffle.compiler.TruffleCompilerRuntime
-
resolveType
public jdk.vm.ci.meta.ResolvedJavaType resolveType(jdk.vm.ci.meta.MetaAccessProvider metaAccess, String className, boolean required) - Specified by:
resolveTypein interfacecom.oracle.truffle.compiler.TruffleCompilerRuntime
-
installDefaultListeners
protected void installDefaultListeners() -
getHostMethodInfo
public com.oracle.truffle.compiler.HostMethodInfo getHostMethodInfo(jdk.vm.ci.meta.ResolvedJavaMethod method) - Specified by:
getHostMethodInfoin interfacecom.oracle.truffle.compiler.TruffleCompilerRuntime
-
getPartialEvaluationMethodInfo
public com.oracle.truffle.compiler.PartialEvaluationMethodInfo getPartialEvaluationMethodInfo(jdk.vm.ci.meta.ResolvedJavaMethod method) - Specified by:
getPartialEvaluationMethodInfoin interfacecom.oracle.truffle.compiler.TruffleCompilerRuntime
-
initializeKnownMethods
public final void initializeKnownMethods(jdk.vm.ci.meta.MetaAccessProvider metaAccess) -
markFrameMaterializeCalled
public void markFrameMaterializeCalled(com.oracle.truffle.api.frame.FrameDescriptor descriptor) Accessor for non-public state inFrameDescriptor. -
getFrameMaterializeCalled
public boolean getFrameMaterializeCalled(com.oracle.truffle.api.frame.FrameDescriptor descriptor) Accessor for non-public state inFrameDescriptor. -
createLoopNode
public com.oracle.truffle.api.nodes.LoopNode createLoopNode(com.oracle.truffle.api.nodes.RepeatingNode repeatingNode) - Specified by:
createLoopNodein interfacecom.oracle.truffle.api.TruffleRuntime
-
getLoopNodeFactory
-
getEngineCacheSupport
-
createVirtualFrame
public final com.oracle.truffle.api.frame.VirtualFrame createVirtualFrame(Object[] arguments, com.oracle.truffle.api.frame.FrameDescriptor frameDescriptor) - Specified by:
createVirtualFramein interfacecom.oracle.truffle.api.TruffleRuntime
-
createMaterializedFrame
public final com.oracle.truffle.api.frame.MaterializedFrame createMaterializedFrame(Object[] arguments) - Specified by:
createMaterializedFramein interfacecom.oracle.truffle.api.TruffleRuntime
-
createMaterializedFrame
public final com.oracle.truffle.api.frame.MaterializedFrame createMaterializedFrame(Object[] arguments, com.oracle.truffle.api.frame.FrameDescriptor frameDescriptor) - Specified by:
createMaterializedFramein interfacecom.oracle.truffle.api.TruffleRuntime
-
createAssumption
public final com.oracle.truffle.api.Assumption createAssumption()- Specified by:
createAssumptionin interfacecom.oracle.truffle.api.TruffleRuntime
-
createAssumption
- Specified by:
createAssumptionin interfacecom.oracle.truffle.api.TruffleRuntime
-
getListener
-
iterateFrames
public final <T> T iterateFrames(com.oracle.truffle.api.frame.FrameInstanceVisitor<T> visitor, int skipFrames) - Specified by:
iterateFramesin interfacecom.oracle.truffle.api.TruffleRuntime
-
compilationThresholdScale
public final int compilationThresholdScale() -
getStackIntrospection
protected abstract jdk.vm.ci.code.stack.StackIntrospection getStackIntrospection() -
getCapability
- Specified by:
getCapabilityin interfacecom.oracle.truffle.api.TruffleRuntime
-
createSpeculationLog
public abstract jdk.vm.ci.meta.SpeculationLog createSpeculationLog() -
createOptimizedCallTarget
protected abstract OptimizedCallTarget createOptimizedCallTarget(OptimizedCallTarget source, com.oracle.truffle.api.nodes.RootNode rootNode) -
createInitializationCallTarget
-
addListener
-
removeListener
-
shutdownCompilationForEngine
-
flushCompilations
-
doCompile
-
getCompileQueue
-
onEngineCreated
-
stoppedCompilationTime
-
submitForCompilation
public CompilationTask submitForCompilation(OptimizedCallTarget optimizedCallTarget, boolean lastTierCompilation) -
finishCompilation
public void finishCompilation(OptimizedCallTarget optimizedCallTarget, CompilationTask task, boolean mayBeAsynchronous) -
waitForCompilation
public void waitForCompilation(OptimizedCallTarget optimizedCallTarget, long timeout) throws ExecutionException, TimeoutException - Throws:
ExecutionExceptionTimeoutException
-
waitForCompilation
public void waitForCompilation(OptimizedCallTarget optimizedCallTarget, long timeout, BooleanSupplier cancelledPredicate) throws ExecutionException, TimeoutException - Throws:
ExecutionExceptionTimeoutException
-
getCompilationQueueSize
public int getCompilationQueueSize() -
bypassedInstalledCode
Notifies this runtime when a Truffle AST is being executed in the Truffle interpreter even though compiled code is available for the AST. If this runtime uses a special entry point to switch to compiled Truffle code, then this means the code with the special entry point was deoptimized or otherwise removed from the code cache and needs to be re-installed. -
getKnownMethods
-
getEngineData
UseOptimizedCallTarget.enginewhenever possible as it's much faster. -
isValueType
public boolean isValueType(jdk.vm.ci.meta.ResolvedJavaType type) - Specified by:
isValueTypein interfacecom.oracle.truffle.compiler.TruffleCompilerRuntime
-
log
-
isSuppressedFailure
-
openCompilerThreadScope
Gets a closeable that will be used in a try-with-resources statement surrounding the run-loop of a Truffle compiler thread. In conjunction withgetCompilerIdleDelay(OptimizedCallTarget), this can be used to release resources held by idle Truffle compiler threads. If a non-null value is returned, itsAutoCloseable.close()must not throw an exception. -
getCompilerIdleDelay
Gets the time in milliseconds an idle compiler thread will wait for new tasks before terminating. A value of<= 0means that compiler threads block indefinitely waiting for a task and thus never terminate. -
getObjectAlignment
protected int getObjectAlignment() -
getArrayBaseOffset
-
getArrayIndexScale
-
getBaseInstanceSize
-
getFieldOffsets
protected int[] getFieldOffsets(Class<?> type, boolean includePrimitive, boolean includeSuperclasses) -
getFastThreadLocalImpl
protected abstract com.oracle.truffle.api.impl.AbstractFastThreadLocal getFastThreadLocalImpl() -
getStackOverflowLimit
public long getStackOverflowLimit() -
createTerminatingThreadLocal
public static <T> ThreadLocal<T> createTerminatingThreadLocal(Supplier<T> initialValue, Consumer<T> onThreadTermination) -
getCompilationActivityMode
Returns the current host compilation activity mode. The default is to run compilations.
-