1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Update MJIT references

ISeq can move, so we need to tell MJIT where the new location is.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tenderlove 2019-04-20 02:40:41 +00:00
parent 6c4fd432d0
commit c784da1744
3 changed files with 17 additions and 0 deletions

3
iseq.c
View file

@ -262,6 +262,9 @@ rb_iseq_update_references(rb_iseq_t *iseq)
}
}
}
#if USE_MJIT
mjit_update_references(iseq);
#endif
}
}

13
mjit.c
View file

@ -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

1
mjit.h
View file

@ -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);