From 634c3d57e924f36812ccc5798d91236ae819c6d1 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 14 Apr 2000 14:46:15 -0300 Subject: optimization for SETLOCAL was too specific. --- lopcodes.h | 4 ++-- ltests.c | 12 ++++++------ lvm.c | 5 ++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/lopcodes.h b/lopcodes.h index d7548d9b..9df510a3 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -1,5 +1,5 @@ /* -** $Id: lopcodes.h,v 1.57 2000/04/12 18:57:19 roberto Exp roberto $ +** $Id: lopcodes.h,v 1.58 2000/04/13 16:51:01 roberto Exp roberto $ ** Opcodes for Lua virtual machine ** See Copyright Notice in lua.h */ @@ -108,7 +108,7 @@ OP_PUSHSELF,/* K t t t[KSTR[k]] */ OP_CREATETABLE,/* U - newarray(size = u) */ -OP_SETLOCAL,/* L B v_b-v_1 - LOC[l]=v_b */ +OP_SETLOCAL,/* L x - LOC[l]=x */ OP_SETGLOBAL,/* K x - VAR[KSTR[k]]=x */ OP_SETTABLE,/* A B v a_a-a_1 i t (pops b values) t[i]=v */ diff --git a/ltests.c b/ltests.c index 7762abb3..5ce089b9 100644 --- a/ltests.c +++ b/ltests.c @@ -1,5 +1,5 @@ /* -** $Id: ltests.c,v 1.14 2000/04/12 19:56:50 roberto Exp roberto $ +** $Id: ltests.c,v 1.15 2000/04/13 16:51:01 roberto Exp roberto $ ** Internal Module for Debugging of the Lua Implementation ** See Copyright Notice in lua.h */ @@ -55,7 +55,7 @@ static void setnameval (lua_State *L, lua_Object t, const char *name, int val) { -static int printop (lua_State *L, Instruction i) { +static int pushop (lua_State *L, Instruction i) { char buff[100]; switch (GET_OPCODE(i)) { case OP_END: O("END"); lua_pushstring(L, buff); return 0; @@ -76,7 +76,7 @@ static int printop (lua_State *L, Instruction i) { case OP_GETINDEXED: U("GETINDEXED"); break; case OP_PUSHSELF: U("PUSHSELF"); break; case OP_CREATETABLE: U("CREATETABLE"); break; - case OP_SETLOCAL: AB("SETLOCAL"); break; + case OP_SETLOCAL: U("SETLOCAL"); break; case OP_SETGLOBAL: U("SETGLOBAL"); break; case OP_SETTABLE: AB("SETTABLE"); break; case OP_SETLIST: AB("SETLIST"); break; @@ -111,7 +111,7 @@ static int printop (lua_State *L, Instruction i) { return 1; } -static void printcode (lua_State *L) { +static void listcode (lua_State *L) { lua_Object o = luaL_nonnullarg(L, 1); lua_Object t = lua_createtable(L); Instruction *pc; @@ -125,7 +125,7 @@ static void printcode (lua_State *L) { do { lua_pushobject(L, t); lua_pushnumber(L, pc - p->code + 1); - res = printop(L, *pc++); + res = pushop(L, *pc++); lua_settable(L); } while (res); lua_pushobject(L, t); @@ -402,7 +402,7 @@ static void testC (lua_State *L) { static const struct luaL_reg tests_funcs[] = { {"hash", hash_query}, {"limits", get_limits}, - {"printcode", printcode}, + {"listcode", listcode}, {"querystr", string_query}, {"querytab", table_query}, {"testC", testC}, diff --git a/lvm.c b/lvm.c index ceb9b011..e4690985 100644 --- a/lvm.c +++ b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 1.101 2000/04/12 18:57:19 roberto Exp roberto $ +** $Id: lvm.c,v 1.102 2000/04/13 16:51:01 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -456,8 +456,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, register StkId base) { break; case OP_SETLOCAL: - *(base+GETARG_A(i)) = *(top-1); - top -= GETARG_B(i); + *(base+GETARG_U(i)) = *(--top); break; case OP_SETGLOBAL: -- cgit v1.2.3-55-g6feb