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 D275A6ECDC; Sat, 17 Oct 2026 11:39:52 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D275A6ECDC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1792226392; bh=fadKViVoj3ZO6bLHWyqT7QSYeQ/7V133nef7sL64Kkc=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=fRZc2zBCE7jmy/gsxkOsuqxYLlqCXIdyCd5GLeOaAYOnqX/yKA4CBEj9xneP6F9fQ OVrUI14o9TuwUhmg8Y99msLgpaz/vbvbX38cbQCx7Nf8NqduAQwy5mNg95MCxG9uzo NmuEoD0uJm141aL+gR1W+KOzL7bRmCc0bwu4b2qs= Received: from send173.i.mail.ru (send173.i.mail.ru [95.163.59.12]) (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 721E66ECDC for ; Sat, 17 Oct 2026 11:39:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 721E66ECDC Received: by exim-smtp-84d6fb566c-jmhn5 with esmtpa (envelope-from ) id 1xHzxG-000000007mM-0Zc3; Sat, 17 Oct 2026 11:39:50 +0300 Content-Type: multipart/alternative; boundary="------------WM9Oiy4MGbw0jWVuqXGNpJv0" Message-ID: Date: Sat, 17 Oct 2026 11:39:43 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Sergey Kaplun References: <20261015072055.317299-1-m.elhimov@vk.team> <20261015234516.385484-1-m.elhimov@vk.team> Content-Language: en-US In-Reply-To: X-Mailru-Src: smtp X-618D5548: FD8CB774F3649AB891417EB218679B828720B140B68F349DE5BA8E5B501445DCBFC34FA86924370F X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9D5ABD805758C3F0B6A7048CC65C8CB6A9213BBDA6D6CB42F182A05F538085040C75A4F9F36C9E1663DE06ABAFEAF670526B9420C42F17DDD9ACC21A15296AED131CC4806F04841A8 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE76D24A1449B9F25A2EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB553375667E1D4B08D42AEC87251358C75B21FE52C560FD5F346E7D02AF886DB4553C77DE8EEF46B7454FC60B9742502CCDD46D0DB11811A4A51E3B096D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE7527B0424B205B5A0731C566533BA786AA5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A52A3B8194C89A263E5002B1117B3ED6961280FB2944D3CEDD03803A57F48E4E5A823CB91A9FED034534781492E4B8EEAD4ECBDE8281F904F9BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34C77DD89D51EBB774225B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659B4CF227631EE702FD3AF18525613EF14918EC39E4DE61D91AC0BEA6AD28C3F97F7D325F200AB34E3B8341EE9D5BE9A0AB351850B8D92C76218F656FE7DEB0F5869CD1C504DED0272C7CEAA0681F5848F4C41F94D744909CE9D6718F459EE2962AE54DA86D399E591103B389C0A9E82E8 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXOcIETfglQORZ0zpDET4Zrk3igikrdHlWPGzvyHscFbMsl0Q2O/NArY= X-Mailru-Sender: 689FA8AB762F73937C9FA53A4753B313583E6A5C696DDF8B0AD231649DCFA3CF6A921D3F70906844567B8845310477678B5D19FF33E2B21BC8157BDAF8912DC0981874AA068F0975204DA63403278206F52067E1A4DAC7CAC77752E0C033A69E3453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit v2] dbg: remove wrong GC state 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: Mikhail Elhimov via Tarantool-patches Reply-To: Mikhail Elhimov Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This is a multi-part message in MIME format. --------------WM9Oiy4MGbw0jWVuqXGNpJv0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Sergey! Thanks for the review! On 16.10.2026 15:54, Sergey Kaplun wrote: > Hi, Mikhail! > Thanks for the patch! > LGTM, after adding the comment for the testing snippet, see below. > > On 16.10.26, Mikhail Elhimov wrote: >> It has been copied by mistake from the LuaVela fork of LuaJIT. >> --- >> Changes in v2: >> * Rebased ontohttps://lists.tarantool.org/pipermail/tarantool-patches/2026-October/030859.html to avoid conflicts >> >> This patch is to be applied afterhttps://lists.tarantool.org/pipermail/tarantool-patches/2026-October/030859.html >> >> Branch:https://github.com/tarantool/luajit/tree/elhimov/gh-noticket-dbg-remove-wrong-gcstate >> >> src/luajit_dbg.py | 3 +- >> .../debug-extension-tests.py | 96 +++++++++++++++++-- >> 2 files changed, 87 insertions(+), 12 deletions(-) >> >> diff --git a/src/luajit_dbg.py b/src/luajit_dbg.py >> index a685ecfa..8f7249ab 100644 >> --- a/src/luajit_dbg.py >> +++ b/src/luajit_dbg.py > > >> diff --git a/test/tarantool-debugger-tests/debug-extension-tests.py b/test/tarantool-debugger-tests/debug-extension-tests.py >> index bbd53dcc..735de2cb 100644 >> --- a/test/tarantool-debugger-tests/debug-extension-tests.py >> +++ b/test/tarantool-debugger-tests/debug-extension-tests.py > > >> +class TestGCStateBase(TestCaseBase): >> + extension_cmds = ( >> + 'lj-state\n' >> + 'lj-gc\n' >> + ) >> + lua_script = ( >> + 'local obj = newproxy(true)\n' >> + 'getmetatable(obj).__gc = function() end\n' >> + 'obj = nil\n' >> + 'collectgarbage()\n' >> + ) > It would be nice to add the comment here explaining why __all__ GC > states are reachable through this Lua code: > 1) `gc_mark_start()` (GCpause) is always present in the full GC cycle. > 2) `propagatemark()` (GCSpropagate) is reachable because our build has > FFI and the finalizer table is marked as a weak table, i.e. it is > grey. Hence, the g->gc.gray list is not empty. > 3) `atomic()` (GCSatomic) is always present in the full GC cycle. > 4) `gc_sweep_str_chain()` (GCSsweepstring) is always present in the full > GC cycle. > 5) `gc_sweep()` (GCSsweep) is always present in the full GC cycle. > 6) `gc_finalize()` is met due to the finalizer to userdata in the > script. Done >> + >> + @classmethod >> + def setUpClass(cls): >> + cls.pattern = ( >> + compose_lj_state_rx(cls.gc_state) + >> + compose_gc_stats_rx(cls.gc_state) >> + ) >> + super(TestGCStateBase, cls).setUpClass() >> + >> + >> +class TestGCStatePause(TestGCStateBase): >> + gc_state = GCS_PAUSE >> + location = 'gc_mark_start' >> + >> + >> +class TestGCStatePropagate(TestGCStateBase): >> + gc_state = GCS_PROPAGATE >> + location = 'propagatemark' >> + >> + >> +class TestGCStateAtomic(TestGCStateBase): >> + gc_state = GCS_ATOMIC >> + location = 'atomic' >> + >> + >> +class TestGCStateSweepString(TestGCStateBase): >> + gc_state = GCS_SWEEPSTRING >> + location = 'gc_sweep_str_chain' >> + >> + >> +class TestGCStateSweep(TestGCStateBase): >> + gc_state = GCS_SWEEP >> + location = 'gc_sweep' >> + >> + >> +class TestGCStateFinalize(TestGCStateBase): >> + gc_state = 'FINALIZE' >> + location = 'gc_finalize' >> + >> + >> STACK_RX = ( >> r'-+ Redzone:\s+\d+ slots -+\n' >> r'(' + RX_ADDR + r'\s+' + RX_FRAME + r' VALUE: nil\n?)*\n' >> -- >> 2.43.0 >> -- Best regards, Mikhail Elhimov --------------WM9Oiy4MGbw0jWVuqXGNpJv0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi, Sergey!

Thanks for the review!

On 16.10.2026 15:54, Sergey Kaplun wrote:
Hi, Mikhail!
Thanks for the patch!
LGTM, after adding the comment for the testing snippet, see below.

On 16.10.26, Mikhail Elhimov wrote:
It has been copied by mistake from the LuaVela fork of LuaJIT.
---
Changes in v2:
  * Rebased onto https://lists.tarantool.org/pipermail/tarantool-patches/2026-October/030859.html to avoid conflicts

This patch is to be applied after https://lists.tarantool.org/pipermail/tarantool-patches/2026-October/030859.html

Branch: https://github.com/tarantool/luajit/tree/elhimov/gh-noticket-dbg-remove-wrong-gcstate

 src/luajit_dbg.py                             |  3 +-
 .../debug-extension-tests.py                  | 96 +++++++++++++++++--
 2 files changed, 87 insertions(+), 12 deletions(-)

diff --git a/src/luajit_dbg.py b/src/luajit_dbg.py
index a685ecfa..8f7249ab 100644
--- a/src/luajit_dbg.py
+++ b/src/luajit_dbg.py
<snipped>

diff --git a/test/tarantool-debugger-tests/debug-extension-tests.py b/test/tarantool-debugger-tests/debug-extension-tests.py
index bbd53dcc..735de2cb 100644
--- a/test/tarantool-debugger-tests/debug-extension-tests.py
+++ b/test/tarantool-debugger-tests/debug-extension-tests.py
<snipped>

+class TestGCStateBase(TestCaseBase):
+    extension_cmds = (
+        'lj-state\n'
+        'lj-gc\n'
+    )
+    lua_script = (
+        'local obj = newproxy(true)\n'
+        'getmetatable(obj).__gc = function() end\n'
+        'obj = nil\n'
+        'collectgarbage()\n'
+    )
It would be nice to add the comment here explaining why __all__ GC
states are reachable through this Lua code:
1) `gc_mark_start()` (GCpause) is always present in the full GC cycle.
2) `propagatemark()` (GCSpropagate) is reachable because our build has
   FFI and the finalizer table is marked as a weak table, i.e. it is
   grey. Hence, the g->gc.gray list is not empty.
3) `atomic()` (GCSatomic) is always present in the full GC cycle.
4) `gc_sweep_str_chain()` (GCSsweepstring) is always present in the full
   GC cycle.
5) `gc_sweep()` (GCSsweep) is always present in the full GC cycle.
6) `gc_finalize()` is met due to the finalizer to userdata in the
   script.
Done
+
+    @classmethod
+    def setUpClass(cls):
+        cls.pattern = (
+            compose_lj_state_rx(cls.gc_state) +
+            compose_gc_stats_rx(cls.gc_state)
+        )
+        super(TestGCStateBase, cls).setUpClass()
+
+
+class TestGCStatePause(TestGCStateBase):
+    gc_state = GCS_PAUSE
+    location = 'gc_mark_start'
+
+
+class TestGCStatePropagate(TestGCStateBase):
+    gc_state = GCS_PROPAGATE
+    location = 'propagatemark'
+
+
+class TestGCStateAtomic(TestGCStateBase):
+    gc_state = GCS_ATOMIC
+    location = 'atomic'
+
+
+class TestGCStateSweepString(TestGCStateBase):
+    gc_state = GCS_SWEEPSTRING
+    location = 'gc_sweep_str_chain'
+
+
+class TestGCStateSweep(TestGCStateBase):
+    gc_state = GCS_SWEEP
+    location = 'gc_sweep'
+
+
+class TestGCStateFinalize(TestGCStateBase):
+    gc_state = 'FINALIZE'
+    location = 'gc_finalize'
+
+
 STACK_RX = (
     r'-+ Red zone:\s+\d+ slots -+\n'
     r'(' + RX_ADDR + r'\s+' + RX_FRAME + r' VALUE: nil\n?)*\n'
-- 
2.43.0


    
-- 
Best regards,
Mikhail Elhimov
--------------WM9Oiy4MGbw0jWVuqXGNpJv0--