compile.c: use putspecialobject for RubyVM::FrozenCore
[Bug #20569] `putobject RubyVM::FrozenCore`, is not serializable, we have to use `putspecialobject VM_SPECIAL_OBJECT_VMCORE`.
This commit is contained in:
parent
d827d32527
commit
f0001a4fa7
@ -9882,7 +9882,7 @@ compile_attrasgn(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node
|
||||
static int
|
||||
compile_make_shareable_node(rb_iseq_t *iseq, LINK_ANCHOR *ret, LINK_ANCHOR *sub, const NODE *value, bool copy)
|
||||
{
|
||||
ADD_INSN1(ret, value, putobject, rb_mRubyVMFrozenCore);
|
||||
ADD_INSN1(ret, value, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
|
||||
ADD_SEQ(ret, sub);
|
||||
|
||||
if (copy) {
|
||||
@ -9971,7 +9971,7 @@ compile_ensure_shareable_node(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *dest, con
|
||||
*. RubyVM::FrozenCore.ensure_shareable(value, const_decl_path(dest))
|
||||
*/
|
||||
VALUE path = const_decl_path(dest);
|
||||
ADD_INSN1(ret, value, putobject, rb_mRubyVMFrozenCore);
|
||||
ADD_INSN1(ret, value, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
|
||||
CHECK(COMPILE(ret, "compile_ensure_shareable_node", value));
|
||||
ADD_INSN1(ret, value, putobject, path);
|
||||
RB_OBJ_WRITTEN(iseq, Qundef, path);
|
||||
|
@ -167,6 +167,14 @@ class TestISeq < Test::Unit::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
def test_ractor_shareable_value_frozen_core
|
||||
iseq = RubyVM::InstructionSequence.compile(<<~'RUBY')
|
||||
# shareable_constant_value: literal
|
||||
REGEX = /#{}/ # [Bug #20569]
|
||||
RUBY
|
||||
assert_includes iseq.to_binary, "REGEX".b
|
||||
end
|
||||
|
||||
def test_disasm_encoding
|
||||
src = +"\u{3042} = 1; \u{3042}; \u{3043}"
|
||||
asm = compile(src).disasm
|
||||
|
Loading…
x
Reference in New Issue
Block a user