diff options
| author | John Hawthorn <john@hawthorn.email> | 2025-12-17 20:21:17 -0800 |
|---|---|---|
| committer | John Hawthorn <john@hawthorn.email> | 2025-12-18 11:03:23 -0800 |
| commit | 28c2a5b2a4db5ed6faa7cf3d71baf2765a277184 (patch) | |
| tree | f19596d45b2dc4db064dee7f805e28b3339db726 /spec/ruby/core/array | |
| parent | 74bfb1606d09672a37105c138edf8e0d8acbb5c1 (diff) | |
Fix env debug assertion failure w/ Ractors+JITs
Previously when using a JIT and Ractors at the same time with debug
assertions turned on this could rarely fail with:
vm_core.h:1448: Assertion Failed: VM_ENV_FLAGS:FIXNUM_P(flags)
When using Ractors, any time the VM lock is acquired, that may join a
barrier as another Ractor initiates GC. This could be made to happen
reliably by replacing the invalidation with a call to rb_gc().
This assertion failure happens because
VM_STACK_ENV_WRITE(ep, 0, (VALUE)env);
Is setting VM_ENV_DATA_INDEX_FLAGS to the environment, which is not a
valid set of flags (it should be a fixnum). Although we update cfp->ep,
rb_execution_context_mark will also mark the PREV_EP, and until the
recursive calls to vm_make_env_each all finish the "next" ep may still
be pointing to the stack env we've just escaped.
I'm not completely sure why we need to store this on the stack - why is
setting cfp->ep not enough? I'm also not sure why
rb_execution_context_mark needs to mark the prev_ep.
Diffstat (limited to 'spec/ruby/core/array')
0 files changed, 0 insertions, 0 deletions
