diff options
author | daurnimator <quae@daurnimator.com> | 2017-05-29 13:28:24 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-05-29 13:43:11 +1000 |
commit | b3f5b92b221c0ad8a94b8cb95081bb85d235c39f (patch) | |
tree | ddfacca952778520fe74976a88bd97b3cdb68785 /src/lvm.js | |
parent | 587b5c78d193426410c45c6f055272acf4a8bc7c (diff) | |
download | fengari-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.js | 26 |
1 files changed, 10 insertions, 16 deletions
@@ -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: { |