Interface ExecutionEventListener
public interface ExecutionEventListener
A listener attached by an
Instrumenter to specific locations of a guest language program
to listen to execution events.- Since:
- 0.12
-
Method Summary
Modifier and TypeMethodDescriptionvoidonEnter(EventContext context, VirtualFrame frame) Invoked immediately before theinstrumented nodeis executed.default voidonInputValue(EventContext context, VirtualFrame frame, EventContext inputContext, int inputIndex, Object inputValue) Deprecated.in 20.0.default voidonResume(EventContext context, VirtualFrame frame) Invoked on a resume of the execution on the current thread after ayield.voidonReturnExceptional(EventContext context, VirtualFrame frame, Throwable exception) Invoked immediately after aninstrumented nodedid not successfully execute.voidonReturnValue(EventContext context, VirtualFrame frame, Object result) Invoked immediately after aninstrumented nodeis successfully executed.default ObjectonUnwind(EventContext context, VirtualFrame frame, Object info) Invoked when aninstrumented nodeis unwound from the execution stack byunwind throwablethrown in this listener instance.default voidonYield(EventContext context, VirtualFrame frame, Object value) Invoked on a yield of the current thread.
-
Method Details
-
onEnter
Invoked immediately before theinstrumented nodeis executed. The order in which multiple event listeners are notified matches the order they areattached.- Parameters:
context- indicating the current location in the guest language ASTframe- the frame that was used for executing instrumented node- Since:
- 0.12
-
onInputValue
@Deprecated(since="20.0") default void onInputValue(EventContext context, VirtualFrame frame, EventContext inputContext, int inputIndex, Object inputValue) Deprecated.in 20.0. input value notifications are not functional forlisteners. Useevent node factoriesinstead.Invoked immediately after each return value event of child nodes that match theinput filter. Event listeners cannot save input values for later events. If that is required attach an event node factory instead.- Parameters:
context- indicating the current location in the guest language ASTframe- the current frame in useinputContext- the event context of the input child nodeinputIndex- the child index of the inputinputValue- the return value of the input child- Since:
- 0.30
-
onReturnValue
Invoked immediately after aninstrumented nodeis successfully executed. The order in which multiple event listeners are notified matches the order they areattached.- Parameters:
context- indicating the current location in the guest language ASTframe- the frame that was used for executing instrumented node- Since:
- 0.12
-
onReturnExceptional
Invoked immediately after aninstrumented nodedid not successfully execute. The order in which multiple event listeners are notified matches the order they areattached.When the
exceptionis an instance ofThreadDeaththe execution was abruptly interrupted.EventContext.createUnwind(Object)creates aThreadDeathto unwind nodes off, for instance. Listener instances that threw an unwind throwable get calledonUnwind(EventContext, VirtualFrame, Object)instead.- Parameters:
context- indicating the current location in the guest language ASTframe- the frame that was used for executing instrumented nodeexception- the exception that occurred during the node's execution- Since:
- 0.12
-
onUnwind
Invoked when aninstrumented nodeis unwound from the execution stack byunwind throwablethrown in this listener instance. Any nodes between the instrumented ones are unwound off without any notification. The default implementation returnsnull.- Parameters:
context- indicating the current location in the guest language ASTframe- the frame that was used for executing instrumented nodeinfo- an info associated with the unwind - the object passed toEventContext.createUnwind(Object)- Returns:
nullto continue to unwind the parent node,ProbeNode.UNWIND_ACTION_REENTERto reenter the current node, or an interop value to return that value early from the current node (void nodes just return, ignoring the return value).- Since:
- 0.31
-
onYield
Invoked on a yield of the current thread. A yield interrupts the current execution, which isresumedlater on. Delegates toonReturnValue(EventContext, VirtualFrame, Object)by default.- Parameters:
context- indicating the current location in the guest language ASTframe- the frame that was used for executing instrumented node- Since:
- 24.0
-
onResume
Invoked on a resume of the execution on the current thread after ayield. Delegates toonEnter(EventContext, VirtualFrame)by default.Use
TruffleInstrument.Env.isSameFrame(RootNode, Frame, Frame)to match the interrupted and resumed execution.- Parameters:
context- indicating the current location in the guest language ASTframe- the frame that was used for executing instrumented node- Since:
- 24.0
-