public abstract class OptimizedCallTarget extends Object implements CompilableTruffleAST, com.oracle.truffle.api.RootCallTarget, com.oracle.truffle.api.ReplaceObserver
PartialEvaluator looks up this class and a number of its methods by name.
The end-goal of executing a OptimizedCallTarget is executing its root node. The following
call-graph shows all the paths that can be taken from calling a call target (through all the
public call* methods) to the
execution of the root node
depending on the type of call.
GraalRuntimeSupport#callProfiled GraalRuntimeSupport#callInlined
| |
| V
PUBLIC call -> callIndirect | callOSR callDirect <================> callInlined
| +-+ | | ^ |
| | +---+ | substituted by the |
V V V | compiler if inlined |
PROTECTED doInvoke <-------------+ |
| |
| <= Jump to installed code |
V |
PROTECTED callBoundary |
| |
| <= Tail jump to installed code in Int. |
V |
PROTECTED profiledPERoot |
| |
PRIVATE +----------> executeRootNode <---------------------+
|
V
rootNode.execute()
| Modifier and Type | Class and Description |
|---|---|
static class |
OptimizedCallTarget.ArgumentsProfile |
static class |
OptimizedCallTarget.ReturnProfile |
| Modifier and Type | Field and Description |
|---|---|
EngineData |
engine
The engine data associated with this call target.
|
int |
id |
protected boolean |
initialized
Whether this call target was cloned, compiled or called.
|
protected SpeculationLog |
speculationLog
The speculation log to keep track of assumptions taken and failed for previous compilations.
|
| Modifier | Constructor and Description |
|---|---|
protected |
OptimizedCallTarget(OptimizedCallTarget sourceCallTarget,
com.oracle.truffle.api.nodes.RootNode rootNode) |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(com.oracle.truffle.api.nodes.NodeVisitor visitor) |
JavaConstant |
asJavaConstant()
Gets this AST as a compiler constant.
|
static int |
calculateNonTrivialNodes(com.oracle.truffle.api.nodes.Node node) |
Object |
call(Object... args) |
protected Object |
callBoundary(Object[] args) |
Object |
callDirect(com.oracle.truffle.api.nodes.Node location,
Object... args)
In compiled code, this is only used if the callee is not inlined.
|
Object |
callIndirect(com.oracle.truffle.api.nodes.Node location,
Object... args) |
Object |
callInlined(com.oracle.truffle.api.nodes.Node location,
Object... arguments) |
Object |
callOSR(Object... args) |
boolean |
cancelCompilation(CharSequence reason)
Cancel the compilation of this truffle ast.
|
boolean |
compile(boolean lastTierCompilation)
Returns
true if the call target was already compiled or was compiled
synchronously. |
void |
compiledTier(int tier) |
boolean |
computeBlockCompilations()
Computes block compilation using
BlockNode APIs. |
static com.oracle.truffle.api.frame.VirtualFrame |
createFrame(com.oracle.truffle.api.frame.FrameDescriptor descriptor,
Object[] args)
Intrinsifiable compiler directive for creating a frame.
|
void |
dequeueInlined()
We intentionally do not synchronize here since as it's not worth the sync costs.
|
protected Object |
doInvoke(Object[] args)
Overridden by SVM.
|
void |
ensureInitialized() |
boolean |
equals(Object obj) |
boolean |
firstTierCall() |
int |
getCallAndLoopCount() |
int |
getCallCount()
Return the total number of calls to this target.
|
TruffleCallNode[] |
getCallNodes()
Returns the list of call nodes in this AST.
|
OptimizedDirectCallNode |
getCallSiteForSplit() |
abstract long |
getCodeAddress()
Gets the address of the machine code for this call target.
|
Map<String,Object> |
getDebugProperties() |
protected OptimizedCallTarget.ArgumentsProfile |
getInitializedArgumentsProfile() |
protected OptimizedCallTarget.ReturnProfile |
getInitializedReturnProfile() |
long |
getInitializedTimestamp() |
int |
getKnownCallSiteCount() |
String |
getName()
Gets a descriptive name for this call target.
|
JavaConstant |
getNodeRewritingAssumptionConstant() |
int |
getNonTrivialNodeCount()
Returns the estimate of the Truffle node count in this AST.
|
<T> T |
getOptionValue(org.graalvm.options.OptionKey<T> key) |
org.graalvm.options.OptionValues |
getOptionValues() |
com.oracle.truffle.api.nodes.RootNode |
getRootNode() |
OptimizedDirectCallNode |
getSingleCallNode() |
OptimizedCallTarget |
getSourceCallTarget() |
SpeculationLog |
getSpeculationLog()
Gets the speculation log used to collect all failed speculations in the compiled code for
this call target.
|
JavaConstant |
getValidRootAssumptionConstant() |
int |
hashCode() |
int |
highestCompiledTier() |
Object[] |
injectArgumentsProfile(Object[] originalArguments) |
boolean |
invalidate(CharSequence reason)
Invalidates this call target by invalidating any machine code attached to it.
|
boolean |
isInitialized() |
boolean |
isSameOrSplit(CompilableTruffleAST ast) |
boolean |
isSingleCaller() |
boolean |
isSourceCallTarget() |
boolean |
isSplit() |
boolean |
isSubmittedForCompilation() |
boolean |
isTrivial() |
abstract boolean |
isValid()
Determines if this call target has valid machine code that can be entered attached to it.
|
abstract boolean |
isValidLastTier()
Determines if this call target has valid machine code attached to it, and that this code was
compiled in the last tier.
|
void |
log(String message) |
boolean |
maybeWaitForTask(CompilationTask task) |
boolean |
needsCompile(boolean isLastTierCompilation) |
boolean |
nodeReplaced(com.oracle.truffle.api.nodes.Node oldNode,
com.oracle.truffle.api.nodes.Node newNode,
CharSequence reason) |
void |
onCompilationFailed(Supplier<String> serializedException,
boolean silent,
boolean bailout,
boolean permanentBailout,
boolean graphTooBig)
Notifies this object that a compilation of the AST it represents failed.
|
boolean |
onInvalidate(Object source,
CharSequence reason,
boolean wasActive) |
boolean |
prepareForAOT() |
void |
profileArguments(Object[] args) |
protected Object |
profiledPERoot(Object[] originalArguments) |
void |
resetCompilationProfile() |
void |
resetNeedsSplit() |
protected static GraalTruffleRuntime |
runtime() |
boolean |
shouldCompile() |
String |
toString() |
void |
waitForCompilation() |
boolean |
wasExecuted() |
getCompilationSpeculationLog, serializeExceptionprotected volatile boolean initialized
public final EngineData engine
protected volatile SpeculationLog speculationLog
public final int id
protected OptimizedCallTarget(OptimizedCallTarget sourceCallTarget, com.oracle.truffle.api.nodes.RootNode rootNode)
public void compiledTier(int tier)
public int highestCompiledTier()
public JavaConstant getNodeRewritingAssumptionConstant()
getNodeRewritingAssumptionConstant in interface CompilableTruffleASTJavaConstant representing the assumption that the nodes of the AST were not
rewritten.public JavaConstant getValidRootAssumptionConstant()
getValidRootAssumptionConstant in interface CompilableTruffleASTJavaConstant representing the assumption that the compiled code of the AST
was not invalidated.public boolean isTrivial()
isTrivial in interface CompilableTruffleASTtrue is the root nodes of this AST trivial, false
otherwise.public void dequeueInlined()
dequeueInlined in interface CompilableTruffleASTpublic final com.oracle.truffle.api.nodes.RootNode getRootNode()
getRootNode in interface com.oracle.truffle.api.RootCallTargetpublic final void resetCompilationProfile()
public final Object call(Object... args)
call in interface com.oracle.truffle.api.CallTargetpublic final Object callDirect(com.oracle.truffle.api.nodes.Node location, Object... args)
OptimizedCallTarget.callInlined(Node, Object...) is used instead, which does not profile
arguments, as it is estimated redundant. See the docs of OptimizedCallTarget.public final Object callInlined(com.oracle.truffle.api.nodes.Node location, Object... arguments)
public final boolean shouldCompile()
public final boolean wasExecuted()
public final boolean firstTierCall()
protected static GraalTruffleRuntime runtime()
public final void ensureInitialized()
public final boolean isInitialized()
public final org.graalvm.options.OptionValues getOptionValues()
public final <T> T getOptionValue(org.graalvm.options.OptionKey<T> key)
public final boolean compile(boolean lastTierCompilation)
true if the call target was already compiled or was compiled
synchronously. Returns false if compilation was not scheduled or is happening in
the background. Use OptimizedCallTarget.isSubmittedForCompilation() to find out whether it is submitted
for compilation.public final boolean maybeWaitForTask(CompilationTask task)
public final boolean needsCompile(boolean isLastTierCompilation)
public final boolean isSubmittedForCompilation()
public final void waitForCompilation()
public abstract long getCodeAddress()
public abstract boolean isValid()
public abstract boolean isValidLastTier()
public final boolean invalidate(CharSequence reason)
reason - a textual description of the reason why the machine code was invalidated. May
be null.false only if both are guaranteed to not have happened,
true otherwise.public SpeculationLog getSpeculationLog()
public final JavaConstant asJavaConstant()
CompilableTruffleASTasJavaConstant in interface CompilableTruffleASTpublic final boolean isSameOrSplit(CompilableTruffleAST ast)
isSameOrSplit in interface CompilableTruffleASTast - the ast to compare topublic boolean cancelCompilation(CharSequence reason)
CompilableTruffleASTcancelCompilation in interface CompilableTruffleASTpublic final boolean computeBlockCompilations()
BlockNode APIs. If no block node is used in the AST
or block node compilation is disabled then this method always returns false.public final boolean onInvalidate(Object source, CharSequence reason, boolean wasActive)
public final void onCompilationFailed(Supplier<String> serializedException, boolean silent, boolean bailout, boolean permanentBailout, boolean graphTooBig)
CompilableTruffleASTonCompilationFailed in interface CompilableTruffleASTserializedException - serializedException a serialized representation of the exception
representing the reason for compilation failure. See
CompilableTruffleAST.serializeException(Throwable).silent - specifies whether the failure was suppressed and should be silent. Use the
TruffleCompilerRuntime.isSuppressedFailure(CompilableTruffleAST, Supplier)
to determine if the failure should be suppressed.bailout - specifies whether the failure was a bailout or an error in the compiler. A
bailout means the compiler aborted the compilation based on some of property of
the AST (e.g., too big). A non-bailout means an unexpected error in the compiler
itself.permanentBailout - specifies if a bailout is due to a condition that probably won't
change if this AST is compiled again. This value is meaningless if
bailout == false.graphTooBig - graph was too bigpublic final void log(String message)
public final int getKnownCallSiteCount()
getKnownCallSiteCount in interface CompilableTruffleASTpublic final OptimizedCallTarget getSourceCallTarget()
public final String getName()
CompilableTruffleASTgetName in interface CompilableTruffleASTpublic static com.oracle.truffle.api.frame.VirtualFrame createFrame(com.oracle.truffle.api.frame.FrameDescriptor descriptor,
Object[] args)
public final boolean nodeReplaced(com.oracle.truffle.api.nodes.Node oldNode,
com.oracle.truffle.api.nodes.Node newNode,
CharSequence reason)
nodeReplaced in interface com.oracle.truffle.api.ReplaceObserverpublic final void accept(com.oracle.truffle.api.nodes.NodeVisitor visitor)
public final int getNonTrivialNodeCount()
CompilableTruffleASTgetNonTrivialNodeCount in interface CompilableTruffleASTpublic final int getCallCount()
CompilableTruffleASTgetCallCount in interface CompilableTruffleASTpublic final int getCallAndLoopCount()
public final long getInitializedTimestamp()
public static int calculateNonTrivialNodes(com.oracle.truffle.api.nodes.Node node)
public final TruffleCallNode[] getCallNodes()
CompilableTruffleASTgetCallNodes in interface CompilableTruffleASTpublic final void profileArguments(Object[] args)
protected final OptimizedCallTarget.ArgumentsProfile getInitializedArgumentsProfile()
protected final OptimizedCallTarget.ReturnProfile getInitializedReturnProfile()
public final boolean isSourceCallTarget()
public final boolean isSplit()
public final OptimizedDirectCallNode getCallSiteForSplit()
public final boolean isSingleCaller()
public final OptimizedDirectCallNode getSingleCallNode()
public final void resetNeedsSplit()
public final boolean prepareForAOT()