[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: When is OP_LOADKX used?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 22 Mar 2012 13:29:33 -0300
> I have a small question. In my project I will do some modifications
> to the Lua 5.2 interpreter to implement some things more efficient
> for our purposes.
> As most changes are in the lvm.c luaV_execute function I wanted to
> have a full coverage unit test of that function. Unfortunately I
> haven't managed to provoke a OP_LOADKX. Maybe someone has an idea,
> or even better sample lua code that will compile and run a OP_LOADKX
> operation?
local a = {"return {0"}
for i = 1,2^18 + 10 do
a[#a + 1] = i
end
a[#a + 1] = "}"
local f = assert(loadstring(table.concat(a, ",")))
Function 'f' should have 11 occurences of 'OP_LOADKX'.
-- Roberto