I'm about to do exceptions, and as such I wanted to give a quick warning to everyone who does Odd Things. (Which would be in the JIT, mainly :)

Because of the way exceptions are going to work, we need to make sure that the code emitted for each individual opcode is self-contained, relative to the system stack. That is to say, when an opcode is done it can't leave any cruft on the system stack, and it shouldn't expect there to be any information on the system stack.

The exception system's going to be based on setjmp/longjmp[*], with a setjmp done just before entering the runloop, and longjmps done when an exception is thrown. The low-level exception handler will then unwind the interpreter stacks until it finds an exception handler, at which point it'll enter the runloop at the point the exception handler dictates. (The point that the parrot-level exception system noted that it was supposed to resume at)

This'll generally mean that the system stack'll be pretty mushed, and the runloop code won't have any guarantees as to what's on the stack, but execution must continue properly from that point on. So recursive calls to parrot functions can't recursively use the system stack or anything, as that'll get unwound by the low-level exception scheme and Bad Things Will Happen. And we wouldn't want that...

[*] Well, their signal-safe equivalents at least
--
Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk

Reply via email to