lua-users home
lua-l archive

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

On 2017-09-02 02:28 PM, Soni L. wrote:

On 2014-05-24 06:24 PM, Mike Nelson wrote:
The bytecode hack that works:

replace the case ':' clause in suffixedexp in lparser.c with:

case ':': {  /* `:' NAME funcargs */
        expdesc key;
        int flag=0;
        if (ls->t.token=='[') {
           luaK_exp2anyregup(fs, v);
           yindex(ls, &key);
           if (key.k==VNONRELOC){flag=1;}

            checkname(ls, &key);
        luaK_self(fs, v, &key);
        if (flag) ls->fs->freereg++;
        funcargs(ls, v, line);

This will detect and correct the pathological cases of bytecode generation.

Special thanks to Luiz for the original patch and to Roberto for pointing me in the right direction.

Is some kind of error checking in order for the line if (flag) ls->fs->freereg++;? I don't see the need based on the source code of yindex, etc., but I could be overlooking something.

If anyone finds a case in which this fails, please let me know, the detection clause may need to be more complex.

Sorry to bump an old thread, but this appears to no longer work, in Lua 5.3.4.

Would anyone know of a fix?

Update: I noticed this

But even after reverting the commit, I still get "Assertion `reg == fs->freereg' failed".

-- Mike

Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.