details (use ci->base instead of L->base when possible)

This commit is contained in:
Roberto Ierusalimschy
2009-05-22 12:19:54 -03:00
parent 019ebcb85f
commit eea6d10866

12
lvm.c
View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lvm.c,v 2.86 2009/04/17 22:00:01 roberto Exp roberto $ ** $Id: lvm.c,v 2.87 2009/04/30 17:42:21 roberto Exp roberto $
** Lua virtual machine ** Lua virtual machine
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -364,7 +364,7 @@ void luaV_finishOp (lua_State *L) {
case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV: case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV:
case OP_MOD: case OP_POW: case OP_UNM: case OP_LEN: case OP_MOD: case OP_POW: case OP_UNM: case OP_LEN:
case OP_GETGLOBAL: case OP_GETTABLE: case OP_SELF: { case OP_GETGLOBAL: case OP_GETTABLE: case OP_SELF: {
setobjs2s(L, L->base + GETARG_A(inst), --L->top); setobjs2s(L, ci->base + GETARG_A(inst), --L->top);
break; break;
} }
case OP_LE: case OP_LT: case OP_EQ: { case OP_LE: case OP_LT: case OP_EQ: {
@@ -373,7 +373,7 @@ void luaV_finishOp (lua_State *L) {
/* metamethod should not be called when operand is K */ /* metamethod should not be called when operand is K */
lua_assert(!ISK(GETARG_B(inst))); lua_assert(!ISK(GETARG_B(inst)));
if (GET_OPCODE(inst) == OP_LE && /* "<=" using "<" instead? */ if (GET_OPCODE(inst) == OP_LE && /* "<=" using "<" instead? */
ttisnil(luaT_gettmbyobj(L, L->base + GETARG_B(inst), TM_LE))) ttisnil(luaT_gettmbyobj(L, ci->base + GETARG_B(inst), TM_LE)))
res = !res; /* invert result */ res = !res; /* invert result */
lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP); lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP);
if (res != GETARG_A(inst)) /* condition failed? */ if (res != GETARG_A(inst)) /* condition failed? */
@@ -382,7 +382,7 @@ void luaV_finishOp (lua_State *L) {
} }
case OP_CONCAT: { case OP_CONCAT: {
StkId top = L->top - 1; /* top when __concat was called */ StkId top = L->top - 1; /* top when __concat was called */
int last = cast_int(top - L->base) - 2; /* last element and ... */ int last = cast_int(top - ci->base) - 2; /* last element and ... */
int b = GETARG_B(inst); /* ... first element to concatenate */ int b = GETARG_B(inst); /* ... first element to concatenate */
int total = last - b + 1; /* number of elements to concatenate */ int total = last - b + 1; /* number of elements to concatenate */
setobj2s(L, top - 2, top); /* put TM result in proper position */ setobj2s(L, top - 2, top); /* put TM result in proper position */
@@ -390,7 +390,7 @@ void luaV_finishOp (lua_State *L) {
if (total > 1) /* are there elements to concat? */ if (total > 1) /* are there elements to concat? */
luaV_concat(L, total, last); /* concat them (may yield again) */ luaV_concat(L, total, last); /* concat them (may yield again) */
/* move final result to final position */ /* move final result to final position */
setobj2s(L, L->base + GETARG_A(inst), L->base + b); setobj2s(L, ci->base + GETARG_A(inst), ci->base + b);
break; break;
} }
case OP_TFORCALL: { case OP_TFORCALL: {
@@ -670,7 +670,7 @@ void luaV_execute (lua_State *L) {
for (aux = 0; nfunc+aux < L->top; aux++) /* move frame down */ for (aux = 0; nfunc+aux < L->top; aux++) /* move frame down */
setobjs2s(L, ofunc + aux, nfunc + aux); setobjs2s(L, ofunc + aux, nfunc + aux);
oci->top = L->top = ofunc + aux; /* correct top */ oci->top = L->top = ofunc + aux; /* correct top */
lua_assert(L->top == L->base + clvalue(ofunc)->l.p->maxstacksize); lua_assert(L->top == oci->base + clvalue(ofunc)->l.p->maxstacksize);
oci->u.l.savedpc = nci->u.l.savedpc; oci->u.l.savedpc = nci->u.l.savedpc;
oci->u.l.tailcalls++; /* one more call lost */ oci->u.l.tailcalls++; /* one more call lost */
ci = L->ci = oci; /* remove new frame */ ci = L->ci = oci; /* remove new frame */