summaryrefslogtreecommitdiff
path: root/src/lvm.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-29 13:28:24 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-29 13:43:11 +1000
commitb3f5b92b221c0ad8a94b8cb95081bb85d235c39f (patch)
treeddfacca952778520fe74976a88bd97b3cdb68785 /src/lvm.js
parent587b5c78d193426410c45c6f055272acf4a8bc7c (diff)
downloadfengari-b3f5b92b221c0ad8a94b8cb95081bb85d235c39f.tar.gz
fengari-b3f5b92b221c0ad8a94b8cb95081bb85d235c39f.tar.bz2
fengari-b3f5b92b221c0ad8a94b8cb95081bb85d235c39f.zip
Have lua closures point to directly to their upvalues on stack
Diffstat (limited to 'src/lvm.js')
-rw-r--r--src/lvm.js26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/lvm.js b/src/lvm.js
index af8984f..b7b1358 100644
--- a/src/lvm.js
+++ b/src/lvm.js
@@ -171,32 +171,26 @@ const luaV_execute = function(L) {
break;
}
case OCi.OP_GETUPVAL: {
- let o = cl.upvals[i.B].val();
- lobject.setobj2s(L, ra, o);
+ let b = i.B;
+ lobject.setobj2s(L, ra, cl.upvals[b].v);
break;
}
case OCi.OP_SETUPVAL: {
let uv = cl.upvals[i.B];
- if (uv.isopen()) {
- uv.L.stack[uv.v].setfrom(L.stack[ra]);
- } else {
- uv.value.setfrom(L.stack[ra]);
- }
+ uv.v.setfrom(L.stack[ra]);
break;
}
case OCi.OP_GETTABUP: {
- let table = cl.upvals[i.B].val();
- let key = RKC(L, base, k, i);
-
- gettable(L, table, key, ra);
+ let upval = cl.upvals[i.B].v;
+ let rc = RKC(L, base, k, i);
+ gettable(L, upval, rc, ra);
break;
}
case OCi.OP_SETTABUP: {
- let table = cl.upvals[i.A].val();
- let key = RKB(L, base, k, i);
- let v = RKC(L, base, k, i);
-
- settable(L, table, key, v);
+ let upval = cl.upvals[i.A].v;
+ let rb = RKB(L, base, k, i);
+ let rc = RKC(L, base, k, i);
+ settable(L, upval, rb, rc);
break;
}
case OCi.OP_GETTABLE: {