diff options
-rw-r--r-- | iseq.c | 3 | ||||
-rw-r--r-- | mjit.c | 13 | ||||
-rw-r--r-- | mjit.h | 1 |
3 files changed, 17 insertions, 0 deletions
@@ -262,6 +262,9 @@ rb_iseq_update_references(rb_iseq_t *iseq) } } } +#if USE_MJIT + mjit_update_references(iseq); +#endif } } @@ -110,6 +110,19 @@ mjit_gc_finish_hook(void) CRITICAL_SECTION_FINISH(4, "mjit_gc_finish_hook"); } +// Deal with ISeq movement from compactor +void +mjit_update_references(const rb_iseq_t *iseq) +{ + if (!mjit_enabled) + return; + CRITICAL_SECTION_START(4, "mjit_free_iseq"); + if (iseq->body->jit_unit) { + iseq->body->jit_unit->iseq = (rb_iseq_t *)rb_gc_new_location(iseq->body->jit_unit->iseq); + } + CRITICAL_SECTION_FINISH(4, "mjit_free_iseq"); +} + // Iseqs can be garbage collected. This function should call when it // happens. It removes iseq from the unit. void @@ -84,6 +84,7 @@ extern void mjit_postponed_job_register_finish_hook(void); extern void mjit_gc_start_hook(void); extern void mjit_gc_finish_hook(void); extern void mjit_free_iseq(const rb_iseq_t *iseq); +extern void mjit_update_references(const rb_iseq_t *iseq); extern void mjit_mark(void); extern struct mjit_cont *mjit_cont_new(rb_execution_context_t *ec); extern void mjit_cont_free(struct mjit_cont *cont); |