summaryrefslogtreecommitdiff
path: root/mjit.c
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-20 03:29:20 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-20 03:29:20 +0000
commit27f75cf3dc74ad70d065a7d8a14dbaa0eeac1023 (patch)
tree113ef65493d72ed07379139916393bbf9cc5bbad /mjit.c
parentb8b503d657731fc0982c584f8b82f4976ea1283f (diff)
Update ISeq references in stale_units as well
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit.c')
-rw-r--r--mjit.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/mjit.c b/mjit.c
index be4bd9681e..b7bf25168d 100644
--- a/mjit.c
+++ b/mjit.c
@@ -116,10 +116,21 @@ 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((VALUE)iseq->body->jit_unit->iseq);
}
+
+ // Units in stale_units (list of over-speculated and invalidated code) are not referenced from
+ // `iseq->body->jit_unit` anymore (because new one replaces that). So we need to check them too.
+ // TODO: we should be able to reduce the number of units checked here.
+ struct rb_mjit_unit *unit = NULL;
+ list_for_each(&stale_units.head, unit, unode) {
+ if (unit->iseq == iseq) {
+ unit->iseq = (rb_iseq_t *)rb_gc_new_location((VALUE)unit->iseq);
+ }
+ }
CRITICAL_SECTION_FINISH(4, "mjit_free_iseq");
}