Set STR_SHARED_ROOT flag on root of string

This commit is contained in:
Peter Zhu 2023-01-06 16:18:29 -05:00
parent 2ad081f799
commit 9726736006
Notes: git 2023-01-09 13:49:56 +00:00

View File

@ -1787,6 +1787,7 @@ str_duplicate_setup(VALUE klass, VALUE str, VALUE dup)
else {
RSTRING(dup)->as.heap.len = RSTRING_LEN(str);
RSTRING(dup)->as.heap.ptr = RSTRING_PTR(str);
FL_SET(root, STR_SHARED_ROOT);
RB_OBJ_WRITE(dup, &RSTRING(dup)->as.heap.aux.shared, root);
flags |= RSTRING_NOEMBED | STR_SHARED;
}