From d387948354206fe214685c3d56d066fbae905fc6 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 12 May 2017 15:50:06 +1000 Subject: Rename CallInfo l_savedpc field to l_code --- src/ldebug.js | 2 +- src/ldo.js | 2 +- src/lstate.js | 4 ++-- src/lvm.js | 22 +++++++++++----------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ldebug.js b/src/ldebug.js index 5b537c2..5839e83 100644 --- a/src/ldebug.js +++ b/src/ldebug.js @@ -631,7 +631,7 @@ const luaG_traceexec = function(L) { if (L.status === TS.LUA_YIELD) { /* did hook yield? */ if (counthook) L.hookcount = 1; /* undo decrement to zero */ - ci.l_savedpc--; /* undo increment (resume will increment it again) */ + ci.pcOff--; /* undo increment (resume will increment it again) */ ci.callstatus |= lstate.CIST_HOOKYIELD; /* mark that it yielded */ ci.func = L.top - 1; /* protect stack below results */ ldo.luaD_throw(L, TS.LUA_YIELD); diff --git a/src/ldo.js b/src/ldo.js index 7ee9582..41cbb83 100644 --- a/src/ldo.js +++ b/src/ldo.js @@ -90,7 +90,7 @@ const luaD_precall = function(L, off, nresults) { ci.func = func; ci.l_base = base; L.top = ci.top = base + fsize; - ci.l_savedpc = p.code; + ci.l_code = p.code; ci.pcOff = 0; ci.callstatus = lstate.CIST_LUA; diff --git a/src/lstate.js b/src/lstate.js index 3865ae5..f3e91e2 100644 --- a/src/lstate.js +++ b/src/lstate.js @@ -27,8 +27,8 @@ class CallInfo { /* only for Lua functions */ this.l_base = NaN; /* base for this function */ - this.l_savedpc = null; - this.pcOff = NaN; /* offset into l_savedpc */ + this.l_code = null; /* reference to this.func.p.code */ + this.pcOff = NaN; /* offset into l_code */ /* only for JS functions */ this.c_k = null; /* continuation in case of yields */ this.c_old_errfunc = null; diff --git a/src/lvm.js b/src/lvm.js index 816452c..fba9225 100644 --- a/src/lvm.js +++ b/src/lvm.js @@ -25,7 +25,7 @@ const luaV_finishOp = function(L) { let ci = L.ci; let OCi = lopcodes.OpCodesI; let base = ci.l_base; - let inst = ci.l_savedpc[ci.pcOff - 1]; /* interrupted instruction */ + let inst = ci.l_code[ci.pcOff - 1]; /* interrupted instruction */ let op = inst.opcode; switch (op) { /* finish its execution */ @@ -45,7 +45,7 @@ const luaV_finishOp = function(L) { ci.callstatus ^= lstate.CIST_LEQ; /* clear mark */ res = res !== 1 ? 1 : 0; /* negate result */ } - assert(ci.l_savedpc[ci.pcOff] === OCi.OP_JMP); + assert(ci.l_code[ci.pcOff] === OCi.OP_JMP); if (res !== inst.A) /* condition failed? */ ci.pcOff++; /* skip jump instruction */ break; @@ -66,7 +66,7 @@ const luaV_finishOp = function(L) { break; } case OCi.OP_TFORCALL: { - assert(ci.l_savedpc[ci.pcOff] === OCi.OP_TFORLOOP); + assert(ci.l_code[ci.pcOff] === OCi.OP_TFORLOOP); L.top = ci.top; /* correct top */ break; } @@ -110,7 +110,7 @@ const luaV_execute = function(L) { let k = cl.p.k; let base = ci.l_base; - let i = ci.l_savedpc[ci.pcOff++]; + let i = ci.l_code[ci.pcOff++]; if (L.hookmask & (defs.LUA_MASKLINE | defs.LUA_MASKCOUNT)) { ldebug.luaG_traceexec(L); @@ -130,8 +130,8 @@ const luaV_execute = function(L) { break; } case OCi.OP_LOADKX: { - assert(ci.l_savedpc[ci.pcOff].opcode === OCi.OP_EXTRAARG); - let konst = k[ci.l_savedpc[ci.pcOff++].Ax]; + assert(ci.l_code[ci.pcOff].opcode === OCi.OP_EXTRAARG); + let konst = k[ci.l_code[ci.pcOff++].Ax]; L.stack[ra] = new lobject.TValue(konst.type, konst.value); break; } @@ -490,7 +490,7 @@ const luaV_execute = function(L) { oci.func = nci.func; oci.l_base = ofuncOff + (nci.l_base - nfuncOff); oci.top = L.top = ofuncOff + (L.top - nfuncOff); - oci.l_savedpc = nci.l_savedpc; + oci.l_code = nci.l_code; oci.pcOff = nci.pcOff; oci.callstatus |= lstate.CIST_TAIL; oci.next = null; @@ -585,7 +585,7 @@ const luaV_execute = function(L) { ldo.luaD_call(L, cb, i.C); /* go straight to OP_TFORLOOP */ L.top = ci.top; - i = ci.l_savedpc[ci.pcOff++]; + i = ci.l_code[ci.pcOff++]; ra = RA(L, base, i); assert(i.opcode === OCi.OP_TFORLOOP); /* fall through */ @@ -604,8 +604,8 @@ const luaV_execute = function(L) { if (n === 0) n = L.top - ra - 1; if (c === 0) { - assert(ci.l_savedpc[ci.pcOff].opcode === OCi.OP_EXTRAARG); - c = ci.l_savedpc[ci.pcOff++].Ax; + assert(ci.l_code[ci.pcOff].opcode === OCi.OP_EXTRAARG); + c = ci.l_code[ci.pcOff++].Ax; } let h = L.stack[ra].value; @@ -670,7 +670,7 @@ const dojump = function(L, ci, i, e) { }; const donextjump = function(L, ci) { - dojump(L, ci, ci.l_savedpc[ci.pcOff], 1); + dojump(L, ci, ci.l_code[ci.pcOff], 1); }; -- cgit v1.2.3-70-g09d2