From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Sergey Bronnikov <sergeyb@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH luajit] Fix maxslots when recording BC_VARG, part 3. Date: Tue, 22 Aug 2023 18:44:08 +0300 [thread overview] Message-ID: <ZOTXyLt2x9FcXCt6@root> (raw) In-Reply-To: <27744ffa-a0f8-56dc-15f7-3c367b68a7f8@tarantool.org> Hi, Sergey! Thanks for the review! Fixed your comment and force-pushed the branch. On 21.08.23, Sergey Bronnikov wrote: > Hi, Sergey > > thanks for the patch! See comment inline. > > > On 8/15/23 15:32, Sergey Kaplun wrote: > > From: Mike Pall <mike> <snipped> > > +local anchor > > +local N_ITER = 5 > > +local SIDE_ITER = N_ITER - 1 > > +for i = 1, N_ITER do > > + -- In case, when `BC_VARG` set the VARG slot to the non-top > > + -- stack slot, `maxslot` value was unconditionally set to the > > + -- destination slot, so the following snapshot is used: > > + -- SNAP #4 [ ---- ---- ---- nil ] > > + -- instead of: > > + -- SNAP #4 [ ---- nil ---- ---- 0009 0001 ---- 0009 ] > > + -- Since these slots are omitted, they are not restored > > + -- correctly, when restoring from snapshot for this side exit. > > + anchor = ... > > + if i > SIDE_ITER then > > + -- XXX: Don't use `test:ok()` here to avoid double-running of > > + -- tests in case of `i` incorrect restoring from the snapshot. > > + assert(i > SIDE_ITER) > > + end > > +end > > + > > +test:ok(true, 'BC_VARG recording 0th frame depth, 1 result') > > This always passed testcase is confused and it will confuse everyone who > will use test. > > I propose to replace test:ok() to test:diag: > <snipped> > > > or you can define a global variable and replace assert with assigning > result to this variable. I preferred this option: =================================================================== diff --git a/test/tarantool-tests/lj-1046-fix-bc-varg-recording.test.lua b/test/tarantool-tests/lj-1046-fix-bc-varg-recording.test.lua index 30a87e54..8bdd49eb 100644 --- a/test/tarantool-tests/lj-1046-fix-bc-varg-recording.test.lua +++ b/test/tarantool-tests/lj-1046-fix-bc-varg-recording.test.lua @@ -11,6 +11,9 @@ jit.opt.start('hotloop=1') local anchor local N_ITER = 5 local SIDE_ITER = N_ITER - 1 + +local consistent_snap_restore = false + for i = 1, N_ITER do -- This trace generates the following IRs: -- 0001 > int SLOAD #7 CRI @@ -45,11 +48,12 @@ for i = 1, N_ITER do -- XXX: `test:ok()` isn't used here to avoid double-running of -- tests in case of `i` incorrect restoration from the -- snapshot. - assert(i > SIDE_ITER) + consistent_snap_restore = i > SIDE_ITER + break end end -test:ok(true, 'BC_VARG recording 0th frame depth, 1 result') +test:ok(consistent_snap_restore, 'BC_VARG recording 0th frame depth, 1 result') -- Now the same case, but with an additional frame, so VARG slots -- are defined on the trace. @@ -59,14 +63,17 @@ local function varg_frame(anchor, i, side_iter, ...) -- XXX: `test:ok()` isn't used here to avoid double-running of -- tests in case of `i` incorrect restoration from the -- snapshot. - assert(i > side_iter) + consistent_snap_restore = i > side_iter end end +consistent_snap_restore = false + for i = 1, N_ITER do varg_frame(nil, i, SIDE_ITER) end -test:ok(true, 'BC_VARG recording with VARG slots defined on trace, 1 result') +test:ok(consistent_snap_restore, + 'BC_VARG recording with VARG slots defined on trace, 1 result') test:done(true) =================================================================== > > then check expected and actual value for global variable using test:ok(). > <snipped> > > > > + <snipped> -- Best regards, Sergey Kaplun
next prev parent reply other threads:[~2023-08-22 15:48 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-08-15 12:32 Sergey Kaplun via Tarantool-patches 2023-08-16 13:51 ` Maxim Kokryashkin via Tarantool-patches 2023-08-16 16:11 ` Sergey Kaplun via Tarantool-patches 2023-08-17 13:16 ` Maxim Kokryashkin via Tarantool-patches 2023-08-21 13:38 ` Sergey Bronnikov via Tarantool-patches 2023-08-22 15:44 ` Sergey Kaplun via Tarantool-patches [this message] 2023-08-28 13:15 ` Sergey Bronnikov via Tarantool-patches 2023-08-31 15:18 ` 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=ZOTXyLt2x9FcXCt6@root \ --to=tarantool-patches@dev.tarantool.org \ --cc=sergeyb@tarantool.org \ --cc=skaplun@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH luajit] Fix maxslots when recording BC_VARG, part 3.' \ /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