summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-12-24 10:59:27 +0900
committerKoichi Sasada <ko1@atdot.net>2020-12-24 14:28:47 +0900
commit6f29716f9ffb710af7f344839ec67ef2b8a48ab2 (patch)
tree296e34994f4670acfe02bca27e5a4864629a5248 /vm.c
parent1e215a66d26d56befab4fbb72e1d953879411955 (diff)
shareable_constant_value: experimental_copy
"experimental_everything" makes the assigned value, it means the assignment change the state of assigned value. "experimental_copy" tries to make a deep copy and make copyied object sharable.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3989
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/vm.c b/vm.c
index a30ba9c..696cffb 100644
--- a/vm.c
+++ b/vm.c
@@ -994,9 +994,6 @@ collect_outer_variable_names(ID id, VALUE val, void *ptr)
return ID_TABLE_CONTINUE;
}
-VALUE rb_ractor_make_shareable(VALUE obj);
-VALUE rb_ractor_ensure_shareable(VALUE obj, VALUE name);
-
static const rb_env_t *
env_copy(const VALUE *src_ep, VALUE read_only_variables)
{
@@ -3182,6 +3179,12 @@ m_core_make_shareable(VALUE recv, VALUE obj)
}
static VALUE
+m_core_make_shareable_copy(VALUE recv, VALUE obj)
+{
+ return rb_ractor_make_shareable_copy(obj);
+}
+
+static VALUE
m_core_ensure_shareable(VALUE recv, VALUE obj, VALUE name)
{
return rb_ractor_ensure_shareable(obj, name);
@@ -3352,6 +3355,7 @@ Init_VM(void)
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_define_method(klass, "make_shareable_copy", m_core_make_shareable_copy, 1);
rb_define_method(klass, "ensure_shareable", m_core_ensure_shareable, 2);
rb_obj_freeze(fcore);
RBASIC_CLEAR_CLASS(klass);