ruby-changes:55419
From: k0kubun <ko1@a...>
Date: Sat, 20 Apr 2019 12:29:23 +0900 (JST)
Subject: [ruby-changes:55419] k0kubun:r67628 (trunk): Update ISeq references in stale_units as well
k0kubun 2019-04-20 12:29:20 +0900 (Sat, 20 Apr 2019) New Revision: 67628 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67628 Log: Update ISeq references in stale_units as well Modified files: trunk/mjit.c Index: mjit.c =================================================================== --- mjit.c (revision 67627) +++ mjit.c (revision 67628) @@ -116,10 +116,21 @@ mjit_update_references(const rb_iseq_t * https://github.com/ruby/ruby/blob/trunk/mjit.c#L116 { 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"); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/