[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: When is OP_LOADKX used?
- From: liam mail <liam.list@...>
- Date: Thu, 22 Mar 2012 16:53:00 +0000
On 22 March 2012 16:39, liam mail <liam.list@googlemail.com> wrote:
> 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
Hmm serves me right for looking at the online soure[1] but it means I
need to change some code as I see 2^MAXBITS (5.1 26 and 5.2 30) is the
default max size.
[1] http://www.lua.org/source/5.1/luaconf.h.html#LUAI_BITSINT