@@ -171,10 +171,10 @@ r_value(VALUE value)
171
171
(((rb_iseq_t*)DATA_PTR(iseq))->location.absolute_path)
172
172
173
173
#define NEW_ISEQVAL (node , name , type , line_no ) \
174
- new_child_iseq(iseq, (node), (name), 0, (type), (line_no))
174
+ new_child_iseq(iseq, (node), rb_fstring (name), 0, (type), (line_no))
175
175
176
176
#define NEW_CHILD_ISEQVAL (node , name , type , line_no ) \
177
- new_child_iseq(iseq, (node), (name), iseq->self, (type), (line_no))
177
+ new_child_iseq(iseq, (node), rb_fstring (name), iseq->self, (type), (line_no))
178
178
179
179
/* add instructions */
180
180
#define ADD_SEQ (seq1 , seq2 ) \
@@ -2254,15 +2254,16 @@ compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node, int *cntp)
2254
2254
2255
2255
debugp_param ("nd_lit" , lit );
2256
2256
if (!NIL_P (lit )) {
2257
- hide_obj (lit );
2258
2257
cnt ++ ;
2258
+ if (RB_TYPE_P (lit , T_STRING ))
2259
+ lit = node -> nd_lit = rb_fstring (node -> nd_lit );
2259
2260
ADD_INSN1 (ret , nd_line (node ), putobject , lit );
2260
2261
}
2261
2262
2262
2263
while (list ) {
2263
2264
node = list -> nd_head ;
2264
2265
if (nd_type (node ) == NODE_STR ) {
2265
- hide_obj (node -> nd_lit );
2266
+ node -> nd_lit = rb_fstring (node -> nd_lit );
2266
2267
ADD_INSN1 (ret , nd_line (node ), putobject , node -> nd_lit );
2267
2268
}
2268
2269
else {
@@ -2515,7 +2516,7 @@ case_when_optimizable_literal(NODE * node)
2515
2516
break ;
2516
2517
}
2517
2518
case NODE_STR :
2518
- return node -> nd_lit ;
2519
+ return node -> nd_lit = rb_fstring ( node -> nd_lit ) ;
2519
2520
}
2520
2521
return Qundef ;
2521
2522
}
@@ -2542,8 +2543,8 @@ when_vals(rb_iseq_t *iseq, LINK_ANCHOR *cond_seq, NODE *vals, LABEL *l1, int onl
2542
2543
ADD_INSN (cond_seq , nd_line (val ), dup ); /* dup target */
2543
2544
2544
2545
if (nd_type (val ) == NODE_STR ) {
2546
+ val -> nd_lit = rb_fstring (val -> nd_lit );
2545
2547
debugp_param ("nd_lit" , val -> nd_lit );
2546
- OBJ_FREEZE (val -> nd_lit );
2547
2548
ADD_INSN1 (cond_seq , nd_line (val ), putobject , val -> nd_lit );
2548
2549
}
2549
2550
else {
@@ -4798,9 +4799,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
4798
4799
break ;
4799
4800
}
4800
4801
case NODE_STR :{
4802
+ node -> nd_lit = rb_fstring (node -> nd_lit );
4801
4803
debugp_param ("nd_lit" , node -> nd_lit );
4802
4804
if (!poped ) {
4803
- OBJ_FREEZE (node -> nd_lit );
4804
4805
ADD_INSN1 (ret , line , putstring , node -> nd_lit );
4805
4806
}
4806
4807
break ;
@@ -4814,7 +4815,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
4814
4815
break ;
4815
4816
}
4816
4817
case NODE_XSTR :{
4817
- OBJ_FREEZE (node -> nd_lit );
4818
+ node -> nd_lit = rb_fstring (node -> nd_lit );
4818
4819
ADD_CALL_RECEIVER (ret , line );
4819
4820
ADD_INSN1 (ret , line , putobject , node -> nd_lit );
4820
4821
ADD_CALL (ret , line , ID2SYM (idBackquote ), INT2FIX (1 ));
@@ -4908,7 +4909,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
4908
4909
}
4909
4910
case NODE_DEFN :{
4910
4911
VALUE iseqval = NEW_ISEQVAL (node -> nd_defn ,
4911
- rb_str_dup ( rb_id2str (node -> nd_mid ) ),
4912
+ rb_id2str (node -> nd_mid ),
4912
4913
ISEQ_TYPE_METHOD , line );
4913
4914
4914
4915
debugp_param ("defn/iseq" , iseqval );
@@ -4928,7 +4929,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
4928
4929
}
4929
4930
case NODE_DEFS :{
4930
4931
VALUE iseqval = NEW_ISEQVAL (node -> nd_defn ,
4931
- rb_str_dup ( rb_id2str (node -> nd_mid ) ),
4932
+ rb_id2str (node -> nd_mid ),
4932
4933
ISEQ_TYPE_METHOD , line );
4933
4934
4934
4935
debugp_param ("defs/iseq" , iseqval );
@@ -5530,7 +5531,7 @@ rb_insns_name_array(void)
5530
5531
VALUE ary = rb_ary_new ();
5531
5532
int i ;
5532
5533
for (i = 0 ; i < numberof (insn_name_info ); i ++ ) {
5533
- rb_ary_push (ary , rb_obj_freeze (rb_str_new2 (insn_name_info [i ])));
5534
+ rb_ary_push (ary , rb_fstring (rb_str_new2 (insn_name_info [i ])));
5534
5535
}
5535
5536
return rb_obj_freeze (ary );
5536
5537
}
0 commit comments