lj-releng: avoid filtering Lua builtin function names inside user Lua function bodies
Right now the lj-releng tool will ignore use of Lua global variables with the name matching one of the Lua builtin functions. This will hide those use of global variables on hot Lua code paths, as in
local function foo (msg)
assert(type(msg) == "string")
print(msg)
end
For this minimal Lua program, the lj-releng would fail to report the use of Lua global variables inside the foo user function, which are assert, type, and print. The "global-clean" form should be
local type = type
local assert = assert
local print = print
local function foo (msg)
assert(type(msg) == "string")
print(msg)
end
Under the hood, lj-releng should only filter builtin function names for bytecodes outside any Lua function bodies. This requires lj-releng to have some knowledge about the specific bytecode sequences used for Lua function prologue and epilogue during the scan.
This issue seems deprecated. I tried to run lj-releng with the above-mentioned example and it did report all use of globals as expected, or am I missing something?
openresty-devel-utils git:(master) cat test.lua
local function foo (msg)
assert(type(msg) == "string")
print(msg)
end
openresty-devel-utils git:(master) ./lj-releng -s test.lua
ERROR: test.lua: line 2: getting the Lua global "assert"
ERROR: test.lua: line 2: getting the Lua global "type"
ERROR: test.lua: line 3: getting the Lua global "print"