Re: Bytecode hacks [fixed?]
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Bytecode hacks [fixed?]
- From: "Soni L." <fakedme@...>
- Date: Sat, 2 Sep 2017 14:28:45 -0300
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;
luaX_next(ls);
if (ls->t.token=='[') {
luaK_exp2anyregup(fs, v);
yindex(ls, &key);
if (key.k==VNONRELOC){flag=1;}
}
else
checkname(ls, &key);
luaK_self(fs, v, &key);
if (flag) ls->fs->freereg++;
funcargs(ls, v, line);
break;
}
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?
-- 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.