* [Tarantool-patches] [PATCH luajit] Clear stack after print_jit_status() in CLI.
@ 2024-09-11 7:04 Sergey Kaplun via Tarantool-patches
2024-09-12 11:49 ` Sergey Bronnikov via Tarantool-patches
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2024-09-11 7:04 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
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)
--
2.46.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit] Clear stack after print_jit_status() in CLI.
2024-09-11 7:04 [Tarantool-patches] [PATCH luajit] Clear stack after print_jit_status() in CLI Sergey Kaplun via Tarantool-patches
@ 2024-09-12 11:49 ` Sergey Bronnikov via Tarantool-patches
2024-09-19 9:20 ` Maxim Kokryashkin via Tarantool-patches
2024-10-18 15:12 ` Sergey Kaplun via Tarantool-patches
2 siblings, 0 replies; 4+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2024-09-12 11:49 UTC (permalink / raw)
To: Sergey Kaplun, Maxim Kokryashkin; +Cc: tarantool-patches
[-- 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 --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit] Clear stack after print_jit_status() in CLI.
2024-09-11 7:04 [Tarantool-patches] [PATCH luajit] Clear stack after print_jit_status() in CLI Sergey Kaplun via Tarantool-patches
2024-09-12 11:49 ` Sergey Bronnikov via Tarantool-patches
@ 2024-09-19 9:20 ` Maxim Kokryashkin via Tarantool-patches
2024-10-18 15:12 ` Sergey Kaplun via Tarantool-patches
2 siblings, 0 replies; 4+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2024-09-19 9:20 UTC (permalink / raw)
To: Sergey Kaplun; +Cc: tarantool-patches
Hi, Sergey!
Thanks for the patch!
LGTM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit] Clear stack after print_jit_status() in CLI.
2024-09-11 7:04 [Tarantool-patches] [PATCH luajit] Clear stack after print_jit_status() in CLI Sergey Kaplun via Tarantool-patches
2024-09-12 11:49 ` Sergey Bronnikov via Tarantool-patches
2024-09-19 9:20 ` Maxim Kokryashkin via Tarantool-patches
@ 2024-10-18 15:12 ` Sergey Kaplun via Tarantool-patches
2 siblings, 0 replies; 4+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2024-10-18 15:12 UTC (permalink / raw)
To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches
I've applied the patch into all long-term branches in tarantool/luajit
and bumped a new version in master [1], release/3.2 [2] and
release/2.11 [3].
[1]: https://github.com/tarantool/tarantool/pull/10712
[2]: https://github.com/tarantool/tarantool/pull/10713
[3]: https://github.com/tarantool/tarantool/pull/10714
--
Best regards,
Sergey Kaplun
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-18 15:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-11 7:04 [Tarantool-patches] [PATCH luajit] Clear stack after print_jit_status() in CLI Sergey Kaplun via Tarantool-patches
2024-09-12 11:49 ` Sergey Bronnikov via Tarantool-patches
2024-09-19 9:20 ` Maxim Kokryashkin via Tarantool-patches
2024-10-18 15:12 ` Sergey Kaplun via Tarantool-patches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox