-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
In some circumstances snap_usedef
can flag a slot as dead, however, a potential upvalue could require it as can be seen in the following example:
-- require"jit".off()
local function f(make_up, when)
local uv, uvf
if make_up then
uvf = function() return uv end
end
for i = 1, 1000 do
if i == when then
uv = "This"
if i == 0 then end
string.gsub("", "", {}) -- Force stich
return uvf
end
end
error("Not here")
end
f(false, 57)
local uvf = f(true, 1)
print(uvf())
The output should be This
and not nil
as the only to exit f
is with the return and uv
is previously set. However, snap_usedef
will determine that uv
is dead, since at the time of compilation no open upvalue exists for uv
.