@@ -2651,7 +2651,7 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
26512651 }
26522652 else if (!iseq_pop_newarray (iseq , pobj )) {
26532653 pobj = new_insn_core (iseq , pobj -> insn_info .line_no , BIN (pop ), 0 , NULL );
2654- ELEM_INSERT_NEXT (& iobj -> link , & pobj -> link );
2654+ ELEM_INSERT_PREV (& iobj -> link , & pobj -> link );
26552655 }
26562656 if (cond ) {
26572657 if (prev_dup ) {
@@ -4580,6 +4580,7 @@ compile_if(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int
45804580 DECL_ANCHOR (else_seq );
45814581 LABEL * then_label , * else_label , * end_label ;
45824582 VALUE branches = 0 ;
4583+ int ci_size , ci_kw_size ;
45834584
45844585 INIT_ANCHOR (cond_seq );
45854586 INIT_ANCHOR (then_seq );
@@ -4590,8 +4591,22 @@ compile_if(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const node, int
45904591
45914592 compile_branch_condition (iseq , cond_seq , node -> nd_cond ,
45924593 then_label , else_label );
4594+
4595+ ci_size = iseq -> body -> ci_size ;
4596+ ci_kw_size = iseq -> body -> ci_kw_size ;
45934597 CHECK (COMPILE_ (then_seq , "then" , node_body , popped ));
4598+ if (!then_label -> refcnt ) {
4599+ iseq -> body -> ci_size = ci_size ;
4600+ iseq -> body -> ci_kw_size = ci_kw_size ;
4601+ }
4602+
4603+ ci_size = iseq -> body -> ci_size ;
4604+ ci_kw_size = iseq -> body -> ci_kw_size ;
45944605 CHECK (COMPILE_ (else_seq , "else" , node_else , popped ));
4606+ if (!else_label -> refcnt ) {
4607+ iseq -> body -> ci_size = ci_size ;
4608+ iseq -> body -> ci_kw_size = ci_kw_size ;
4609+ }
45954610
45964611 ADD_SEQ (ret , cond_seq );
45974612
@@ -8635,7 +8650,15 @@ ibf_load_iseq_each(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t of
86358650 rb_raise (rb_eRuntimeError , "path object size mismatch" );
86368651 }
86378652 path = rb_fstring (RARRAY_AREF (pathobj , 0 ));
8638- realpath = rb_fstring (RARRAY_AREF (pathobj , 1 ));
8653+ realpath = RARRAY_AREF (pathobj , 1 );
8654+ if (!NIL_P (realpath )) {
8655+ if (!RB_TYPE_P (realpath , T_STRING )) {
8656+ rb_raise (rb_eArgError , "unexpected realpath %" PRIxVALUE
8657+ "(%x), path=%+" PRIsVALUE ,
8658+ realpath , TYPE (realpath ), path );
8659+ }
8660+ realpath = rb_fstring (realpath );
8661+ }
86398662 }
86408663 else {
86418664 rb_raise (rb_eRuntimeError , "unexpected path object" );
@@ -8899,9 +8922,9 @@ static void
88998922ibf_dump_object_regexp (struct ibf_dump * dump , VALUE obj )
89008923{
89018924 struct ibf_object_regexp regexp ;
8902- regexp . srcstr = RREGEXP_SRC (obj );
8925+ VALUE srcstr = RREGEXP_SRC (obj );
89038926 regexp .option = (char )rb_reg_options (obj );
8904- regexp .srcstr = (long )ibf_dump_object (dump , regexp . srcstr );
8927+ regexp .srcstr = (long )ibf_dump_object (dump , srcstr );
89058928 IBF_WV (regexp );
89068929}
89078930
@@ -9328,7 +9351,7 @@ ibf_dump_setup(struct ibf_dump *dump, VALUE dumper_obj)
93289351}
93299352
93309353VALUE
9331- iseq_ibf_dump (const rb_iseq_t * iseq , VALUE opt )
9354+ rb_iseq_ibf_dump (const rb_iseq_t * iseq , VALUE opt )
93329355{
93339356 struct ibf_dump * dump ;
93349357 struct ibf_header header = {{0 }};
@@ -9387,7 +9410,7 @@ ibf_iseq_list(const struct ibf_load *load)
93879410}
93889411
93899412void
9390- ibf_load_iseq_complete (rb_iseq_t * iseq )
9413+ rb_ibf_load_iseq_complete (rb_iseq_t * iseq )
93919414{
93929415 struct ibf_load * load = RTYPEDDATA_DATA (iseq -> aux .loader .obj );
93939416 rb_iseq_t * prev_src_iseq = load -> iseq ;
@@ -9402,7 +9425,7 @@ ibf_load_iseq_complete(rb_iseq_t *iseq)
94029425const rb_iseq_t *
94039426rb_iseq_complete (const rb_iseq_t * iseq )
94049427{
9405- ibf_load_iseq_complete ((rb_iseq_t * )iseq );
9428+ rb_ibf_load_iseq_complete ((rb_iseq_t * )iseq );
94069429 return iseq ;
94079430}
94089431#endif
@@ -9429,7 +9452,7 @@ ibf_load_iseq(const struct ibf_load *load, const rb_iseq_t *index_iseq)
94299452 rb_ary_store (load -> iseq_list , iseq_index , (VALUE )iseq );
94309453
94319454#if !USE_LAZY_LOAD
9432- ibf_load_iseq_complete (iseq );
9455+ rb_ibf_load_iseq_complete (iseq );
94339456#endif /* !USE_LAZY_LOAD */
94349457
94359458 if (load -> iseq ) {
@@ -9504,23 +9527,23 @@ static const rb_data_type_t ibf_load_type = {
95049527};
95059528
95069529const rb_iseq_t *
9507- iseq_ibf_load (VALUE str )
9530+ rb_iseq_ibf_load (VALUE str )
95089531{
95099532 struct ibf_load * load ;
9510- const rb_iseq_t * iseq ;
9533+ rb_iseq_t * iseq ;
95119534 VALUE loader_obj = TypedData_Make_Struct (0 , struct ibf_load , & ibf_load_type , load );
95129535
95139536 ibf_load_setup (load , loader_obj , str );
95149537 iseq = ibf_load_iseq (load , 0 );
95159538
9516- iseq_init_trace (iseq );
9539+ rb_iseq_init_trace (iseq );
95179540
95189541 RB_GC_GUARD (loader_obj );
95199542 return iseq ;
95209543}
95219544
95229545VALUE
9523- iseq_ibf_load_extra_data (VALUE str )
9546+ rb_iseq_ibf_load_extra_data (VALUE str )
95249547{
95259548 struct ibf_load * load ;
95269549 VALUE loader_obj = TypedData_Make_Struct (0 , struct ibf_load , & ibf_load_type , load );
0 commit comments