[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [Bug] OP_SELF uses an unnecessary extra register
- From: "Soni L." <fakedme@...>
- Date: Wed, 6 Sep 2017 10:28:03 -0300
While playing with the Lua parser I noticed OP_SELF uses an unnecessary
extra register, but this is only visible if you have more than 256
constants.
This is important for complex functions and expressions, which will have
one less register available to them.
[soniex2@soniex-pc lua]$ lua selfissue.lua | luac -l -l -o /dev/null - |
grep -C 4 'SELF'
768 [257] LOADK 2 -256 ; "257"
769 [257] CALL 1 2 1
770 [258] GETUPVAL 1 0 ; _ENV
771 [258] LOADK 3 -257 ; "print"
772 [258] SELF 1 1 3
773 [258] CALL 1 2 1
774 [258] RETURN 0 1
constants (257) for 0x132c760:
1 "2"
[soniex2@soniex-pc lua]$ cat selfissue.lua
local xlim = 257
local x = {"local function _() end\n"}
for i=2,xlim do
x[i] = "_'"..i.."'\n"
end
table.insert(x, "_ENV:print()\n")
print(table.concat(x))
--
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.