aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-12 15:22:37 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-12 16:54:56 +1000
commit266c0a526374274b1b07187e52aec6b40d0cab00 (patch)
treec9552495b9a6f53f75253d732c1a38b3729ad86b /src
parentf47e66cf8d6e433a1036113a69ec421966d3509c (diff)
downloadfengari-266c0a526374274b1b07187e52aec6b40d0cab00.tar.gz
fengari-266c0a526374274b1b07187e52aec6b40d0cab00.tar.bz2
fengari-266c0a526374274b1b07187e52aec6b40d0cab00.zip
Move adhoc code into proper luaE_extendCI
Diffstat (limited to 'src')
-rw-r--r--src/ldo.js22
-rw-r--r--src/lstate.js10
2 files changed, 14 insertions, 18 deletions
diff --git a/src/ldo.js b/src/ldo.js
index da110e7..57400ab 100644
--- a/src/ldo.js
+++ b/src/ldo.js
@@ -53,17 +53,10 @@ const luaD_precall = function(L, off, nresults) {
case CT.LUA_TLCF: {
let f = func.type === CT.LUA_TCCL ? func.value.f : func.value;
- // next_ci
- let 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)
@@ -91,17 +84,10 @@ const luaD_precall = function(L, off, nresults) {
base = off + 1;
}
- // next_ci
- let 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;
diff --git a/src/lstate.js b/src/lstate.js
index f4195cd..7f7bac9 100644
--- a/src/lstate.js
+++ b/src/lstate.js
@@ -74,6 +74,15 @@ class global_State {
}
+const luaE_extendCI = function(L) {
+ let ci = new CallInfo();
+ L.ci.next = ci;
+ ci.previous = L.ci;
+ ci.next = null;
+ L.ci = ci;
+ L.ciOff++;
+ return ci;
+};
const luaE_freeCI = function(L) {
let ci = L.ci;
@@ -196,5 +205,6 @@ module.exports.CIST_FIN = (1<<8); /* call is running a finalizer */
module.exports.lua_close = lua_close;
module.exports.lua_newstate = lua_newstate;
module.exports.lua_newthread = lua_newthread;
+module.exports.luaE_extendCI = luaE_extendCI;
module.exports.luaE_freeCI = luaE_freeCI;
module.exports.luaE_freethread = luaE_freethread;