Stream: cranelift

Topic: getting started with traps


view this post on Zulip Nathan Ringo (Dec 19 2020 at 04:02):

I'm trying out cranelift for the first time for a JIT, and I'm unclear on how traps are meant to be used. I did fb.ins().resumable_trap(TrapCode::User(0x51f1));, but the generated assembly appears to only contain a ud2, with no reference to 0x51f1. I'm using a NullTrapSink right now; it would make sense if I needed to implement a TrapSink, but that doesn't appear to answer resumableness.

view this post on Zulip bjorn3 (Dec 19 2020 at 21:40):

The trap code is only written to the trap sink. If yoy need it, you must store it somewhere. You can resume from the trap by returning from the SIGILL signal handler and resuming execution at the next instructiin.


Last updated: Oct 23 2024 at 20:03 UTC