diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-11-01 09:56:40 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-11-02 01:37:28 +0900 |
commit | db7a3b63bae810a03b19b5577ded1403bb789185 (patch) | |
tree | 5efad43996a01a76faec208d7d3d36fe0dee2ef0 /variable.c | |
parent | 963359a7622fb064331504a29a8bf65283d25551 (diff) |
suppport Ractor.send(move: true) for more deta
This patch allows to move more data types.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3727
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/variable.c b/variable.c index 950eac0722..c231ab9725 100644 --- a/variable.c +++ b/variable.c @@ -1671,6 +1671,27 @@ rb_copy_generic_ivar(VALUE clone, VALUE obj) } void +rb_replace_generic_ivar(VALUE clone, VALUE obj) +{ + RUBY_ASSERT(FL_TEST(obj, FL_EXIVAR)); + + RB_VM_LOCK_ENTER(); + { + struct gen_ivtbl **ivtbl; + if (st_lookup(generic_iv_tbl_, (st_data_t)obj, (st_data_t *)&ivtbl)) { + st_insert(generic_iv_tbl_, (st_data_t)clone, (st_data_t)ivtbl); + st_delete(generic_iv_tbl_, (st_data_t *)&obj, NULL); + } + else { + rb_bug("unreachable"); + } + } + RB_VM_LOCK_LEAVE(); + + FL_SET(clone, FL_EXIVAR); +} + +void rb_ivar_foreach(VALUE obj, rb_ivar_foreach_callback_func *func, st_data_t arg) { if (SPECIAL_CONST_P(obj)) return; |