From b54eee30383e4eaae74551afc9d1c59126269305 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 5 May 2017 16:46:56 +1000 Subject: An open upvalue already knows which lua_State it comes from --- src/lapi.js | 2 +- src/ldebug.js | 2 +- src/lfunc.js | 6 +++--- src/lvm.js | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lapi.js b/src/lapi.js index 2c03c39..d3e4119 100644 --- a/src/lapi.js +++ b/src/lapi.js @@ -512,7 +512,7 @@ const aux_upvalue = function(L, fi, n) { let name = p.upvalues[n-1].name; return { name: name ? name : "(*no name)", - val: f.upvals[n-1].val(L) + val: f.upvals[n-1].val() }; } default: return null; /* not a closure */ diff --git a/src/ldebug.js b/src/ldebug.js index 34c6fc5..910720f 100644 --- a/src/ldebug.js +++ b/src/ldebug.js @@ -513,7 +513,7 @@ const isinstack = function(L, ci, o) { const getupvalname = function(L, ci, o) { let c = ci.func; for (let i = 0; i < c.nupvalues; i++) { - if (c.upvals[i].val(L) === o) { + if (c.upvals[i].val() === o) { return { name: upvalname(c.p, i), funcname: defs.to_luastring('upvalue', true) diff --git a/src/lfunc.js b/src/lfunc.js index db623b5..0b78bd3 100644 --- a/src/lfunc.js +++ b/src/lfunc.js @@ -41,8 +41,8 @@ class UpVal { }; } - val(L) { - return this.v !== null ? L.stack[this.v] : this.u.value; + val() { + return this.v !== null ? this.L.stack[this.v] : this.u.value; } setval(L, ra) { @@ -94,7 +94,7 @@ const luaF_close = function(L, level) { assert(uv.isopen()); L.openupval = uv.u.open.next; /* remove from 'open' list */ if (uv.refcount > 0) { - let from = L.stack[uv.v]; + let from = uv.L.stack[uv.v]; uv.u.value = new lobject.TValue(from.type, from.value); uv.v = null; } diff --git a/src/lvm.js b/src/lvm.js index 9748ab4..bd38575 100644 --- a/src/lvm.js +++ b/src/lvm.js @@ -161,7 +161,7 @@ const luaV_execute = function(L) { break; } case OCi.OP_GETUPVAL: { - let o = cl.upvals[i.B].val(L); + let o = cl.upvals[i.B].val(); L.stack[ra] = new lobject.TValue(o.type, o.value); break; } @@ -170,7 +170,7 @@ const luaV_execute = function(L) { break; } case OCi.OP_GETTABUP: { - let table = cl.upvals[i.B].val(L); + let table = cl.upvals[i.B].val(); let key = RKC(L, base, k, i); gettable(L, table, key, ra); @@ -178,7 +178,7 @@ const luaV_execute = function(L) { break; } case OCi.OP_SETTABUP: { - let table = cl.upvals[i.A].val(L); + let table = cl.upvals[i.A].val(); let key = RKB(L, base, k, i); let v = RKC(L, base, k, i); -- cgit v1.2.3-54-g00ecf