Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Bronnikov <sergeyb@tarantool.org>,
	tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit] Restore state when recording __concat metamethod throws an error.
Date: Fri, 13 Sep 2024 18:48:55 +0300	[thread overview]
Message-ID: <ZuRe5ymlfY5cY8_1@root> (raw)
In-Reply-To: <ZuRZxP2dmP-IQE0Z@root>

One more minor update below.

On 13.09.24, Sergey Kaplun via Tarantool-patches wrote:
> Hi, Sergey!
> Thanks for the review!
> 
> On 13.09.24, Sergey Bronnikov wrote:
> > Hi, Sergey,
> > 
> > thanks for the patch! LGTM with a minor comment. See below.
> > 
> > On 21.08.2024 11:23, Sergey Kaplun wrote:
> > 
> > 
> > <snipped>
> > 
> > > +-- Need to use metamethod call in the concat recording.
> > > +debug.setmetatable(nil, {
> > I propose to add a comment that explain why `nil` is used here.
> 
> I've removed the nil usage to avoid confusion.
> Branch is rebased on the current master and force-pushed.
> ===================================================================
> diff --git a/test/tarantool-tests/lj-1234-err-in-record-concat.test.lua b/test/tarantool-tests/lj-1234-err-in-record-concat.test.lua
> index 9abaeba5..4fe02708 100644
> --- a/test/tarantool-tests/lj-1234-err-in-record-concat.test.lua
> +++ b/test/tarantool-tests/lj-1234-err-in-record-concat.test.lua
> @@ -12,12 +12,13 @@ test:plan(2)
>  
>  jit.opt.start('hotloop=1')
>  
> -local __concat = function(v1, v2)
> -    return tostring(v1) .. tostring(v2)
> +local __concat = function()
> +  return ''
>  end
>  
>  -- Need to use metamethod call in the concat recording.
> -debug.setmetatable(nil, {
> +-- Let's use a table with the metamethod.
> +local concatable_t = setmetatable({}, {
>    __concat = __concat,
>  })
>  
> @@ -31,7 +32,7 @@ local function test_concat_p()
>      -- `lj_record_ret()` restore the Lua stack (before the patch),
>      -- it becomes unbalanced after the instruction recording
>      -- attempt.
> -    local _ = {} .. (nil .. nil)
> +    local _ = {} .. (concatable_t .. concatable_t)
>    end
>  end
>  
> ===================================================================

Added more verbose description:

===================================================================
diff --git a/test/tarantool-tests/lj-1234-err-in-record-concat.test.lua b/test/tarantool-tests/lj-1234-err-in-record-concat.test.lua
index 4fe02708..75736e74 100644
--- a/test/tarantool-tests/lj-1234-err-in-record-concat.test.lua
+++ b/test/tarantool-tests/lj-1234-err-in-record-concat.test.lua
@@ -17,7 +17,8 @@ local __concat = function()
 end
 
 -- Need to use metamethod call in the concat recording.
--- Let's use a table with the metamethod.
+-- We may use any object with a metamethod, but let's use a table
+-- as the most common one.
 local concatable_t = setmetatable({}, {
   __concat = __concat,
 })
===================================================================

> 
> > > +  __concat = __concat,
> > > +})
> > > +
> 
> <snipped>
> 
> -- 
> Best regards,
> Sergey Kaplun

-- 
Best regards,
Sergey Kaplun

  reply	other threads:[~2024-09-13 15:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-21  8:23 Sergey Kaplun via Tarantool-patches
2024-09-13 13:07 ` Sergey Bronnikov via Tarantool-patches
2024-09-13 15:27   ` Sergey Kaplun via Tarantool-patches
2024-09-13 15:48     ` Sergey Kaplun via Tarantool-patches [this message]
2024-09-17  6:33       ` Sergey Bronnikov via Tarantool-patches
2024-09-23  6:30       ` Maxim Kokryashkin via Tarantool-patches
2024-10-18 15:14 ` Sergey Kaplun 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=ZuRe5ymlfY5cY8_1@root \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit] Restore state when recording __concat metamethod throws an error.' \
    /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