зеркало из https://github.com/github/ruby.git
Call FrozenCore.make_shareable
This commit is contained in:
Родитель
f43c71abe0
Коммит
65450e8f7d
6
parse.y
6
parse.y
|
@ -10925,12 +10925,14 @@ mark_lvar_used(struct parser_params *p, NODE *rhs)
|
|||
}
|
||||
}
|
||||
|
||||
extern VALUE rb_mRubyVMFrozenCore;
|
||||
|
||||
static NODE *
|
||||
shareable_constant_value(struct parser_params *p, NODE *value, const YYLTYPE *loc)
|
||||
{
|
||||
if (p->ctxt.shareable_constant_value) {
|
||||
NODE *ractor = NEW_COLON3(rb_intern("Ractor"), loc);
|
||||
value = NEW_CALL(ractor, rb_intern("make_shareable"),
|
||||
NODE *fcore = NEW_LIT(rb_mRubyVMFrozenCore, loc);
|
||||
value = NEW_CALL(fcore, rb_intern("make_shareable"),
|
||||
NEW_LIST(value, loc), loc);
|
||||
}
|
||||
return value;
|
||||
|
|
|
@ -51,10 +51,6 @@ class Ractor
|
|||
}
|
||||
end
|
||||
|
||||
def self.make_shareable(obj)
|
||||
obj.freeze
|
||||
end
|
||||
|
||||
# Multiplex multiple Ractor communications.
|
||||
#
|
||||
# r, obj = Ractor.select(r1, r2)
|
||||
|
|
7
vm.c
7
vm.c
|
@ -3176,6 +3176,12 @@ m_core_hash_merge_kwd(VALUE recv, VALUE hash, VALUE kw)
|
|||
return hash;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
m_core_make_shareable(VALUE recv, VALUE obj)
|
||||
{
|
||||
return rb_obj_freeze(obj);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
core_hash_merge_kwd(VALUE hash, VALUE kw)
|
||||
{
|
||||
|
@ -3340,6 +3346,7 @@ Init_VM(void)
|
|||
rb_define_method_id(klass, id_core_raise, f_raise, -1);
|
||||
rb_define_method_id(klass, idProc, f_proc, 0);
|
||||
rb_define_method_id(klass, idLambda, f_lambda, 0);
|
||||
rb_define_method(klass, "make_shareable", m_core_make_shareable, 1);
|
||||
rb_obj_freeze(fcore);
|
||||
RBASIC_CLEAR_CLASS(klass);
|
||||
rb_obj_freeze(klass);
|
||||
|
|
Загрузка…
Ссылка в новой задаче