Allow objects on Ruby stack to be GC movable

Objects on the Ruby stack can be GC movable and there is corresponding
code in rb_execution_context_update to update references for moved objects.
This commit is contained in:
Peter Zhu 2026-01-19 19:26:47 -05:00
parent 631a5076da
commit e24b52885f
Notes: git 2026-01-20 23:01:51 +00:00

5
vm.c
View File

@ -3682,8 +3682,9 @@ rb_execution_context_mark(const rb_execution_context_t *ec)
rb_control_frame_t *cfp = ec->cfp;
rb_control_frame_t *limit_cfp = (void *)(ec->vm_stack + ec->vm_stack_size);
VM_ASSERT(sp == ec->cfp->sp);
rb_gc_mark_vm_stack_values((long)(sp - p), p);
for (long i = 0; i < (long)(sp - p); i++) {
rb_gc_mark_movable(p[i]);
}
while (cfp != limit_cfp) {
const VALUE *ep = cfp->ep;