-
Notifications
You must be signed in to change notification settings - Fork 357
Description
Ruby JIT poses a significant challenge to the ruby unwinder:
- We can't actually walk the native JIT stack once we hit a JIT frame
- Because of this, we will never trigger the ruby interpreter because we don't have a PC in the
rb_vm_execrange
- Because of this, we will never trigger the ruby interpreter because we don't have a PC in the
- We aren't guaranteed to be able to symbolize a JIT'd PC, as by default we don't have per maps available.
Ruby does have some optional flags that can enable perf maps and base pointers for jit, but these aren't guaranteed.
One thing we can do to enable support for jit fairly cheaply is to detect if the PC belongs to the JIT address range using the SynchronizeMapping interpreter hook, and if so, trigger the ruby interpreter in a similar way to how V8 triggers their interpreter. The way that ruby jit is implemented, the JIT'd function is expected to be the top CME on the stack, so we can just switch to the ruby unwinder once we detect a JIT PC.
I have already built support for this, as we heavily use yjit in production and the ruby interpreter is basically unusable otherwise. If #907 lands, then I can submit it subsequently: