From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 2E0CBC4F09E; Wed, 11 Sep 2024 10:04:20 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2E0CBC4F09E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1726038260; bh=DRE/6TYm63bHYEo8pPzg0AGKgS8PX01oBESe1yelfh0=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=wbjIots+H1UFLsh31mJCTsqke7BZzN/vRFmaQJWTzMU+fzR5Uxo5yv94WxK/jvibA /HvgSwUqPlInhMC8tPhaplhQyz2KDu08Ym2ofwfUeGexaQT6X7R5IOhzkoBFgvpoON 9jhufv+RjTfL4cAWR/fOzQSTdFQpLbdIrVU5IuRk= Received: from smtp47.i.mail.ru (smtp47.i.mail.ru [95.163.41.85]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 266EBC4F099 for ; Wed, 11 Sep 2024 10:04:18 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 266EBC4F099 Received: by smtp47.i.mail.ru with esmtpa (envelope-from ) id 1soHOi-0000000BByY-2XeK; Wed, 11 Sep 2024 10:04:17 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Wed, 11 Sep 2024 10:04:05 +0300 Message-ID: <20240911070405.28163-1-skaplun@tarantool.org> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9FD43264444B6060C0128337A06CB4BF468FE2619388B0D43182A05F5380850407A45BA48FA20407F33594132A326AF8B666CEF000DE344CFD86EEA5A7C65EACDB76EC74E5D6971C8 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE73B44982FA5E78411EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063724FB3EE3D47C4C4C8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D863875E3C1B9CF54535155CBD31D40BA6D0F4E970AF7A583CCC7F00164DA146DAFE8445B8C89999728AA50765F7900637F6B57BC7E64490618DEB871D839B7333395957E7521B51C2DFABB839C843B9C08941B15DA834481F8AA50765F7900637BA939FD1B3BAB99B389733CBF5DBD5E9B5C8C57E37DE458B9E9CE733340B9D5F3BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E7350555CCFDA08FA3FAC4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A5DCBFB6C593EC131D5002B1117B3ED696D76C10D69CA1E7CCAD0703CEB2EF9A27823CB91A9FED034534781492E4B8EEAD42E5C09891E4E6C3F36E2E0160E5C55395B8A2A0B6518DF68C46860778A80D548E8926FB43031F38 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF77DD89D51EBB7742D3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFF83B1E83B747734BC01F8B79BD523571CC2721DFBFCF4F23B3CD593566FF69ECF449F18009991D96BA3E0C39EEA44CB3BFE2666E9FEEF34C97644A27B8E5CF90BD2994BCCCDB0638C226CC413062362A913E6812662D5F2A5EAB5682573093F7837F15F2B5E4A70B33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojmH7hiLB2kw0jXz27D2cTCQ== X-DA7885C5: 677AB755874C4013F255D290C0D534F9926ED2480C89516C238F6EA2C1CC6D94B1FEE9EE95D904185B1A4C17EAA7BC4BEF2421ABFA55128DAF83EF9164C44C7E X-Mailru-Sender: 689FA8AB762F7393C6D0B12EA33CAA9B1ED1E32AA205BF8FD982C45C29EF586679808535051077D2E49D44BB4BD9522A059A1ED8796F048DB274557F927329BE89D5A3BC2B10C37545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit] Clear stack after print_jit_status() in CLI. X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" From: Mike Pall 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