lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 22 March 2012 16:29, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>> 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
>

I thought 2^16 -1 was the maximum default array size?

Liam