Hi Jaromir,

On Nov 15, 2023, at 2:42 PM, Jaromir Matas <mail@jaromir.net> wrote:


Hi Eliot, Christoph, All,

It's known the following example crashes the VM. Is this an intended behavior or a "tolerated bug"? 

`[[^ 1] on: BlockCannotReturn do: #resume] fork`

It’s the first I’ve heard of it :-) but I’ve not bern keeping up with things recently.


I understand why it crashes: the non-local return has nowhere to return to and so resuming the computation leads to a crash.

Ah, that makes sense.  When I run in the C level debugger (lldb) I see this:

Process 15040 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
    frame #0: 0x0000000115f76124
->  0x115f76124: int3
    0x115f76125: int3
    0x115f76126: int3
    0x115f76127: int3
Target 0: (Squeak) stopped.
(lldb) print whereis(0x115f76124)
error: use of undeclared identifier 'whereis'
(lldb) print whereIs(0x115f76124)
(char *) $0 = 0x0000000100266381 " is in generated methods"
(lldb) call printCogMethodFor((void *)0x115f76124)
     0x115f76090 <->      0x115f76130: method:      0x1482dc0f0 [full] selector:      0x1488898e0 (nil: DoIt)

which is consistent with the block method continuing past its last instruction into the traps the JIT places after the last instruction and before the method map (bytes at the end of a JITted method that point to interesting points in the machine code).

I’ll run it under the vm simulator to get a clearer idea of what’s going on.  But not right now; it’s the middle of the night for me.  More later, then.

But why not raise another BCR exception to prevent the crash? Potential infinite loop? Perhaps I'm just missing the purpose of this behavior...

Thanks for an explanation.

Best,
Jaromir

--

Jaromir Matas


_,,,^..^,,,_ (phone)