ruby-changes:64157
From: Nobuyoshi <ko1@a...>
Date: Mon, 14 Dec 2020 19:29:53 +0900 (JST)
Subject: [ruby-changes:64157] 11d9983bc3 (master): Make the value shareable deeply
https://git.ruby-lang.org/ruby.git/commit/?id=11d9983bc3 From 11d9983bc340f3cc05da3a87d5d0c63f4f6bd899 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 21 Oct 2020 14:11:18 +0900 Subject: Make the value shareable deeply diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index f12b610..a9ab4c4 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -1181,20 +1181,24 @@ x = __ENCODING__ https://github.com/ruby/ruby/blob/trunk/test/ruby/test_parse.rb#L1181 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 diff --git a/vm.c b/vm.c index 8ced733..bc57caf 100644 --- a/vm.c +++ b/vm.c @@ -3179,7 +3179,7 @@ m_core_hash_merge_kwd(VALUE recv, VALUE hash, VALUE kw) https://github.com/ruby/ruby/blob/trunk/vm.c#L3179 static VALUE m_core_make_shareable(VALUE recv, VALUE obj) { - return rb_obj_freeze(obj); + return rb_ractor_make_shareable(obj); } static VALUE -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/