Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Kaplun <skaplun@tarantool.org>,
	Maxim Kokryashkin <m.kokryashkin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit] Clear stack after print_jit_status() in CLI.
Date: Thu, 12 Sep 2024 14:49:32 +0300	[thread overview]
Message-ID: <89770c16-48ad-40e6-a4b5-ff0b111c3b55@tarantool.org> (raw)
In-Reply-To: <20240911070405.28163-1-skaplun@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 1372 bytes --]

Hi, Sergey,

thanks for the patch! LGTM

On 11.09.2024 10:04, Sergey Kaplun wrote:
> From: Mike Pall <mike>
>
> Suggested by Hydroque.
>
> (cherry picked from commit 03cd5aa749c1bc3bb4b7d4289236b6096cb3dc85)
>
> This patch makes the Lua stack balanced after using the aforementioned
> function, which is considered a good practice [1]. Be aware that the
> only argument on the stack is dummy NULL from the `lua_cpcall()`, so it
> can be easily cleared. This doesn't change the behaviour since all calls
> of `print_jit_status()` are followed by `dotty()` with a call to
> `loadline()`, which clears the stack anyway.
>
> Sergey Kaplun:
> * added the description for the patch
>
> [1]:https://www.lua.org/manual/5.1/manual.html#lua_call
>
> Part of tarantool/tarantool#10199
> ---
>
> Branch:https://github.com/tarantool/luajit/tree/skaplun/lj-382-clear-stack-after-jit-status
> Issue:https://github.com/tarantool/tarantool/issues/10199
>
>   src/luajit.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/src/luajit.c b/src/luajit.c
> index b63c92d1..e04a5a30 100644
> --- a/src/luajit.c
> +++ b/src/luajit.c
> @@ -162,6 +162,7 @@ static void print_jit_status(lua_State *L)
>       fputs(s, stdout);
>     }
>     putc('\n', stdout);
> +  lua_settop(L, 0);  /* clear stack */
>   }
>   
>   static void createargtable(lua_State *L, char **argv, int argc, int argf)

[-- Attachment #2: Type: text/html, Size: 2093 bytes --]

  reply	other threads:[~2024-09-12 11:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11  7:04 Sergey Kaplun via Tarantool-patches
2024-09-12 11:49 ` Sergey Bronnikov via Tarantool-patches [this message]
2024-09-19  9:20 ` Maxim Kokryashkin 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=89770c16-48ad-40e6-a4b5-ff0b111c3b55@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=m.kokryashkin@tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit] Clear stack after print_jit_status() in CLI.' \
    /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