aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-12 16:02:43 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-12 16:55:05 +1000
commit6a3290116941015ac63cf3857c45247f140fab45 (patch)
tree6e126d23dc57011a49d60a81cbd3b5a12cf4576c
parent1556f554f8d5f100bce10918d914debd467bd827 (diff)
downloadfengari-6a3290116941015ac63cf3857c45247f140fab45.tar.gz
fengari-6a3290116941015ac63cf3857c45247f140fab45.tar.bz2
fengari-6a3290116941015ac63cf3857c45247f140fab45.zip
Rename .pcOff field to l_savedpc
-rw-r--r--src/ldebug.js12
-rw-r--r--src/ldo.js4
-rw-r--r--src/lstate.js2
-rw-r--r--src/lvm.js46
4 files changed, 32 insertions, 32 deletions
diff --git a/src/ldebug.js b/src/ldebug.js
index 6386458..13b9da7 100644
--- a/src/ldebug.js
+++ b/src/ldebug.js
@@ -19,7 +19,7 @@ const TS = defs.thread_status;
const currentpc = function(ci) {
assert(ci.callstatus & lstate.CIST_LUA);
- return ci.pcOff - 1;
+ return ci.l_savedpc - 1;
};
const currentline = function(ci) {
@@ -48,7 +48,7 @@ const lua_sethook = function(L, func, mask, count) {
func = null;
}
if (L.ci.callstatus & lstate.CIST_LUA)
- L.oldpc = L.ci.pcOff;
+ L.oldpc = L.ci.l_savedpc;
L.hook = func;
L.basehookcount = count;
L.hookcount = L.basehookcount;
@@ -625,18 +625,18 @@ const luaG_traceexec = function(L) {
ldo.luaD_hook(L, defs.LUA_HOOKCOUNT, -1); /* call count hook */
if (mask & defs.LUA_MASKLINE) {
let p = ci.func.value.p;
- let npc = ci.pcOff; // pcRel(ci.u.l.savedpc, p);
+ let npc = ci.l_savedpc; // pcRel(ci.u.l.savedpc, p);
let newline = p.lineinfo ? p.lineinfo[npc] : -1;
if (npc === 0 || /* call linehook when enter a new function, */
- ci.pcOff <= L.oldpc || /* when jump back (loop), or when */
+ ci.l_savedpc <= L.oldpc || /* when jump back (loop), or when */
newline !== p.lineinfo ? p.lineinfo[L.oldpc] : -1) /* enter a new line */
ldo.luaD_hook(L, defs.LUA_HOOKLINE, newline); /* call line hook */
}
- L.oldpc = ci.pcOff;
+ L.oldpc = ci.l_savedpc;
if (L.status === TS.LUA_YIELD) { /* did hook yield? */
if (counthook)
L.hookcount = 1; /* undo decrement to zero */
- ci.pcOff--; /* undo increment (resume will increment it again) */
+ ci.l_savedpc--; /* 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 41cbb83..5564e27 100644
--- a/src/ldo.js
+++ b/src/ldo.js
@@ -91,7 +91,7 @@ const luaD_precall = function(L, off, nresults) {
ci.l_base = base;
L.top = ci.top = base + fsize;
ci.l_code = p.code;
- ci.pcOff = 0;
+ ci.l_savedpc = 0;
ci.callstatus = lstate.CIST_LUA;
return false;
@@ -108,7 +108,7 @@ 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;
diff --git a/src/lstate.js b/src/lstate.js
index f3e91e2..7d7ff80 100644
--- a/src/lstate.js
+++ b/src/lstate.js
@@ -28,7 +28,7 @@ class CallInfo {
/* only for Lua functions */
this.l_base = NaN; /* base for this function */
this.l_code = null; /* reference to this.func.p.code */
- this.pcOff = NaN; /* offset into l_code */
+ this.l_savedpc = 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 fba9225..169420e 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_code[ci.pcOff - 1]; /* interrupted instruction */
+ let inst = ci.l_code[ci.l_savedpc - 1]; /* interrupted instruction */
let op = inst.opcode;
switch (op) { /* finish its execution */
@@ -45,9 +45,9 @@ const luaV_finishOp = function(L) {
ci.callstatus ^= lstate.CIST_LEQ; /* clear mark */
res = res !== 1 ? 1 : 0; /* negate result */
}
- assert(ci.l_code[ci.pcOff] === OCi.OP_JMP);
+ assert(ci.l_code[ci.l_savedpc] === OCi.OP_JMP);
if (res !== inst.A) /* condition failed? */
- ci.pcOff++; /* skip jump instruction */
+ ci.l_savedpc++; /* skip jump instruction */
break;
}
case OCi.OP_CONCAT: {
@@ -66,7 +66,7 @@ const luaV_finishOp = function(L) {
break;
}
case OCi.OP_TFORCALL: {
- assert(ci.l_code[ci.pcOff] === OCi.OP_TFORLOOP);
+ assert(ci.l_code[ci.l_savedpc] === 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_code[ci.pcOff++];
+ let i = ci.l_code[ci.l_savedpc++];
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_code[ci.pcOff].opcode === OCi.OP_EXTRAARG);
- let konst = k[ci.l_code[ci.pcOff++].Ax];
+ assert(ci.l_code[ci.l_savedpc].opcode === OCi.OP_EXTRAARG);
+ let konst = k[ci.l_code[ci.l_savedpc++].Ax];
L.stack[ra] = new lobject.TValue(konst.type, konst.value);
break;
}
@@ -139,7 +139,7 @@ const luaV_execute = function(L) {
L.stack[ra] = new lobject.TValue(CT.LUA_TBOOLEAN, i.B !== 0);
if (i.C !== 0)
- ci.pcOff++; /* skip next instruction (if C) */
+ ci.l_savedpc++; /* skip next instruction (if C) */
break;
}
@@ -420,28 +420,28 @@ const luaV_execute = function(L) {
}
case OCi.OP_EQ: {
if (luaV_equalobj(L, RKB(L, base, k, i), RKC(L, base, k, i)) !== i.A)
- ci.pcOff++;
+ ci.l_savedpc++;
else
donextjump(L, ci);
break;
}
case OCi.OP_LT: {
if (luaV_lessthan(L, RKB(L, base, k, i), RKC(L, base, k, i)) !== i.A)
- ci.pcOff++;
+ ci.l_savedpc++;
else
donextjump(L, ci);
break;
}
case OCi.OP_LE: {
if (luaV_lessequal(L, RKB(L, base, k, i), RKC(L, base, k, i)) !== i.A)
- ci.pcOff++;
+ ci.l_savedpc++;
else
donextjump(L, ci);
break;
}
case OCi.OP_TEST: {
if (i.C ? L.stack[ra].l_isfalse() : !L.stack[ra].l_isfalse())
- ci.pcOff++;
+ ci.l_savedpc++;
else
donextjump(L, ci);
break;
@@ -449,7 +449,7 @@ const luaV_execute = function(L) {
case OCi.OP_TESTSET: {
let rb = L.stack[RB(L, base, i)];
if (i.C ? rb.l_isfalse() : !rb.l_isfalse())
- ci.pcOff++;
+ ci.l_savedpc++;
else {
L.stack[ra] = rb;
donextjump(L, ci);
@@ -491,7 +491,7 @@ const luaV_execute = function(L) {
oci.l_base = ofuncOff + (nci.l_base - nfuncOff);
oci.top = L.top = ofuncOff + (L.top - nfuncOff);
oci.l_code = nci.l_code;
- oci.pcOff = nci.pcOff;
+ oci.l_savedpc = nci.l_savedpc;
oci.callstatus |= lstate.CIST_TAIL;
oci.next = null;
ci = L.ci = oci;
@@ -521,7 +521,7 @@ const luaV_execute = function(L) {
let limit = L.stack[ra + 1].value;
if (0 < step ? idx <= limit : limit <= idx) {
- ci.pcOff += i.sBx;
+ ci.l_savedpc += i.sBx;
L.stack[ra].value = idx;
L.stack[ra + 3] = new lobject.TValue(CT.LUA_TNUMINT, idx); // TODO: if tvalue already there, just update it
}
@@ -532,7 +532,7 @@ const luaV_execute = function(L) {
// TODO: luai_numlt, luai_numle
if (0 < step ? idx <= limit : limit <= idx) {
- ci.pcOff += i.sBx;
+ ci.l_savedpc += i.sBx;
L.stack[ra].value = idx;
L.stack[ra + 3] = new lobject.TValue(CT.LUA_TNUMFLT, idx); // TODO: if tvalue already there, just update it
}
@@ -573,7 +573,7 @@ const luaV_execute = function(L) {
init.value = ninit - nstep;
}
- ci.pcOff += i.sBx;
+ ci.l_savedpc += i.sBx;
break;
}
case OCi.OP_TFORCALL: {
@@ -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_code[ci.pcOff++];
+ i = ci.l_code[ci.l_savedpc++];
ra = RA(L, base, i);
assert(i.opcode === OCi.OP_TFORLOOP);
/* fall through */
@@ -593,7 +593,7 @@ const luaV_execute = function(L) {
case OCi.OP_TFORLOOP: {
if (!L.stack[ra + 1].ttisnil()) { /* continue loop? */
L.stack[ra] = L.stack[ra + 1]; /* save control variable */
- ci.pcOff += i.sBx; /* jump back */
+ ci.l_savedpc += i.sBx; /* jump back */
}
break;
}
@@ -604,8 +604,8 @@ const luaV_execute = function(L) {
if (n === 0) n = L.top - ra - 1;
if (c === 0) {
- assert(ci.l_code[ci.pcOff].opcode === OCi.OP_EXTRAARG);
- c = ci.l_code[ci.pcOff++].Ax;
+ assert(ci.l_code[ci.l_savedpc].opcode === OCi.OP_EXTRAARG);
+ c = ci.l_code[ci.l_savedpc++].Ax;
}
let h = L.stack[ra].value;
@@ -666,11 +666,11 @@ const luaV_execute = function(L) {
const dojump = function(L, ci, i, e) {
let a = i.A;
if (a !== 0) lfunc.luaF_close(L, ci.l_base + a - 1);
- ci.pcOff += i.sBx + e;
+ ci.l_savedpc += i.sBx + e;
};
const donextjump = function(L, ci) {
- dojump(L, ci, ci.l_code[ci.pcOff], 1);
+ dojump(L, ci, ci.l_code[ci.l_savedpc], 1);
};