Attached is a proof-of-concept implementation and demonstration code for
returning from an arbitrary (full-call) stack frame on x86.
This implementation is likely to be somewhat fragile, and has a couple known
1. It may leak alien-stack space if it throws through a with-alien form
that contains a variable with :local allocation which ends up on the stack.
2. It doesn't clean up the catch block chain. If it throws through a catch
form, things will probably start breaking. And not immediately, but when it
comes time to throw to a catch in an outer scope.
I'm not entirely sure what to do about the first, but the second should be
fairly straightforward to fix. Just do the same thing as find-enclosing-uwp
only with catch blocks, and then stomp the head of the chain. Could even be
done before calling frame-return.
Porting this to other platforms may be possible, depending on how much
dynamic state can be recovered.
I'd like to thank beach for pointing me in this direction in the first
place, and Xof for helping me figure out how to unbox a SAP.