diff --git a/compile.c b/compile.c index 8c295de00c..f53f3c1cec 100644 --- a/compile.c +++ b/compile.c @@ -5671,8 +5671,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in node->nd_args == NULL && ISEQ_COMPILE_DATA(iseq)->current_block == NULL && ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) { - VALUE str = rb_fstring(node->nd_recv->nd_lit); - iseq_add_mark_object(iseq, str); + VALUE str = freeze_literal(iseq, node->nd_recv->nd_lit); if (node->nd_mid == idUMinus) { ADD_INSN1(ret, line, opt_str_uminus, str); } @@ -5692,8 +5691,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in nd_type(node->nd_args->nd_head) == NODE_STR && ISEQ_COMPILE_DATA(iseq)->current_block == NULL && ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) { - VALUE str = rb_fstring(node->nd_args->nd_head->nd_lit); - node->nd_args->nd_head->nd_lit = str; + VALUE str = freeze_literal(iseq, node->nd_args->nd_head->nd_lit); CHECK(COMPILE(ret, "recv", node->nd_recv)); ADD_INSN3(ret, line, opt_aref_with, new_callinfo(iseq, idAREF, 1, 0, NULL, FALSE), @@ -6743,9 +6741,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in ISEQ_COMPILE_DATA(iseq)->current_block == NULL && ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) { - VALUE str = rb_fstring(node->nd_args->nd_head->nd_lit); - node->nd_args->nd_head->nd_lit = str; - iseq_add_mark_object(iseq, str); + VALUE str = freeze_literal(iseq, node->nd_args->nd_head->nd_lit); CHECK(COMPILE(ret, "recv", node->nd_recv)); CHECK(COMPILE(ret, "value", node->nd_args->nd_next->nd_head)); if (!popped) {