#1303: GC does not actively work with RubySpec after "core/gc". ----------------------------------+----------------------------------------- Reporter: watson1978@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by watson1978@…): I think MacRuby needs some GC_WB. {{{ #!diff diff --git a/dispatcher.cpp b/dispatcher.cpp index b04f1e8..7fbbb22 100644 --- a/dispatcher.cpp +++ b/dispatcher.cpp @@ -1084,7 +1084,7 @@ dup_block(rb_vm_block_t *src_b) while (src_l != NULL) { GC_WB(new_l, xmalloc(sizeof(rb_vm_local_t))); (*new_l)->name = src_l->name; - (*new_l)->value = src_l->value; + GC_WB(&(*new_l)->value, src_l->value); new_l = &(*new_l)->next; src_l = src_l->next; @@ -1318,7 +1318,7 @@ rb_vm_yield_under(VALUE klass, VALUE self, int argc, const VALUE *argv) vm->pop_current_block(); VALUE old_self = b->self; - b->self = self; + GC_WB(&b->self, self); VALUE old_class = b->klass; b->klass = klass; GC_WB(&b->outer, vm->create_outer((Class)klass, b->outer, true)); @@ -1337,7 +1337,7 @@ rb_vm_yield_under(VALUE klass, VALUE self, int argc, const VALUE *argv) } ~Finally() { GC_WB(&b->outer, b->outer->outer); - b->self = old_self; + GC_WB(&b->self, old_self); b->klass = old_class; vm->add_current_block(b); } @@ -1418,13 +1418,13 @@ rb_vm_prepare_block(void *function, int flags, VALUE self, rb_vm_arity_t arity, GET_CORE()->unlock(); #endif } - b->userdata = (VALUE)function; + GC_WB(&b->userdata, (VALUE)function); } b->arity = arity; b->flags = flags; b->dvars_size = dvars_size; b->parent_var_uses = NULL; - b->parent_block = NULL; + GC_WB(&b->parent_block, NULL); } else { assert(b->dvars_size == dvars_size); @@ -1456,7 +1456,7 @@ rb_vm_prepare_block(void *function, int flags, VALUE self, rb_vm_arity_t arity, for (int i = 0; i < lvars_size; ++i) { assert(l != NULL); l->name = va_arg(ar, ID); - l->value = va_arg(ar, VALUE *); + GC_WB(&l->value, va_arg(ar, VALUE *)); l = l->next; } } diff --git a/vm.cpp b/vm.cpp index ffcb22d..3a64a82 100644 --- a/vm.cpp +++ b/vm.cpp @@ -3332,7 +3332,7 @@ rb_vm_keep_vars(rb_vm_var_uses *uses, int lvars_size, ...) } // the parent pointers can't be used anymore - block->parent_block = NULL; + GC_WB(&block->parent_block, NULL); block->parent_var_uses = NULL; locals_to_replace = block->locals; @@ -3363,7 +3363,7 @@ push_local(rb_vm_local_t **l, ID name, VALUE *value) { GC_WB(l, xmalloc(sizeof(rb_vm_local_t))); (*l)->name = name; - (*l)->value = value; + GC_WB(&(*l)->value, value); (*l)->next = NULL; return &(*l)->next; } @@ -3498,7 +3498,7 @@ rb_vm_create_block_from_method(rb_vm_method_t *method) b->flags = VM_BLOCK_PROC | VM_BLOCK_METHOD; b->locals = NULL; b->parent_var_uses = NULL; - b->parent_block = NULL; + GC_WB(&b->parent_block, NULL); b->dvars_size = 0; return b; }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1303#comment:1> MacRuby <http://macruby.org/>