aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-04-14 14:46:15 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-04-14 14:46:15 -0300
commit634c3d57e924f36812ccc5798d91236ae819c6d1 (patch)
tree31e810ab78448a4487989c498560c4192f9dc209
parent4aa9ad6514a98fd4e25015f29e04877e67d9772d (diff)
downloadlua-634c3d57e924f36812ccc5798d91236ae819c6d1.tar.gz
lua-634c3d57e924f36812ccc5798d91236ae819c6d1.tar.bz2
lua-634c3d57e924f36812ccc5798d91236ae819c6d1.zip
optimization for SETLOCAL was too specific.
-rw-r--r--lopcodes.h4
-rw-r--r--ltests.c12
-rw-r--r--lvm.c5
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 @@
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
109OP_CREATETABLE,/* U - newarray(size = u) */ 109OP_CREATETABLE,/* U - newarray(size = u) */
110 110
111OP_SETLOCAL,/* L B v_b-v_1 - LOC[l]=v_b */ 111OP_SETLOCAL,/* L x - LOC[l]=x */
112OP_SETGLOBAL,/* K x - VAR[KSTR[k]]=x */ 112OP_SETGLOBAL,/* K x - VAR[KSTR[k]]=x */
113OP_SETTABLE,/* A B v a_a-a_1 i t (pops b values) t[i]=v */ 113OP_SETTABLE,/* A B v a_a-a_1 i t (pops b values) t[i]=v */
114 114
diff --git a/ltests.c b/ltests.c
index 7762abb3..5ce089b9 100644
--- a/ltests.c
+++ b/ltests.c
@@ -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
58static int printop (lua_State *L, Instruction i) { 58static 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
114static void printcode (lua_State *L) { 114static 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) {
402static const struct luaL_reg tests_funcs[] = { 402static 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},
diff --git a/lvm.c b/lvm.c
index ceb9b011..e4690985 100644
--- a/lvm.c
+++ b/lvm.c
@@ -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: