summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2020-05-12 12:00:35 -0700
committerAaron Patterson <tenderlove@ruby-lang.org>2020-05-18 16:57:10 -0700
commit6efb9fe04229c9e96205025bfd8b6cfec1b9a30f (patch)
tree86708733d3faba07dab1fcc10baf29bf5589c608 /vm.c
parent9ee66d2bef4a32b5b9880a5226f3fbeb7fde5884 (diff)
Allow references stored in the VM stack to move
We can update these references too, so lets allow them to move.
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/vm.c b/vm.c
index d286bc7..e627148 100644
--- a/vm.c
+++ b/vm.c
@@ -2488,11 +2488,21 @@ rb_execution_context_update(const rb_execution_context_t *ec)
{
/* update VM stack */
if (ec->vm_stack) {
+ long i;
VM_ASSERT(ec->cfp);
-
+ VALUE *p = ec->vm_stack;
+ VALUE *sp = ec->cfp->sp;
rb_control_frame_t *cfp = ec->cfp;
rb_control_frame_t *limit_cfp = (void *)(ec->vm_stack + ec->vm_stack_size);
+ for (i = 0; i < (long)(sp - p); i++) {
+ VALUE ref = p[i];
+ VALUE update = rb_gc_location(ref);
+ if (ref != update) {
+ p[i] = update;
+ }
+ }
+
while (cfp != limit_cfp) {
const VALUE *ep = cfp->ep;
cfp->self = rb_gc_location(cfp->self);