Prefer recording loops over calls.

Hotcounts are decremented by 2 for loops and by 1 for calls.
This commit is contained in:
Mike Pall
2011-06-29 01:51:39 +02:00
parent deeb8196c4
commit 82eca898db
10 changed files with 151 additions and 141 deletions

View File

@@ -643,9 +643,10 @@ void lj_trace_ins(jit_State *J, const BCIns *pc)
/* A hotcount triggered. Start recording a root trace. */
void LJ_FASTCALL lj_trace_hot(jit_State *J, const BCIns *pc)
{
ERRNO_SAVE
/* Note: pc is the interpreter bytecode PC here. It's offset by 1. */
hotcount_set(J2GG(J), pc, J->param[JIT_P_hotloop]+1); /* Reset hotcount. */
ERRNO_SAVE
/* Reset hotcount. */
hotcount_set(J2GG(J), pc, J->param[JIT_P_hotloop]*HOTCOUNT_LOOP);
/* Only start a new trace if not recording or inside __gc call or vmevent. */
if (J->state == LJ_TRACE_IDLE &&
!(J2G(J)->hookmask & (HOOK_GC|HOOK_VMEVENT))) {