diff options
-rw-r--r-- | compile.c | 2 | ||||
-rw-r--r-- | iseq.c | 13 | ||||
-rw-r--r-- | iseq.h | 1 | ||||
-rw-r--r-- | vm_args.c | 6 | ||||
-rw-r--r-- | vm_core.h | 2 |
5 files changed, 21 insertions, 3 deletions
@@ -10490,7 +10490,7 @@ ibf_load_location_str(const struct ibf_load *load, VALUE str_index) static void ibf_load_iseq_each(struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t offset) { - struct rb_iseq_constant_body *load_body = iseq->body = ZALLOC(struct rb_iseq_constant_body); + struct rb_iseq_constant_body *load_body = iseq->body = rb_iseq_constant_body_alloc(); ibf_offset_t reading_pos = offset; @@ -427,11 +427,22 @@ rb_iseq_memsize(const rb_iseq_t *iseq) return size; } +static unsigned long fresh_iseq_unique_id = 0; /* -- Remove In 3.0 -- */ + +struct rb_iseq_constant_body * +rb_iseq_constant_body_alloc(void) +{ + struct rb_iseq_constant_body *iseq_body; + iseq_body = ZALLOC(struct rb_iseq_constant_body); + iseq_body->iseq_unique_id = fresh_iseq_unique_id++; /* -- Remove In 3.0 -- */ + return iseq_body; +} + static rb_iseq_t * iseq_alloc(void) { rb_iseq_t *iseq = iseq_imemo_alloc(); - iseq->body = ZALLOC(struct rb_iseq_constant_body); + iseq->body = rb_iseq_constant_body_alloc(); return iseq; } @@ -186,6 +186,7 @@ void rb_iseq_trace_set(const rb_iseq_t *iseq, rb_event_flag_t turnon_events); void rb_iseq_trace_set_all(rb_event_flag_t turnon_events); void rb_iseq_insns_info_encode_positions(const rb_iseq_t *iseq); +struct rb_iseq_constant_body *rb_iseq_constant_body_alloc(void); VALUE rb_iseqw_new(const rb_iseq_t *iseq); const rb_iseq_t *rb_iseqw_to_iseq(VALUE iseqw); @@ -593,8 +593,12 @@ VALUE rb_iseq_location(const rb_iseq_t *iseq); */ static st_table *caller_to_callees = 0; -static VALUE rb_warn_check(const rb_execution_context_t * const ec, const void *const callee) +static VALUE rb_warn_check(const rb_execution_context_t * const ec, const rb_iseq_t *const iseq) { + if (!iseq) return 0; + + const void *const callee = (void *)(iseq->body->iseq_unique_id * 2); + const rb_control_frame_t * const cfp = rb_vm_get_ruby_level_next_cfp(ec, ec->cfp); if (!cfp) return 0; @@ -447,6 +447,8 @@ struct rb_iseq_constant_body { long unsigned total_calls; /* number of total calls with `mjit_exec()` */ struct rb_mjit_unit *jit_unit; #endif + + unsigned long iseq_unique_id; /* -- Remove In 3.0 -- */ }; /* T_IMEMO/iseq */ |