diff options
author | Lourens Naudé <lourens@bearmetal.eu> | 2020-01-04 00:45:58 +0000 |
---|---|---|
committer | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2020-01-11 14:40:36 +1300 |
commit | 40c57ad4a13898760b81a99dac181e5bf61afe47 (patch) | |
tree | 346d0d3976425a6211bfc8e1e5ece4a0411de730 /vm.c | |
parent | b53d8230f1fed0f99a8a852d853bbd9b5c353fed (diff) |
Let execution context local storage be an ID table
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2814
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -2501,6 +2501,13 @@ rb_execution_context_update(const rb_execution_context_t *ec) } } +static enum rb_id_table_iterator_result +mark_local_storage_i(VALUE local, void *data) +{ + rb_gc_mark(local); + return ID_TABLE_CONTINUE; +} + void rb_execution_context_mark(const rb_execution_context_t *ec) { @@ -2544,7 +2551,9 @@ rb_execution_context_mark(const rb_execution_context_t *ec) RUBY_MARK_UNLESS_NULL(ec->errinfo); RUBY_MARK_UNLESS_NULL(ec->root_svar); - rb_mark_tbl(ec->local_storage); + if (ec->local_storage) { + rb_id_table_foreach_values(ec->local_storage, mark_local_storage_i, NULL); + } 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); @@ -2639,7 +2648,7 @@ thread_memsize(const void *ptr) size += th->ec->vm_stack_size * sizeof(VALUE); } if (th->ec->local_storage) { - size += st_memsize(th->ec->local_storage); + size += rb_id_table_memsize(th->ec->local_storage); } return size; } |