diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-04-14 14:46:15 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-04-14 14:46:15 -0300 |
| commit | 634c3d57e924f36812ccc5798d91236ae819c6d1 (patch) | |
| tree | 31e810ab78448a4487989c498560c4192f9dc209 | |
| parent | 4aa9ad6514a98fd4e25015f29e04877e67d9772d (diff) | |
| download | lua-634c3d57e924f36812ccc5798d91236ae819c6d1.tar.gz lua-634c3d57e924f36812ccc5798d91236ae819c6d1.tar.bz2 lua-634c3d57e924f36812ccc5798d91236ae819c6d1.zip | |
optimization for SETLOCAL was too specific.
| -rw-r--r-- | lopcodes.h | 4 | ||||
| -rw-r--r-- | ltests.c | 12 | ||||
| -rw-r--r-- | lvm.c | 5 |
3 files changed, 10 insertions, 11 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lopcodes.h,v 1.57 2000/04/12 18:57:19 roberto Exp roberto $ | 2 | ** $Id: lopcodes.h,v 1.58 2000/04/13 16:51:01 roberto Exp roberto $ |
| 3 | ** Opcodes for Lua virtual machine | 3 | ** Opcodes for Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -108,7 +108,7 @@ OP_PUSHSELF,/* K t t t[KSTR[k]] */ | |||
| 108 | 108 | ||
| 109 | OP_CREATETABLE,/* U - newarray(size = u) */ | 109 | OP_CREATETABLE,/* U - newarray(size = u) */ |
| 110 | 110 | ||
| 111 | OP_SETLOCAL,/* L B v_b-v_1 - LOC[l]=v_b */ | 111 | OP_SETLOCAL,/* L x - LOC[l]=x */ |
| 112 | OP_SETGLOBAL,/* K x - VAR[KSTR[k]]=x */ | 112 | OP_SETGLOBAL,/* K x - VAR[KSTR[k]]=x */ |
| 113 | OP_SETTABLE,/* A B v a_a-a_1 i t (pops b values) t[i]=v */ | 113 | OP_SETTABLE,/* A B v a_a-a_1 i t (pops b values) t[i]=v */ |
| 114 | 114 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 1.14 2000/04/12 19:56:50 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.15 2000/04/13 16:51:01 roberto Exp roberto $ |
| 3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -55,7 +55,7 @@ static void setnameval (lua_State *L, lua_Object t, const char *name, int val) { | |||
| 55 | 55 | ||
| 56 | 56 | ||
| 57 | 57 | ||
| 58 | static int printop (lua_State *L, Instruction i) { | 58 | static int pushop (lua_State *L, Instruction i) { |
| 59 | char buff[100]; | 59 | char buff[100]; |
| 60 | switch (GET_OPCODE(i)) { | 60 | switch (GET_OPCODE(i)) { |
| 61 | case OP_END: O("END"); lua_pushstring(L, buff); return 0; | 61 | case OP_END: O("END"); lua_pushstring(L, buff); return 0; |
| @@ -76,7 +76,7 @@ static int printop (lua_State *L, Instruction i) { | |||
| 76 | case OP_GETINDEXED: U("GETINDEXED"); break; | 76 | case OP_GETINDEXED: U("GETINDEXED"); break; |
| 77 | case OP_PUSHSELF: U("PUSHSELF"); break; | 77 | case OP_PUSHSELF: U("PUSHSELF"); break; |
| 78 | case OP_CREATETABLE: U("CREATETABLE"); break; | 78 | case OP_CREATETABLE: U("CREATETABLE"); break; |
| 79 | case OP_SETLOCAL: AB("SETLOCAL"); break; | 79 | case OP_SETLOCAL: U("SETLOCAL"); break; |
| 80 | case OP_SETGLOBAL: U("SETGLOBAL"); break; | 80 | case OP_SETGLOBAL: U("SETGLOBAL"); break; |
| 81 | case OP_SETTABLE: AB("SETTABLE"); break; | 81 | case OP_SETTABLE: AB("SETTABLE"); break; |
| 82 | case OP_SETLIST: AB("SETLIST"); break; | 82 | case OP_SETLIST: AB("SETLIST"); break; |
| @@ -111,7 +111,7 @@ static int printop (lua_State *L, Instruction i) { | |||
| 111 | return 1; | 111 | return 1; |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | static void printcode (lua_State *L) { | 114 | static void listcode (lua_State *L) { |
| 115 | lua_Object o = luaL_nonnullarg(L, 1); | 115 | lua_Object o = luaL_nonnullarg(L, 1); |
| 116 | lua_Object t = lua_createtable(L); | 116 | lua_Object t = lua_createtable(L); |
| 117 | Instruction *pc; | 117 | Instruction *pc; |
| @@ -125,7 +125,7 @@ static void printcode (lua_State *L) { | |||
| 125 | do { | 125 | do { |
| 126 | lua_pushobject(L, t); | 126 | lua_pushobject(L, t); |
| 127 | lua_pushnumber(L, pc - p->code + 1); | 127 | lua_pushnumber(L, pc - p->code + 1); |
| 128 | res = printop(L, *pc++); | 128 | res = pushop(L, *pc++); |
| 129 | lua_settable(L); | 129 | lua_settable(L); |
| 130 | } while (res); | 130 | } while (res); |
| 131 | lua_pushobject(L, t); | 131 | lua_pushobject(L, t); |
| @@ -402,7 +402,7 @@ static void testC (lua_State *L) { | |||
| 402 | static const struct luaL_reg tests_funcs[] = { | 402 | static const struct luaL_reg tests_funcs[] = { |
| 403 | {"hash", hash_query}, | 403 | {"hash", hash_query}, |
| 404 | {"limits", get_limits}, | 404 | {"limits", get_limits}, |
| 405 | {"printcode", printcode}, | 405 | {"listcode", listcode}, |
| 406 | {"querystr", string_query}, | 406 | {"querystr", string_query}, |
| 407 | {"querytab", table_query}, | 407 | {"querytab", table_query}, |
| 408 | {"testC", testC}, | 408 | {"testC", testC}, |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 1.101 2000/04/12 18:57:19 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.102 2000/04/13 16:51:01 roberto Exp roberto $ |
| 3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -456,8 +456,7 @@ StkId luaV_execute (lua_State *L, const Closure *cl, register StkId base) { | |||
| 456 | break; | 456 | break; |
| 457 | 457 | ||
| 458 | case OP_SETLOCAL: | 458 | case OP_SETLOCAL: |
| 459 | *(base+GETARG_A(i)) = *(top-1); | 459 | *(base+GETARG_U(i)) = *(--top); |
| 460 | top -= GETARG_B(i); | ||
| 461 | break; | 460 | break; |
| 462 | 461 | ||
| 463 | case OP_SETGLOBAL: | 462 | case OP_SETGLOBAL: |
