diff options
-rw-r--r-- | src/lj_record.c | 12 |
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) | |||
1297 | /* Check unroll limits for calls. */ | 1297 | /* Check unroll limits for calls. */ |
1298 | static void check_call_unroll(jit_State *J, TraceNo lnk) | 1298 | static void check_call_unroll(jit_State *J, TraceNo lnk) |
1299 | { | 1299 | { |
1300 | IRRef fref = tref_ref(J->base[-1]); | 1300 | cTValue *frame = J->L->base - 1; |
1301 | void *pc = mref(frame_func(frame)->l.pc, void); | ||
1302 | int32_t depth = J->framedepth; | ||
1301 | int32_t count = 0; | 1303 | int32_t count = 0; |
1302 | BCReg s; | 1304 | if ((J->pt->flags & PROTO_VARARG)) depth--; /* Vararg frame still missing. */ |
1303 | for (s = J->baseslot - 1; s > 0; s--) | 1305 | for (; depth > 0; depth--) { /* Count frames with same prototype. */ |
1304 | if ((J->slot[s] & TREF_FRAME) && tref_ref(J->slot[s]) == fref) | 1306 | frame = frame_prev(frame); |
1307 | if (mref(frame_func(frame)->l.pc, void) == pc) | ||
1305 | count++; | 1308 | count++; |
1309 | } | ||
1306 | if (J->pc == J->startpc) { | 1310 | if (J->pc == J->startpc) { |
1307 | if (count + J->tailcalled > J->param[JIT_P_recunroll]) { | 1311 | if (count + J->tailcalled > J->param[JIT_P_recunroll]) { |
1308 | J->pc++; | 1312 | J->pc++; |