Skip to content

Commit

Permalink
Merge pull request snabbco#1239 from eugeneia/stable-perf
Browse files Browse the repository at this point in the history
raptorjit: amend prev. commit, also clear trace exit hotcounts
  • Loading branch information
wingo authored Dec 4, 2019
2 parents fea333d + dfadac8 commit 49d5e76
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/luajit/src/lj_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ void lj_trace_err_info(jit_State *J, TraceError e)
** The "one second" constant is certainly tunable.
** */

static void trace_clearsnapcounts(jit_State *J); /* Forward decl. */

static inline uint64_t gettime_ns (void)
{
struct timespec ts;
Expand All @@ -79,6 +81,7 @@ int hotcount_decay (jit_State *J)
if (decay) {
/* Reset hotcounts. */
lj_dispatch_init_hotcount(J2G(J));
trace_clearsnapcounts(J);
hotcount_decay_ts = ts;
}
return decay;
Expand Down Expand Up @@ -358,6 +361,20 @@ void lj_trace_freestate(global_State *g)
lj_mcode_free(J);
}

/* Clear all trace snap counts (side-exit hot counters). */
static void trace_clearsnapcounts(jit_State *J)
{
int i, s;
GCtrace *t;
/* Clear hotcounts for all snapshots of all traces. */
for (i = 1; i < TRACE_MAX; i++) {
t = traceref(J, i);
if (t != NULL)
for (s = 0; s < t->nsnap; s++)
t->snap[s].count = 0;
}
}

/* -- Penalties and blacklisting ------------------------------------------ */

/* Blacklist a bytecode instruction. */
Expand Down

0 comments on commit 49d5e76

Please sign in to comment.