summaryrefslogtreecommitdiff
path: root/src/lj_opt_loop.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_opt_loop.c')
-rw-r--r--src/lj_opt_loop.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lj_opt_loop.c b/src/lj_opt_loop.c
index 559e579e..6dd06636 100644
--- a/src/lj_opt_loop.c
+++ b/src/lj_opt_loop.c
@@ -300,8 +300,11 @@ static void loop_unroll(jit_State *J)
300 } 300 }
301 /* Check all loop-carried dependencies for type instability. */ 301 /* Check all loop-carried dependencies for type instability. */
302 if (!irt_sametype(t, irr->t)) { 302 if (!irt_sametype(t, irr->t)) {
303 if (irt_isnum(t) && irt_isinteger(irr->t)) /* Fix int->num case. */ 303 if (irt_isnum(t) && irt_isinteger(irr->t)) /* Fix int->num. */
304 subst[ins] = tref_ref(emitir(IRTN(IR_CONV), ref, IRCONV_NUM_INT)); 304 subst[ins] = tref_ref(emitir(IRTN(IR_CONV), ref, IRCONV_NUM_INT));
305 else if (irt_isnum(irr->t) && irt_isinteger(t)) /* Fix num->int. */
306 subst[ins] = tref_ref(emitir(IRTGI(IR_CONV), ref,
307 IRCONV_INT_NUM|IRCONV_CHECK));
305 else if (!(irt_isinteger(t) && irt_isinteger(irr->t))) 308 else if (!(irt_isinteger(t) && irt_isinteger(irr->t)))
306 lj_trace_err(J, LJ_TRERR_TYPEINS); 309 lj_trace_err(J, LJ_TRERR_TYPEINS);
307 } 310 }
@@ -355,8 +358,8 @@ int lj_opt_loop(jit_State *J)
355 int errcode = lj_vm_cpcall(J->L, NULL, J, cploop_opt); 358 int errcode = lj_vm_cpcall(J->L, NULL, J, cploop_opt);
356 if (LJ_UNLIKELY(errcode)) { 359 if (LJ_UNLIKELY(errcode)) {
357 lua_State *L = J->L; 360 lua_State *L = J->L;
358 if (errcode == LUA_ERRRUN && tvisnum(L->top-1)) { /* Trace error? */ 361 if (errcode == LUA_ERRRUN && tvisnumber(L->top-1)) { /* Trace error? */
359 int32_t e = lj_num2int(numV(L->top-1)); 362 int32_t e = numberVint(L->top-1);
360 switch ((TraceError)e) { 363 switch ((TraceError)e) {
361 case LJ_TRERR_TYPEINS: /* Type instability. */ 364 case LJ_TRERR_TYPEINS: /* Type instability. */
362 case LJ_TRERR_GFAIL: /* Guard would always fail. */ 365 case LJ_TRERR_GFAIL: /* Guard would always fail. */