diff options
author | Mike Pall <mike> | 2011-03-10 01:57:24 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2011-03-10 01:57:24 +0100 |
commit | bfce3c1127fd57fe0c935c92bcf45b4737041edd (patch) | |
tree | 2bd2d9e08c70608de63c7a69df7f00cfab07f6be /src/lj_opt_loop.c | |
parent | 3f26e3a89d54dfb761ca02fc89aaf15326f5f514 (diff) | |
download | luajit-bfce3c1127fd57fe0c935c92bcf45b4737041edd.tar.gz luajit-bfce3c1127fd57fe0c935c92bcf45b4737041edd.tar.bz2 luajit-bfce3c1127fd57fe0c935c92bcf45b4737041edd.zip |
DUALNUM: Handle integer type in JIT compiler.
Diffstat (limited to 'src/lj_opt_loop.c')
-rw-r--r-- | src/lj_opt_loop.c | 9 |
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. */ |