summaryrefslogtreecommitdiff
path: root/src/lj_record.c
diff options
context:
space:
mode:
authorMike Pall <mike>2011-11-20 17:59:41 +0100
committerMike Pall <mike>2011-11-20 17:59:41 +0100
commitcc7a12be93660677a5128124c11c68127cfe33eb (patch)
tree8cf364b49db9a107c26908226561a4c99529decd /src/lj_record.c
parentf8a4769fb2bd398d526dfe0bdd6814875a2fa39e (diff)
downloadluajit2-cc7a12be93660677a5128124c11c68127cfe33eb.tar.gz
Count frames with same prototype in call unroll limit check.
Diffstat (limited to 'src/lj_record.c')
-rw-r--r--src/lj_record.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lj_record.c b/src/lj_record.c
index c8502d5d..61e09b6d 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -1297,12 +1297,16 @@ static TRef rec_upvalue(jit_State *J, uint32_t uv, TRef val)
/* Check unroll limits for calls. */
static void check_call_unroll(jit_State *J, TraceNo lnk)
{
- IRRef fref = tref_ref(J->base[-1]);
+ cTValue *frame = J->L->base - 1;
+ void *pc = mref(frame_func(frame)->l.pc, void);
+ int32_t depth = J->framedepth;
int32_t count = 0;
- BCReg s;
- for (s = J->baseslot - 1; s > 0; s--)
- if ((J->slot[s] & TREF_FRAME) && tref_ref(J->slot[s]) == fref)
+ if ((J->pt->flags & PROTO_VARARG)) depth--; /* Vararg frame still missing. */
+ for (; depth > 0; depth--) { /* Count frames with same prototype. */
+ frame = frame_prev(frame);
+ if (mref(frame_func(frame)->l.pc, void) == pc)
count++;
+ }
if (J->pc == J->startpc) {
if (count + J->tailcalled > J->param[JIT_P_recunroll]) {
J->pc++;