summaryrefslogtreecommitdiff
path: root/mjit.c
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-20 05:48:22 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-20 05:48:22 +0000
commitb2ffafd2383fef50933a725797b1ea7ae4fbdaea (patch)
treeaafd3533552ba67ce0f750d9f58829bbf990598f /mjit.c
parentb79899b56a9ebadf5c493c4df2419ebf63934381 (diff)
Invalidate JIT-ed code if ISeq is moved by GC.compact
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit.c')
-rw-r--r--mjit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mjit.c b/mjit.c
index 0cedd55e57..186702270d 100644
--- a/mjit.c
+++ b/mjit.c
@@ -120,6 +120,9 @@ mjit_update_references(const rb_iseq_t *iseq)
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);
+ // We need to invalidate JIT-ed code for the ISeq because it embeds pointer addresses.
+ // To efficiently do that, we use the same thing as TracePoint and thus everything is cancelled for now.
+ mjit_call_p = false; // TODO: instead of cancelling all, invalidate only this one and recompile it with some threshold.
}
// Units in stale_units (list of over-speculated and invalidated code) are not referenced from
@@ -313,6 +316,7 @@ unload_units(void)
for (cont = first_cont; cont != NULL; cont = cont->next) {
mark_ec_units(cont->ec);
}
+ // TODO: check slale_units and unload unused ones! (note that the unit is not associated to ISeq anymore)
// Remove 1/10 units more to decrease unloading calls.
// TODO: Calculate max total_calls in unit_queue and don't unload units