Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Igor Munkin <imun@tarantool.org>, tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit] Fix string.char() recording with no arguments.
Date: Fri, 28 Jan 2022 15:49:40 +0300	[thread overview]
Message-ID: <YfPmZLJ5WemV+EFC@root> (raw)
In-Reply-To: <YfOoqPjpR7Brwmib@root>

Igor,

On 28.01.22, Sergey Kaplun via Tarantool-patches wrote:
> Igor,
> Thanks for the review!
> 
> On 28.01.22, Igor Munkin wrote:
> > Sergey,
> > 
> > Thanks for the patch! Please consider my comments below.
> > 
> > On 20.08.21, Sergey Kaplun wrote:

<snipped>

> > 
> > Minor: Strictly saying, this is not quite true. The right description is
> > the following:
> > * 1 -- instruction becomes hot.
> > * 2 -- recording of the loop body.
> > * 3 -- required for trace finalization, but this iteration runs the
> >   generated mcode. NB: the issue doesn't occur, since execution leaves
> >   the trace on table resizing guard.
> > * 4 -- reproduces the issue.
> > 
> > Hence, if you allocate the table with necessary size (3 in our case),
> > then only 3 iterations are needed. Please adjust the comment above and
> > the code below.
> 
> Fixed, thanks!
> 
> See the iterative patch below.
> Branch is force-pushed.
> ===================================================================
> diff --git a/test/tarantool-tests/gh-6371-string-char-no-arg.test.lua b/test/tarantool-tests/gh-6371-string-char-no-arg.test.lua
> index 6df93f07..61d02101 100644
> --- a/test/tarantool-tests/gh-6371-string-char-no-arg.test.lua
> +++ b/test/tarantool-tests/gh-6371-string-char-no-arg.test.lua
> @@ -6,11 +6,12 @@ local tap = require('tap')
>  
>  local test = tap.test('gh-6371-string-char-no-arg')
>  -- XXX: Number of loop iterations.
> --- 1, 2 -- instruction becomes hot
> --- 3 -- trace is recorded (considering loop recording specifics),
> --- but bytecodes are still executed via VM
> --- 4 -- trace is executed, need to check that emitted mcode is
> ---      correct
> +-- * 1 -- instruction becomes hot.
> +-- * 2 -- recording of the loop body.
> +-- * 3 -- required for trace finalization, but this iteration runs the
> +--   generated mcode. NB: the issue doesn't occur, since execution leaves
> +--   the trace on table resizing guard.
> +-- * 4 -- reproduces the issue.
>  local NTEST = 4
>  test:plan(NTEST)
>  
> ===================================================================

Modified test for 3 iterations without side exit from trace.

===================================================================
diff --git a/test/tarantool-tests/gh-6371-string-char-no-arg.test.lua b/test/tarantool-tests/gh-6371-string-char-no-arg.test.lua
index 61d02101..93f0fbfb 100644
--- a/test/tarantool-tests/gh-6371-string-char-no-arg.test.lua
+++ b/test/tarantool-tests/gh-6371-string-char-no-arg.test.lua
@@ -8,15 +8,14 @@ local test = tap.test('gh-6371-string-char-no-arg')
 -- XXX: Number of loop iterations.
 -- * 1 -- instruction becomes hot.
 -- * 2 -- recording of the loop body.
--- * 3 -- required for trace finalization, but this iteration runs the
---   generated mcode. NB: the issue doesn't occur, since execution leaves
---   the trace on table resizing guard.
--- * 4 -- reproduces the issue.
-local NTEST = 4
+-- * 3 -- reproduces the issue.
+local NTEST = 3
 test:plan(NTEST)
 
 -- Storage for the results to avoid trace aborting by `test:ok()`.
-local results = {}
+-- XXX: Use `table.new()` here to avoid side exit from trace by
+-- table resizing.
+local results = require('table.new')(3, 0)
 jit.opt.start('hotloop=1')
 for _ = 1, NTEST do
   table.insert(results, string.char())
===================================================================

> 
> > 

<snipped>

> > 
> > -- 
> > Best regards,
> > IM
> 
> -- 
> Best regards,
> Sergey Kaplun

-- 
Best regards,
Sergey Kaplun

  reply	other threads:[~2022-01-28 12:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 15:48 Sergey Kaplun via Tarantool-patches
2021-08-31 11:39 ` Sergey Ostanevich via Tarantool-patches
2021-09-01  7:10   ` Sergey Kaplun via Tarantool-patches
2022-01-10 11:48     ` sergos via Tarantool-patches
2022-01-27 21:46 ` Igor Munkin via Tarantool-patches
2022-01-27 22:02   ` Igor Munkin via Tarantool-patches
2022-01-28  8:26   ` Sergey Kaplun via Tarantool-patches
2022-01-28 12:49     ` Sergey Kaplun via Tarantool-patches [this message]
2022-01-28 13:19     ` Igor Munkin via Tarantool-patches
2022-01-28 15:12       ` 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=YfPmZLJ5WemV+EFC@root \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imun@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit] Fix string.char() recording with no arguments.' \
    /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