diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-10-21 14:11:18 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-12-14 19:19:16 +0900 |
commit | 11d9983bc340f3cc05da3a87d5d0c63f4f6bd899 (patch) | |
tree | e5e682fdfa166d09b08e8bc2b87b34793f422601 | |
parent | 070a990bcb81ed371fc60e3922f5329b1020aa44 (diff) |
Make the value shareable deeply
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3681
-rw-r--r-- | test/ruby/test_parse.rb | 8 | ||||
-rw-r--r-- | vm.c | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index f12b61019b..a9ab4c440c 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -1181,20 +1181,24 @@ x = __ENCODING__ a = Class.new.class_eval("#{<<~"begin;"}\n#{<<~'end;'}") begin; # shareable_constant_value: true - A = [] + A = [[1]] end; assert_predicate(a, :frozen?) + assert_equal([1], a[0]) + assert_predicate(a[0], :frozen?) a, b = Class.new.class_eval("#{<<~"begin;"}\n#{<<~'end;'}") begin; # shareable_constant_value: false class X # shareable_constant_value: true - A = [] + A = [[1]] end B = [] [X::A, B] end; assert_predicate(a, :frozen?) assert_not_predicate(b, :frozen?) + assert_equal([1], a[0]) + assert_predicate(a[0], :frozen?) end =begin @@ -3179,7 +3179,7 @@ m_core_hash_merge_kwd(VALUE recv, VALUE hash, VALUE kw) static VALUE m_core_make_shareable(VALUE recv, VALUE obj) { - return rb_obj_freeze(obj); + return rb_ractor_make_shareable(obj); } static VALUE |