diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-05-12 09:02:43 +0200 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-05-12 09:02:43 +0200 |
commit | ef82425b8828de7c825c6d61e93e6c5a47d84348 (patch) | |
tree | c3a91534204a519505dcb00ffcd1176814d9050b /src/ldo.js | |
parent | 5db1f1f6d5dc1f0e21a0bdf0aae87f3d7aa96fc0 (diff) | |
parent | 6a3290116941015ac63cf3857c45247f140fab45 (diff) | |
download | fengari-ef82425b8828de7c825c6d61e93e6c5a47d84348.tar.gz fengari-ef82425b8828de7c825c6d61e93e6c5a47d84348.tar.bz2 fengari-ef82425b8828de7c825c6d61e93e6c5a47d84348.zip |
Merge remote-tracking branch 'daurnimator/master'
Diffstat (limited to 'src/ldo.js')
-rw-r--r-- | src/ldo.js | 45 |
1 files changed, 9 insertions, 36 deletions
@@ -47,30 +47,16 @@ const seterrorobj = function(L, errcode, oldtop) { */ const luaD_precall = function(L, off, nresults) { let func = L.stack[off]; - let ci; switch(func.type) { case CT.LUA_TCCL: case CT.LUA_TLCF: { let f = func.type === CT.LUA_TCCL ? func.value.f : func.value; - // next_ci - if (L.ci.next) { - L.ci = L.ci.next; - ci = L.ci; - } else { - ci = new lstate.CallInfo(off); - L.ci.next = ci; - ci.previous = L.ci; - ci.next = null; - - L.ci = ci; - L.ciOff++; - } - + let ci = lstate.luaE_extendCI(L); + ci.funcOff = off; ci.nresults = nresults; ci.func = func; - ci.funcOff = off; ci.top = L.top + defs.LUA_MINSTACK; ci.callstatus = 0; if (L.hookmask & defs.LUA_MASKCALL) @@ -98,27 +84,14 @@ const luaD_precall = function(L, off, nresults) { base = off + 1; } - // next_ci - if (L.ci.next) { - L.ci = L.ci.next; - ci = L.ci; - } else { - ci = new lstate.CallInfo(off); - L.ci.next = ci; - ci.previous = L.ci; - ci.next = null; - - L.ci = ci; - L.ciOff++; - } + let ci = lstate.luaE_extendCI(L); + ci.funcOff = off; ci.nresults = nresults; ci.func = func; - ci.funcOff = off; ci.l_base = base; - ci.top = base + fsize; - L.top = ci.top; - ci.l_savedpc = p.code; - ci.pcOff = 0; + L.top = ci.top = base + fsize; + ci.l_code = p.code; + ci.l_savedpc = 0; ci.callstatus = lstate.CIST_LUA; return false; @@ -135,12 +108,12 @@ const luaD_poscall = function(L, ci, firstResult, nres) { if (L.hookmask & (defs.LUA_MASKRET | defs.LUA_MASKLINE)) { if (L.hookmask & defs.LUA_MASKRET) luaD_hook(L, defs.LUA_HOOKRET, -1); - L.oldpc = ci.previous.pcOff; /* 'oldpc' for caller function */ + L.oldpc = ci.previous.l_savedpc; /* 'oldpc' for caller function */ } let res = ci.funcOff; L.ci = ci.previous; - L.ciOff--; + L.ci.next = null; return moveresults(L, firstResult, res, nres, wanted); }; |