From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Maksim Kokryashkin <max.kokryashkin@gmail.com> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH luajit v2] Fix narrowing of unary minus. Date: Wed, 21 Sep 2022 11:48:47 +0300 [thread overview] Message-ID: <YyrP76rSxIuUFcNN@root> (raw) In-Reply-To: <20220920111649.86190-1-max.kokryashkin@gmail.com> Hi, Maxim! Thanks for the fixes! LGTM, except a few nits below. On 20.09.22, Maksim Kokryashkin wrote: > From: Mike Pall <mike> > <snipped> > src/lj_opt_narrow.c | 9 +++- > .../gh-6976-narrowing-of-unary-minus.test.lua | 51 +++++++++++++++++++ > 2 files changed, 58 insertions(+), 2 deletions(-) > create mode 100644 test/tarantool-tests/gh-6976-narrowing-of-unary-minus.test.lua > > diff --git a/src/lj_opt_narrow.c b/src/lj_opt_narrow.c > index cd96ca4b..bb61f97b 100644 > --- a/src/lj_opt_narrow.c > +++ b/src/lj_opt_narrow.c <snipped> > diff --git a/test/tarantool-tests/gh-6976-narrowing-of-unary-minus.test.lua b/test/tarantool-tests/gh-6976-narrowing-of-unary-minus.test.lua > new file mode 100644 > index 00000000..18778a55 > --- /dev/null > +++ b/test/tarantool-tests/gh-6976-narrowing-of-unary-minus.test.lua > @@ -0,0 +1,51 @@ > +local tap = require('tap') > +local test = tap.test('gh-6976-narrowing-of-unary-minus') > +test:plan(2) > + > +jit.opt.start('hotloop=1', 'hotexit=1') As far as we use `table.new` there is no table resizing, so there are no exits from traces to compile and 'hotexit=1' can be removed. > + > +local function check(routine) > + jit.off() > + jit.flush() > + local interp_res = routine() > + jit.on() > + local jit_res = routine() > + > + for i = 1, #interp_res do > + if interp_res[i] ~= jit_res[i] then > + return false > + end > + end > + > + return true > +end > + > +test:ok( Minor: I suggest the following indentation to make this chunk more readable: | test:ok(check(function() | local res = require('table.new')(3, 0) | for _ = 1, 3 do | local zero = 0 | zero = -zero | table.insert(res, tostring(zero)) | end | return res | end), 'incorrect recording for zero') Feel free to ignore. > + check( > + function() > + local res = require('table.new')(3, 0) Please, add a comment why do we use `table.new` here. > + for _ = 1, 3 do > + local zero = 0 > + zero = -zero > + table.insert(res, tostring(zero)) Minor: we need `tostring()` routine to get different strings for -0 and 0, as far as 0 == -0 as numbers. Please, add the corresponding comment. > + end > + return res > + end > + ), > + 'incorrect recording for zero' > +) > + Ditto, about indentation. Feel free to ignore. > +test:ok( > + check( > + function() > + local res = require('table.new')(3, 0) > + for i = 2, 0, -1 do > + table.insert(res, tostring(-i)) > + end > + return res > + end > + ), > + 'assertion guard fail' > +) > + > +os.exit(test:check() and 0 or 1) > -- > 2.32.1 (Apple Git-133) > -- Best regards, Sergey Kaplun
next prev parent reply other threads:[~2022-09-21 8:51 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-09-09 12:15 [Tarantool-patches] [PATCH luajit] " Maksim Kokryashkin via Tarantool-patches 2022-09-14 22:06 ` Sergey Kaplun via Tarantool-patches 2022-09-20 11:16 ` [Tarantool-patches] [PATCH luajit v2] " Maksim Kokryashkin via Tarantool-patches 2022-09-21 8:48 ` Sergey Kaplun via Tarantool-patches [this message] 2022-09-25 21:31 ` sergos via Tarantool-patches 2022-09-29 9:58 ` Maxim Kokryashkin via Tarantool-patches 2022-09-29 13:08 ` Sergey Kaplun via Tarantool-patches 2022-10-03 9:57 ` Maxim Kokryashkin via Tarantool-patches 2022-11-30 10:40 ` sergos via Tarantool-patches 2022-12-12 9:42 ` [Tarantool-patches] [PATCH luajit] " 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=YyrP76rSxIuUFcNN@root \ --to=tarantool-patches@dev.tarantool.org \ --cc=max.kokryashkin@gmail.com \ --cc=skaplun@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH luajit v2] Fix narrowing of unary minus.' \ /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