aboutsummaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-11-29 18:22:22 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-11-29 18:22:22 -0200
commit413fc7334bf8ceaea71417d73edef15c99d3a793 (patch)
tree50e762d979ad8e80681902cdeb8aa42b041ae323 /lvm.c
parentfca0a12e23f964006ce43d35ab86b27c6bbb0a48 (diff)
downloadlua-413fc7334bf8ceaea71417d73edef15c99d3a793.tar.gz
lua-413fc7334bf8ceaea71417d73edef15c99d3a793.tar.bz2
lua-413fc7334bf8ceaea71417d73edef15c99d3a793.zip
new implementation for lua upvalues (sugested by E.T.): simpler and solves
a bug for multi-stacks
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/lvm.c b/lvm.c
index 5c8eabdc..c4281e44 100644
--- a/lvm.c
+++ b/lvm.c
@@ -390,8 +390,7 @@ StkId luaV_execute (lua_State *L, const LClosure *cl, StkId base) {
390 } 390 }
391 case OP_GETUPVAL: { 391 case OP_GETUPVAL: {
392 int b = GETARG_B(i); 392 int b = GETARG_B(i);
393 lua_assert(isclosed(cl->upvals[b]) || cl->upvals[b] < base); 393 setobj(ra, cl->upvals[b]->v);
394 setobj(ra, cl->upvals[b]);
395 break; 394 break;
396 } 395 }
397 case OP_GETGLOBAL: { 396 case OP_GETGLOBAL: {
@@ -410,8 +409,7 @@ StkId luaV_execute (lua_State *L, const LClosure *cl, StkId base) {
410 } 409 }
411 case OP_SETUPVAL: { 410 case OP_SETUPVAL: {
412 int b = GETARG_B(i); 411 int b = GETARG_B(i);
413 lua_assert(isclosed(cl->upvals[b]) || cl->upvals[b] < base); 412 setobj(cl->upvals[b]->v, ra);
414 setobj(cl->upvals[b], ra);
415 break; 413 break;
416 } 414 }
417 case OP_SETTABLE: { 415 case OP_SETTABLE: {
@@ -648,10 +646,9 @@ StkId luaV_execute (lua_State *L, const LClosure *cl, StkId base) {
648 ncl->l.upvals[j] = cl->upvals[GETARG_B(*pc)]; 646 ncl->l.upvals[j] = cl->upvals[GETARG_B(*pc)];
649 else { 647 else {
650 lua_assert(GET_OPCODE(*pc) == OP_MOVE); 648 lua_assert(GET_OPCODE(*pc) == OP_MOVE);
651 ncl->l.upvals[j] = base + GETARG_B(*pc); 649 ncl->l.upvals[j] = luaF_findupval(L, base + GETARG_B(*pc));
652 } 650 }
653 } 651 }
654 luaF_LConlist(L, ncl);
655 setclvalue(ra, ncl); 652 setclvalue(ra, ncl);
656 break; 653 break;
657 } 654 }