Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Bronnikov <sergeyb@tarantool.org>,
	Maxim Kokryashkin <m.kokryashkin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit] LJ_GC64: Always snapshot functions for non-base frames.
Date: Mon, 12 Feb 2024 10:36:16 +0300	[thread overview]
Message-ID: <ZcnKcFMwvMW2lVos@root> (raw)
In-Reply-To: <ZTaJvbjSUyMH-Xj9@root>

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-frames

Also, 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

  reply	other threads:[~2024-02-12  7:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-12 13:06 Sergey Bronnikov via Tarantool-patches
2023-10-17 14:56 ` Maxim Kokryashkin via Tarantool-patches
2023-10-18 14:59   ` Sergey Bronnikov via Tarantool-patches
2023-10-23 14:43   ` Sergey Kaplun via Tarantool-patches
2023-11-07 10:54     ` Maxim Kokryashkin via Tarantool-patches
2023-10-23 14:57 ` Sergey Kaplun via Tarantool-patches
2024-02-12  7:36   ` Sergey Kaplun via Tarantool-patches [this message]
2024-02-13  8:30     ` Sergey Bronnikov via Tarantool-patches
2024-02-13 10:58     ` Maxim Kokryashkin via Tarantool-patches
2024-02-15 13:39 ` Igor Munkin via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZcnKcFMwvMW2lVos@root \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=m.kokryashkin@tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit] LJ_GC64: Always snapshot functions for non-base frames.' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox