[Vm-dev] questions about a couple of primitives

tim Rowledge tim at rowledge.org
Mon Aug 31 20:52:10 UTC 2020

> On 2020-08-31, at 12:42 PM, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> Ah, this is a neat hack.  The primitive numbers are not actually primitives,  These primitives always fail, and the blocks are evaluated with the valueNoContextSwitch send in the method body.  Instead the primitive numbers are used by the VM to mark the activations of ensure: and ifCurtailed: as unwind-protect frames.  This was one of Andreas' neatest hacks (am I right in thinking this was Andreas Raab's scheme?), in that he added unwind-protect without needing e.g. another status bit in the CompiledMethod header.  He could just use the primitive number that was already there.

The exception handling was added between 2.3 & 2.6 back in 1999. The TFEI guys did a large chunk of it, I'm just about certain Craig came up with the #valueUninterruptably cleverness to make it work on VMs without  direct support, I did the original VM support and using the 'fake' prim was probably the result of some discussions on how to tag contexts easily  between a bunch of us.

tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: XER: Exclusive ERror

More information about the Vm-dev mailing list