Skip to content

Commit

Permalink
lj_trace.c: unpatch blacklisted bytecodes when flushing traces
Browse files Browse the repository at this point in the history
The blacklist is cleared by going through all prototype objects on the
heap marked to contain patched bytecodes and revert all instances of
IFUNCF, IFORL, IITERL and ILOOP.

(cherry picked from commit 8beb311)
  • Loading branch information
alexandergall authored and lukego committed Nov 30, 2017
1 parent 783cf2d commit 796597d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lj_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,15 @@ int lj_trace_flushall(lua_State *L)
}
J->cur.traceno = 0;
J->freetrace = 0;
/* Unpatch blacklisted byte codes. */
GCRef *p = &(G(L)->gc.root);
GCobj *o;
while ((o = gcref(*p)) != NULL) {
if (o->gch.gct == ~LJ_TPROTO) {
lj_trace_reenableproto(gco2pt(o));
}
p = &o->gch.nextgc;
}
/* Clear penalty cache. */
memset(J->penalty, 0, sizeof(J->penalty));
/* Free the whole machine code and invalidate all exit stub groups. */
Expand Down

0 comments on commit 796597d

Please sign in to comment.