Stack Reifier
The level two execution machinery allows limited use of the Java stack during ordinary execution, but when exceptional conditions arise, the Java stack is unwound with a StackReifier and converted into level one continuations. This happens when the stack gets too deep, when tricky code like exceptions and backtracking happen, or when running a suspending primitive, including to add or remove methods.
Author
Mark van Gulik
Parameters
Whether to reify the Java frames (rather than simply drop them).
The Statistic under which to record this reification once it completes. The timing of this event spans from this creation until just before the postReificationAction action runs.
The action to perform after the Java stack has been fully reified.
Constructors
Construct a new StackReifier.
Types
Functions
Answer whether this StackReifier should cause reification (rather than just clearing the Java stack).
Push an action on the actionStack. These will be executed in reverse order, after the Java call stack has been emptied.
Push an action on the reifier's stack of actions. The action should run after previously run (but subsequently pushed) actions have had a chance to set up a caller's reified state. Take the supplied dummy continuation and push it on the reified stack, then run it. The run must complete normally – i.e., it must not trigger more reifications, or try to fall back to the default chunk.
Record the fact that a reification has completed. The specific Statistic under which to record it was provided to the constructor.
Run the actions in reverse order to populate the Interpreter.getReifiedContinuation stack.
Properties
A lambda that should be executed once the Interpreter's stack has been fully reified. For example, this might set up a function/chunk/offset in the interpreter. The interpreter will then determine if it should continue running.
The System.nanoTime when this stack reifier was created.