From 5ff1c18a715b842a6146a6a07d99c84f48cac999 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 6 Mar 2014 13:15:18 -0300 Subject: back with 'L' for macros 'luai_num*', but now with a new macro 'luai_numinvalidop' to protect constant folding --- lvm.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'lvm.c') diff --git a/lvm.c b/lvm.c index 835e8e0f..12c68023 100644 --- a/lvm.c +++ b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 2.185 2014/01/27 13:34:32 roberto Exp roberto $ +** $Id: lvm.c,v 2.186 2014/02/05 19:14:53 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -633,7 +633,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, intop(+, ib, ic)); } else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_numadd(nb, nc)); + setnvalue(ra, luai_numadd(L, nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD)); } ) @@ -646,7 +646,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, intop(-, ib, ic)); } else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_numsub(nb, nc)); + setnvalue(ra, luai_numsub(L, nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SUB)); } ) @@ -659,7 +659,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, intop(*, ib, ic)); } else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_nummul(nb, nc)); + setnvalue(ra, luai_nummul(L, nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MUL)); } ) @@ -668,7 +668,7 @@ void luaV_execute (lua_State *L) { TValue *rc = RKC(i); lua_Number nb; lua_Number nc; if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_numdiv(nb, nc)); + setnvalue(ra, luai_numdiv(L, nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_DIV)); } ) @@ -735,7 +735,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, luaV_mod(L, ib, ic)); } else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_nummod(nb, nc)); + setnvalue(ra, luai_nummod(L, nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MOD)); } ) @@ -748,7 +748,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, luaV_pow(L, ib, ic)); } else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_numpow(nb, nc)); + setnvalue(ra, luai_numpow(L, nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); } ) @@ -760,7 +760,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, intop(-, 0, ib)); } else if (tonumber(rb, &nb)) { - setnvalue(ra, luai_numunm(nb)); + setnvalue(ra, luai_numunm(L, nb)); } else { Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); @@ -911,10 +911,10 @@ void luaV_execute (lua_State *L) { } else { /* floating count */ lua_Number step = fltvalue(ra + 2); - lua_Number idx = luai_numadd(fltvalue(ra), step); /* inc. index */ + lua_Number idx = luai_numadd(L, fltvalue(ra), step); /* inc. index */ lua_Number limit = fltvalue(ra + 1); if (luai_numlt(0, step) ? luai_numle(idx, limit) - : luai_numle(limit, idx)) { + : luai_numle(limit, idx)) { ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ setnvalue(ra, idx); /* update internal index... */ setnvalue(ra + 3, idx); /* ...and external index */ @@ -938,7 +938,7 @@ void luaV_execute (lua_State *L) { setnvalue(pstep, nstep); if (!tonumber(init, &ninit)) luaG_runerror(L, LUA_QL("for") " initial value must be a number"); - setnvalue(ra, luai_numsub(ninit, nstep)); + setnvalue(ra, luai_numsub(L, ninit, nstep)); } ci->u.l.savedpc += GETARG_sBx(i); ) -- cgit v1.2.3-55-g6feb