Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>,
	Maxim Kokryashkin <m.kokryashkin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH luajit 1/2] test: relax JIT setup in lj-430-maxirconst test
Date: Thu,  1 Dec 2022 23:28:58 +0300	[thread overview]
Message-ID: <de5e69b3c7368fe194b5444fbaa03563bfeb53eb.1669926435.git.imun@tarantool.org> (raw)
In-Reply-To: <cover.1669926435.git.imun@tarantool.org>

JIT engine setup in tarantool-tests/lj-430-maxirconst.test.lua is too
tight for the build with LUAJIT_ENABLE_CHECKHOOK option enabled.
Originally test limits <maxirconst> value with 3 for the default IRRef
constants set: nil, true, false. However, with LUAJIT_ENABLE_CHECKHOOK
enabled there are three more auxiliary IRRef constants for the internal
purposes. Hence, the test is reimplemented the following way:
* The first trace for the empty function is recorded
* The number of IRRef constants is obtained via <jit.util.traceinfo>
* <maxirconst> parameter is set to this value
* The second trace for the function with a single local variable,
  initialized with a constant, fails to record

As a result there is no need to explicitly respect any configuration.

Relates to tarantool/tarantool#7762

Signed-off-by: Igor Munkin <imun@tarantool.org>
---
 .../lj-430-maxirconst.test.lua                | 23 +++++++++++--------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/test/tarantool-tests/lj-430-maxirconst.test.lua b/test/tarantool-tests/lj-430-maxirconst.test.lua
index cd3587a8..eaa0cd1b 100644
--- a/test/tarantool-tests/lj-430-maxirconst.test.lua
+++ b/test/tarantool-tests/lj-430-maxirconst.test.lua
@@ -1,8 +1,3 @@
--- XXX: avoid any other traces compilation due to hotcount
--- collisions for predictable results.
-jit.off()
-jit.flush()
-
 -- Disabled on *BSD due to #4819.
 require('utils').skipcond(jit.os == 'BSD', 'Disabled due to #4819')
 
@@ -12,10 +7,6 @@ local traceinfo = require('jit.util').traceinfo
 local test = tap.test('lj-430-maxirconst')
 test:plan(2)
 
--- XXX: trace always has at least 3 IR constants: for nil, false
--- and true.
-jit.opt.start('hotloop=1', 'maxirconst=3')
-
 -- This function has only 3 IR constant.
 local function irconst3()
 end
@@ -25,6 +16,12 @@ local function irconst4()
   local _ = 42
 end
 
+-- XXX: Avoid any other traces compilation due to hotcount
+-- collisions for predictable results.
+jit.off()
+jit.flush()
+jit.opt.start('hotloop=1')
+
 assert(not traceinfo(1), 'no traces compiled after flush')
 jit.on()
 irconst3()
@@ -32,6 +29,14 @@ irconst3()
 jit.off()
 test:ok(traceinfo(1), 'new trace created')
 
+-- XXX: Trace 1 always has at least 3 IR constants: for nil, false
+-- and true. In case when LUAJIT_ENABLE_CHECKHOOK is set to ON,
+-- three more constants are emitted to the trace.
+-- Tight up <maxirconst> and try to record the next trace with one
+-- more constant to be emitted.
+jit.opt.start(('maxirconst=%d'):format(traceinfo(1).nk))
+
+assert(not traceinfo(2), 'only one trace is created to this moment')
 jit.on()
 irconst4()
 irconst4()
-- 
2.34.0


  reply	other threads:[~2022-12-01 20:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01 20:28 [Tarantool-patches] [PATCH luajit 0/2] Fix tests for LUAJIT_ENABLE_CHECKHOOK Igor Munkin via Tarantool-patches
2022-12-01 20:28 ` Igor Munkin via Tarantool-patches [this message]
2022-12-05  7:52   ` [Tarantool-patches] [PATCH luajit 1/2] test: relax JIT setup in lj-430-maxirconst test Sergey Kaplun via Tarantool-patches
2022-12-05 21:33     ` Igor Munkin via Tarantool-patches
2022-12-05 10:47   ` Maxim Kokryashkin via Tarantool-patches
2022-12-05 21:34     ` Igor Munkin via Tarantool-patches
2022-12-01 20:28 ` [Tarantool-patches] [PATCH luajit 2/2] test: relax JIT setup in misc.getmetrics test Igor Munkin via Tarantool-patches
2022-12-05  7:57   ` Sergey Kaplun via Tarantool-patches
2022-12-05 21:40     ` Igor Munkin via Tarantool-patches
2022-12-05 10:52   ` Maxim Kokryashkin via Tarantool-patches
2022-12-05 21:40     ` Igor Munkin via Tarantool-patches
2022-12-02 10:01 ` [Tarantool-patches] [PATCH luajit 3/2] test: remove TAP side effects in getmetrics tests Igor Munkin via Tarantool-patches
2022-12-05  8:01   ` Sergey Kaplun via Tarantool-patches
2022-12-05 21:46     ` Igor Munkin via Tarantool-patches
2022-12-05 11:06   ` Maxim Kokryashkin via Tarantool-patches
2022-12-05 21:47     ` Igor Munkin via Tarantool-patches
2022-12-02 10:05 ` [Tarantool-patches] [PATCH luajit 0/2] Fix tests for LUAJIT_ENABLE_CHECKHOOK Igor Munkin via Tarantool-patches
2022-12-12  9:42 ` 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=de5e69b3c7368fe194b5444fbaa03563bfeb53eb.1669926435.git.imun@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imun@tarantool.org \
    --cc=m.kokryashkin@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 1/2] test: relax JIT setup in lj-430-maxirconst test' \
    /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