зеркало из https://github.com/github/ruby.git
Make the value shareable deeply
This commit is contained in:
Родитель
070a990bcb
Коммит
11d9983bc3
|
@ -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
|
||||
|
|
2
vm.c
2
vm.c
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче