From: Igor Munkin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit] Actually implement maxirconst trace limit.
Date: Fri, 28 Jan 2022 02:18:47 +0300 [thread overview]
Message-ID: <YfMoV/2aiGDkx10z@tarantool.org> (raw)
In-Reply-To: <20211229122731.31617-1-skaplun@tarantool.org>
Sergey,
Thanks for the patch! LGTM, except a couple of nits.
On 29.12.21, Sergey Kaplun wrote:
> From: Mike Pall <mike>
>
> Suggested by spacewander.
>
> (cherry picked from 9ff94c4a1fcec2c310dcb092da694f23186e23)
Typo: s/9ff94c4a1fcec2c310dcb092da694f23186e23/0a9ff94c4a1fcec2c310dcb092da694f23186e23/.
>
> `maxirconst` should restrict the amount of IR constants for 1 trace.
Typo: It's better s/for 1/per/, but feel free to ignore.
> Nevertheless, its value isn't checked anywhere.
Lol, classic.
>
> This patch adds the corresponding check after instruction recording.
>
> Sergey Kaplun:
> * added the description and the test for the problem
>
> Part of tarantool/tarantool#6548
> ---
>
> Issue: https://github.com/LuaJIT/LuaJIT/issues/430
> Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-430-maxirconst-actually-implement-full-ci
> Tarantool branch: https://github.com/tarantool/tarantool/tree/skaplun/lj-430-maxirconst-actually-implement-full-ci
>
> src/lj_record.c | 5 ++-
> .../lj-430-maxirconst.test.lua | 43 +++++++++++++++++++
> 2 files changed, 46 insertions(+), 2 deletions(-)
> create mode 100644 test/tarantool-tests/lj-430-maxirconst.test.lua
>
<snipped>
> diff --git a/test/tarantool-tests/lj-430-maxirconst.test.lua b/test/tarantool-tests/lj-430-maxirconst.test.lua
> new file mode 100644
> index 00000000..1829b37d
> --- /dev/null
> +++ b/test/tarantool-tests/lj-430-maxirconst.test.lua
> @@ -0,0 +1,43 @@
> +-- XXX: avoid any other traces compilation due to hotcount
> +-- collisions for predictible results.
Typo: s/predictible/predictable/.
> +jit.off()
> +jit.flush()
Minor: I'd rather move this part closer to 'jit.opt.start' to save the
test structure closer to the other test chunks. Feel free to ignore.
> +
> +-- Disabled on *BSD due to #4819.
> +require('utils').skipcond(jit.os == 'BSD', 'Disabled due to #4819')
> +
> +local tap = require('tap')
> +
> +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
> +
> +-- This function has 4 IR constants before optimizations.
> +local function irconst4()
> + local _ = 42
> +end
> +
> +local ntrace_old = misc.getmetrics().jit_trace_num
> +jit.on()
> +irconst3()
> +irconst3()
> +jit.off()
> +test:ok(ntrace_old + 1 == misc.getmetrics().jit_trace_num,
> + 'trace number increases')
Typo: I doubt we use tabs in Lua sources, but I might be wrong...
> +
> +ntrace_old = misc.getmetrics().jit_trace_num
> +jit.on()
> +irconst4()
> +irconst4()
> +jit.off()
> +test:ok(ntrace_old == misc.getmetrics().jit_trace_num,
> + 'trace number is the same')
Ditto.
> +
> +os.exit(test:check() and 0 or 1)
> --
> 2.34.1
>
--
Best regards,
IM
next prev parent reply other threads:[~2022-01-27 23:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-29 12:27 Sergey Kaplun via Tarantool-patches
2022-01-27 23:18 ` Igor Munkin via Tarantool-patches [this message]
2022-01-28 8:42 ` Sergey Kaplun via Tarantool-patches
2022-01-28 11:55 ` Igor Munkin via Tarantool-patches
2022-01-28 12:35 ` Sergey Kaplun via Tarantool-patches
2022-01-28 14:16 ` sergos via Tarantool-patches
2022-01-28 15:09 ` Sergey Kaplun via Tarantool-patches
2022-01-28 21:28 ` Sergey Ostanevich via Tarantool-patches
2022-01-28 21:45 ` Igor Munkin via Tarantool-patches
2022-01-29 1:17 ` Sergey Kaplun via Tarantool-patches
2022-02-11 19:09 ` 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=YfMoV/2aiGDkx10z@tarantool.org \
--to=tarantool-patches@dev.tarantool.org \
--cc=imun@tarantool.org \
--cc=skaplun@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH luajit] Actually implement maxirconst trace limit.' \
/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