Interface AllocationListener
public interface AllocationListener
Listener to be notified about guest language value allocations. Calls to this listener are
initiated by
AllocationReporter
.
Use
Instrumenter.attachAllocationListener(com.oracle.truffle.api.instrumentation.AllocationEventFilter, com.oracle.truffle.api.instrumentation.AllocationListener)
to register an implementation of this listener. Use EventBinding.dispose()
to unregister.
The listener gets called before
the actual allocation and right
after
it. The
calls to these methods are always in pairs, unless the programs crashes in between. Nested
allocations are supported, several calls to onEnter
prior every sub-value allocation
can be followed by the appropriate number of onReturnValue
calls after the
sub-values are allocated, in the opposite order.
- Since:
- 0.27
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onEnter
(AllocationEvent event) Notifies about an intent to allocate or re-allocate a guest language value.void
onReturnValue
(AllocationEvent event) Notifies about an allocated guest language value.
-
Method Details
-
onEnter
Notifies about an intent to allocate or re-allocate a guest language value. This method is called prior to the actual allocation and is followed by a call toonReturnValue(com.oracle.truffle.api.instrumentation.AllocationEvent)
after the successful allocation.- Parameters:
event
- the event describing the intended allocation- Since:
- 0.27
-
onReturnValue
Notifies about an allocated guest language value. This method is called after a precedingonEnter(com.oracle.truffle.api.instrumentation.AllocationEvent)
call and right after the allocation is performed. WhenonEnter
provided a non-null
value in the event, it was re-allocated and the same value instance is in this event.- Parameters:
event
- the event describing the finished allocation- Since:
- 0.27
-