Add a stack structure that can allow us to re-use stack frames. There's lots of different stratergies but I'm partial to a spagetti stack that makes use of the GC to clean up frames. Something like.
Adding a new frame uses a bump-pointer allocation (just like a regular stack frame).
Capturing marks the frame as captured (mark parents?!)
Returning "pops" the frame only if it is topmost AND not captured.
The GC cleans and compacts the stack, removing captured-but-not-referenced frames.
If stack frames are not captured, that is this is this part of the program isn't making use of continuations or similar features, or only captures them but never replays them. Then the AM should work as near as possible to native execution, especially with regard to something like the x86 shadow stack.
Add a stack structure that can allow us to re-use stack frames. There's lots of different stratergies but I'm partial to a spagetti stack that makes use of the GC to clean up frames. Something like.
If stack frames are not captured, that is this is this part of the program isn't making use of continuations or similar features, or only captures them but never replays them. Then the AM should work as near as possible to native execution, especially with regard to something like the x86 shadow stack.