diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2022-12-01 23:00:33 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-01 23:00:33 +1300 |
commit | 0436f1e15a8e79ffef5ea412ac1312cbf9f063e6 (patch) | |
tree | 456611e5ae13d2c1312a61532ab7a79d642564b6 /vm.c | |
parent | 9869bd1d612b489df806cf95bcb56965a02424e0 (diff) |
Introduce `Fiber#storage` for inheritable fiber-scoped variables. (#6612)
Notes
Notes:
Merged-By: ioquatix <samuel@codeotaku.com>
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -3047,7 +3047,7 @@ vm_init2(rb_vm_t *vm) } void -rb_execution_context_update(const rb_execution_context_t *ec) +rb_execution_context_update(rb_execution_context_t *ec) { /* update VM stack */ if (ec->vm_stack) { @@ -3087,6 +3087,8 @@ rb_execution_context_update(const rb_execution_context_t *ec) cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp); } } + + ec->storage = rb_gc_location(ec->storage); } static enum rb_id_table_iterator_result @@ -3154,6 +3156,8 @@ rb_execution_context_mark(const rb_execution_context_t *ec) RUBY_MARK_UNLESS_NULL(ec->local_storage_recursive_hash); RUBY_MARK_UNLESS_NULL(ec->local_storage_recursive_hash_for_trace); RUBY_MARK_UNLESS_NULL(ec->private_const_reference); + + RUBY_MARK_MOVABLE_UNLESS_NULL(ec->storage); } void rb_fiber_mark_self(rb_fiber_t *fib); @@ -3344,6 +3348,8 @@ th_init(rb_thread_t *th, VALUE self, rb_vm_t *vm) th->ec->local_storage_recursive_hash = Qnil; th->ec->local_storage_recursive_hash_for_trace = Qnil; + th->ec->storage = Qnil; + #if OPT_CALL_THREADED_CODE th->retval = Qundef; #endif |