@@ -1355,11 +1355,14 @@ new_child_iseq_with_callback(rb_iseq_t *iseq, const struct rb_iseq_new_with_call
13551355}
13561356
13571357static void
1358- set_catch_except_p (struct rb_iseq_constant_body * body )
1358+ set_catch_except_p (rb_iseq_t * iseq )
13591359{
1360- body -> catch_except_p = true;
1361- if (body -> parent_iseq != NULL ) {
1362- set_catch_except_p (ISEQ_BODY (body -> parent_iseq ));
1360+ RUBY_ASSERT (ISEQ_COMPILE_DATA (iseq ));
1361+ ISEQ_COMPILE_DATA (iseq )-> catch_except_p = true;
1362+ if (ISEQ_BODY (iseq )-> parent_iseq != NULL ) {
1363+ if (ISEQ_COMPILE_DATA (ISEQ_BODY (iseq )-> parent_iseq )) {
1364+ set_catch_except_p ((rb_iseq_t * ) ISEQ_BODY (iseq )-> parent_iseq );
1365+ }
13631366 }
13641367}
13651368
@@ -1371,7 +1374,7 @@ set_catch_except_p(struct rb_iseq_constant_body *body)
13711374 So this function sets true for limited ISeqs with break/next/redo catch table entries
13721375 whose child ISeq would really raise an exception. */
13731376static void
1374- update_catch_except_flags (struct rb_iseq_constant_body * body )
1377+ update_catch_except_flags (rb_iseq_t * iseq , struct rb_iseq_constant_body * body )
13751378{
13761379 unsigned int pos ;
13771380 size_t i ;
@@ -1384,7 +1387,7 @@ update_catch_except_flags(struct rb_iseq_constant_body *body)
13841387 while (pos < body -> iseq_size ) {
13851388 insn = rb_vm_insn_decode (body -> iseq_encoded [pos ]);
13861389 if (insn == BIN (throw )) {
1387- set_catch_except_p (body );
1390+ set_catch_except_p (iseq );
13881391 break ;
13891392 }
13901393 pos += insn_len (insn );
@@ -1399,7 +1402,8 @@ update_catch_except_flags(struct rb_iseq_constant_body *body)
13991402 if (entry -> type != CATCH_TYPE_BREAK
14001403 && entry -> type != CATCH_TYPE_NEXT
14011404 && entry -> type != CATCH_TYPE_REDO ) {
1402- body -> catch_except_p = true;
1405+ RUBY_ASSERT (ISEQ_COMPILE_DATA (iseq ));
1406+ ISEQ_COMPILE_DATA (iseq )-> catch_except_p = true;
14031407 break ;
14041408 }
14051409 }
@@ -1496,10 +1500,12 @@ iseq_setup(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
14961500 if (!rb_iseq_translate_threaded_code (iseq )) return COMPILE_NG ;
14971501
14981502 debugs ("[compile step 6 (update_catch_except_flags)] \n" );
1499- update_catch_except_flags (ISEQ_BODY (iseq ));
1503+ RUBY_ASSERT (ISEQ_COMPILE_DATA (iseq ));
1504+ update_catch_except_flags (iseq , ISEQ_BODY (iseq ));
15001505
15011506 debugs ("[compile step 6.1 (remove unused catch tables)] \n" );
1502- if (!ISEQ_BODY (iseq )-> catch_except_p && ISEQ_BODY (iseq )-> catch_table ) {
1507+ RUBY_ASSERT (ISEQ_COMPILE_DATA (iseq ));
1508+ if (!ISEQ_COMPILE_DATA (iseq )-> catch_except_p && ISEQ_BODY (iseq )-> catch_table ) {
15031509 xfree (ISEQ_BODY (iseq )-> catch_table );
15041510 ISEQ_BODY (iseq )-> catch_table = NULL ;
15051511 }
@@ -3802,7 +3808,7 @@ iseq_optimize(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
38023808
38033809 int do_block_optimization = 0 ;
38043810
3805- if (ISEQ_BODY (iseq )-> type == ISEQ_TYPE_BLOCK && !ISEQ_BODY (iseq )-> catch_except_p ) {
3811+ if (ISEQ_BODY (iseq )-> type == ISEQ_TYPE_BLOCK && !ISEQ_COMPILE_DATA (iseq )-> catch_except_p ) {
38063812 do_block_optimization = 1 ;
38073813 }
38083814
@@ -12175,7 +12181,6 @@ ibf_dump_iseq_each(struct ibf_dump *dump, const rb_iseq_t *iseq)
1217512181 ibf_dump_write_small_value (dump , body -> ic_size );
1217612182 ibf_dump_write_small_value (dump , body -> ci_size );
1217712183 ibf_dump_write_small_value (dump , body -> stack_max );
12178- ibf_dump_write_small_value (dump , body -> catch_except_p );
1217912184 ibf_dump_write_small_value (dump , body -> builtin_attrs );
1218012185
1218112186#undef IBF_BODY_OFFSET
@@ -12288,7 +12293,6 @@ ibf_load_iseq_each(struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t offset)
1228812293
1228912294 const unsigned int ci_size = (unsigned int )ibf_load_small_value (load , & reading_pos );
1229012295 const unsigned int stack_max = (unsigned int )ibf_load_small_value (load , & reading_pos );
12291- const char catch_except_p = (char )ibf_load_small_value (load , & reading_pos );
1229212296 const unsigned int builtin_attrs = (unsigned int )ibf_load_small_value (load , & reading_pos );
1229312297
1229412298 // setup fname and dummy frame
@@ -12361,7 +12365,6 @@ ibf_load_iseq_each(struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t offset)
1236112365 load_body -> location .code_location .beg_pos .column = location_code_location_beg_pos_column ;
1236212366 load_body -> location .code_location .end_pos .lineno = location_code_location_end_pos_lineno ;
1236312367 load_body -> location .code_location .end_pos .column = location_code_location_end_pos_column ;
12364- load_body -> catch_except_p = catch_except_p ;
1236512368 load_body -> builtin_attrs = builtin_attrs ;
1236612369
1236712370 load_body -> ivc_size = ivc_size ;
0 commit comments