Hi, folks!
I've added several comments to the test I was bothered about.
See them on the branch:
https://github.com/tarantool/luajit/tree/skaplun/lj-611-always-snapshot-functions-for-non-base-framesAlso, I rebased it on the tarantool/master branch.
===================================================================
diff --git a/test/tarantool-tests/lj-611-gc64-inherit-frame-slot.test.lua b/test/tarantool-tests/lj-611-gc64-inherit-frame-slot.test.lua
index 8fc5b663..b7347267 100644
--- a/test/tarantool-tests/lj-611-gc64-inherit-frame-slot.test.lua
+++ b/test/tarantool-tests/lj-611-gc64-inherit-frame-slot.test.lua
@@ -3,8 +3,9 @@ local test = tap.test('lj-611-gc64-inherit-frame-slot'):skipcond({
['Test requires JIT enabled'] = not jit.status(),
})
--- GC64: Function missing in snapshot for non-base frame
---
https://github.com/LuaJIT/LuaJIT/issues/611+-- GC64: Function missing in snapshot for non-base frame.
+-- The reproducer is generated from the fuzzer.
+--
https://github.com/LuaJIT/LuaJIT/issues/611.
test:plan(1)
@@ -13,7 +14,9 @@ jit.opt.start('hotloop=1', 'hotexit=1')
local inner_counter = 0
local SIDE_START = 1
-- Lower frame to return from `inner()` function side trace.
--- TODO: Give a reason for vararg func.
+-- XXX: Use a vararg frame to prevent compilation of the function.
+-- The FNEW bytecode is NIY for now, so this helps to avoid trace
+-- blacklisting.
local function lower_frame(...)
local inner = function()
if inner_counter > SIDE_START then
@@ -21,10 +24,18 @@ local function lower_frame(...)
end
inner_counter = inner_counter + 1
end
+ -- XXX: We need to return to the lower frame (to the same
+ -- function) several times to produce the necessary side traces.
+ -- See `jit.dump()` for the details.
inner(..., inner(inner()))
end
-- Compile `inner()` function.
+-- XXX: We need at least 3 calls to create several function
+-- objects from the prototype of the `inner()` function and hit
+-- the `PROTO_CLC_POLY` limit, so the side traces stop spawning.
+-- See also:
+--
https://github.com/tarantool/tarantool/wiki/LuaJIT-function-inlining.
lower_frame()
lower_frame()
-- Compile hotexit.
===================================================================
Can you please verify that these changes are OK for you, so we can
proceed with the backporting of the patch?
--
Best regards,
Sergey Kaplun