Interface OptimizedTruffleRuntimeListener

All Known Implementing Classes:
AbstractGraalTruffleRuntimeListener, JFRListener, StatisticsListener, TraceASTCompilationListener, TraceCompilationListener, TraceCompilationPolymorphismListener, TraceSplittingListener

public interface OptimizedTruffleRuntimeListener
A listener for events related to the execution and compilation phases of a OptimizedCallTarget. The states for a OptimizedCallTarget instance can be described using the following deterministic automata: *
( (split | (queue . unqueue))*
   . queue . started
   . (truffleTierFinished . graalTierFinished . success)
     | ([truffleTierFinished] . [graalTierFinished] . failed)
   . invalidate )*

Note: | is the 'or' and . is the sequential operator. The * represents the Kleene Closure.

  • Method Details

    • onCompilationSplit

      default void onCompilationSplit(OptimizedDirectCallNode callNode)
      Notifies this object when the target of a Truffle call node is cloned.
      Parameters:
      callNode - the call node whose target has just been cloned
    • onCompilationSplitFailed

      default void onCompilationSplitFailed(OptimizedDirectCallNode callNode, CharSequence reason)
      Notifies this object when the target of a Truffle call node should be split but, for given reason, could not be.
      Parameters:
      callNode - the call node whose where splitting could not occur.
      reason - why splitting of this node could not occur
    • onCompilationQueued

      default void onCompilationQueued(OptimizedCallTarget target, int tier)
      Notifies this object after target is added to the compilation queue.
      Parameters:
      target - the call target that has just been enqueued for compilation
      tier - Which compilation tier is in question.
    • onCompilationDequeued

      default void onCompilationDequeued(OptimizedCallTarget target, Object source, CharSequence reason, int tier)
      Notifies this object after target is removed from the compilation queue.
      Parameters:
      target - the call target that has just been removed from the compilation queue
      source - the source object that caused the compilation to be unqueued. For example the source Node object. May be null.
      reason - a textual description of the reason why the compilation was unqueued. May be null.
      tier - Which compilation tier is in question.
    • onCompilationStarted

      @Deprecated(since="21.0") default void onCompilationStarted(OptimizedCallTarget target, int tier)
      Parameters:
      target - the call target about to be compiled
      tier - Which compilation tier is in question.
    • onCompilationStarted

      @Deprecated(since="23.0") default void onCompilationStarted(OptimizedCallTarget target, com.oracle.truffle.compiler.TruffleCompilationTask task)
      Notifies this object when compilation of target is about to start.
      Parameters:
      target - the call target about to be compiled
      task - which compilation task is in question.
    • onCompilationStarted

      default void onCompilationStarted(OptimizedCallTarget target, AbstractCompilationTask task)
      Notifies this object when compilation of target is about to start.
      Parameters:
      target - the call target about to be compiled
      task - which compilation task is in question.
    • onCompilationTruffleTierFinished

      @Deprecated default void onCompilationTruffleTierFinished(OptimizedCallTarget target, TruffleInlining inliningDecision, com.oracle.truffle.compiler.TruffleCompilerListener.GraphInfo graph)
      Notifies this object when compilation of target has completed partial evaluation and is about to perform compilation of the graph produced by partial evaluation.
      Parameters:
      target - the call target being compiled
      inliningDecision - the inlining plan used during partial evaluation
      graph - access to compiler graph info
    • onCompilationTruffleTierFinished

      default void onCompilationTruffleTierFinished(OptimizedCallTarget target, AbstractCompilationTask task, com.oracle.truffle.compiler.TruffleCompilerListener.GraphInfo graph)
      Notifies this object when compilation of target has completed partial evaluation and is about to perform compilation of the graph produced by partial evaluation.
      Parameters:
      target - the call target being compiled
      task - the compilation task
      graph - access to compiler graph info
    • onCompilationGraalTierFinished

      default void onCompilationGraalTierFinished(OptimizedCallTarget target, com.oracle.truffle.compiler.TruffleCompilerListener.GraphInfo graph)
      Notifies this object when Graal compilation of a call target completes. Graal compilation occurs between onCompilationTruffleTierFinished(OptimizedCallTarget, TruffleInlining, TruffleCompilerListener.GraphInfo) and code installation.
      Parameters:
      target - the call target that was compiled
      graph - the graph representing target
    • onCompilationSuccess

      @Deprecated(since="21.0") default void onCompilationSuccess(OptimizedCallTarget target, TruffleInlining inliningDecision, com.oracle.truffle.compiler.TruffleCompilerListener.GraphInfo graph, com.oracle.truffle.compiler.TruffleCompilerListener.CompilationResultInfo result)
    • onCompilationSuccess

      @Deprecated(since="23.0") default void onCompilationSuccess(OptimizedCallTarget target, TruffleInlining inliningDecision, com.oracle.truffle.compiler.TruffleCompilerListener.GraphInfo graph, com.oracle.truffle.compiler.TruffleCompilerListener.CompilationResultInfo result, int tier)
    • onCompilationSuccess

      default void onCompilationSuccess(OptimizedCallTarget target, AbstractCompilationTask task, com.oracle.truffle.compiler.TruffleCompilerListener.GraphInfo graph, com.oracle.truffle.compiler.TruffleCompilerListener.CompilationResultInfo result)
      Notifies this object when compilation of target succeeds.
      Parameters:
      target - the call target whose compilation succeeded
      task - the task
      graph - access to compiler graph info
      result - access to compilation result info
    • onCompilationFailed

      @Deprecated(since="21.0") default void onCompilationFailed(OptimizedCallTarget target, String reason, boolean bailout, boolean permanentBailout)
    • onCompilationFailed

      @Deprecated default void onCompilationFailed(OptimizedCallTarget target, String reason, boolean bailout, boolean permanentBailout, int tier)
      Notifies this object when compilation of target fails.
      Parameters:
      target - the call target whose compilation failed
      reason - a description of the failure
      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 target (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 the target is compiled again. This value is meaningless if bailout == false.
      tier - Which compilation tier is in question.
    • onCompilationFailed

      default void onCompilationFailed(OptimizedCallTarget target, String reason, boolean bailout, boolean permanentBailout, int tier, Supplier<String> lazyStackTrace)
      Notifies this object when compilation of target fails.
      Parameters:
      target - the call target whose compilation failed
      reason - a description of the failure
      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 target (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 the target is compiled again. This value is meaningless if bailout == false.
      tier - Which compilation tier is in question.
      lazyStackTrace - a serialized representation of the exception indicating the reason and stack trace for a compilation failure, or null in the case of a bailout or when the compiler does not provide a stack trace. See TruffleCompilable.serializeException(Throwable).
    • onCompilationInvalidated

      default void onCompilationInvalidated(OptimizedCallTarget target, Object source, CharSequence reason)
      Notifies this object when target is invalidated.
      Parameters:
      target - the call target whose compiled code was just invalidated
      source - the source object that caused the compilation to be invalidated. For example the source Node object. May be null.
      reason - a textual description of the reason why the compilation was invalidated. May be null.
    • onCompilationDeoptimized

      @Deprecated(since="26.0") default void onCompilationDeoptimized(OptimizedCallTarget target, com.oracle.truffle.api.frame.Frame frame)
      Deprecated.
      Notifies this object when target has just deoptimized and is now executing in the Truffle interpreter instead of executing compiled code.
      Parameters:
      target - the call target whose compiled code was just deoptimized
      frame -
    • onCompilationDeoptimized

      default void onCompilationDeoptimized(OptimizedCallTarget target, com.oracle.truffle.api.frame.Frame frame, String reason)
      Notifies this object when target has just deoptimized and is now executing in the Truffle interpreter instead of executing compiled code.
      Parameters:
      target - the call target whose compiled code was just deoptimized
      frame -
      reason - optional reason why the deoptimization happened.
    • onProfileReset

      default void onProfileReset(OptimizedCallTarget target)
      Notifies this object when target has its execution profile reset.
      Parameters:
      target - the call target whose profile was just reset.
    • onShutdown

      default void onShutdown()
      Notifies this object the OptimizedTruffleRuntime is being shut down.
    • onEngineClosed

      default void onEngineClosed(EngineData runtimeData)
      Notifies this object an engine using the OptimizedTruffleRuntime was closed.
      Parameters:
      runtimeData - the engine's compiler configuration
    • addASTSizeProperty

      static void addASTSizeProperty(OptimizedCallTarget target, Map<String,Object> properties)
    • isPermanentFailure

      static boolean isPermanentFailure(boolean bailout, boolean permanentBailout)
      Determines if a failure is permanent.