diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-02-11 16:10:47 +0100 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-02-11 16:18:42 +0100 |
commit | 51ffdbeb0cfc206692ea4e5f71d1fe6d10f61455 (patch) | |
tree | 8a3b79c1bbeb63c785f4c6d61e882f5be26ad3ca /src/lvm.js | |
parent | 4650ac9ab96eadcd5918c56c6eb93618ac054bba (diff) | |
download | fengari-51ffdbeb0cfc206692ea4e5f71d1fe6d10f61455.tar.gz fengari-51ffdbeb0cfc206692ea4e5f71d1fe6d10f61455.tar.bz2 fengari-51ffdbeb0cfc206692ea4e5f71d1fe6d10f61455.zip |
SETLIST
Diffstat (limited to 'src/lvm.js')
-rw-r--r-- | src/lvm.js | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -559,6 +559,24 @@ class LuaVM { break; } case "OP_SETLIST": { + let n = i.B; + let c = i.C; + + if (n === 0) n = L.top - ra - 1; + + if (c === 0) { + assert(OC.OpCodes[ci.u.l.savedpc[ci.pcOff].opcode] === "OP_EXTRAARG"); + c = ci.u.l.savedpc[ci.pcOff++].Ax; + } + + let table = L.stack[ra].value; + let last = ((c - 1) * OC.LFIELDS_PER_FLUSH) + n; + + for (; n > 0; n--) { + table.array[last--] = L.stack[ra + n]; + } + + L.top = ci.top; /* correct top (in case of previous open call) */ break; } case "OP_CLOSURE": { |