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 CC2556EC40; Tue, 17 Aug 2021 11:22:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org CC2556EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1629188527; bh=TWkIvqUMt9vsvC+UPpbVxenVbiOg1OeVFED9BQHS82g=; 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=KoWBeMzf/wBQxFkfH6Th5XSbGwV/HO3uFT0BGI49PjuDvxEcUlPRTStA6oI9d1/AI L0hAoW5UaMVF9mlD2qL4DXX8wYYL1Idt7EFC7l9u8CrCGFol679BUXizuiMayZmJy2 BFRxlnh1AHtpNr8JO4n6EH3o7eKsHxpIUMinQlKI= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 26A6B6EC40 for ; Tue, 17 Aug 2021 11:22:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 26A6B6EC40 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1mFuMG-0001Qt-0a; Tue, 17 Aug 2021 11:22:04 +0300 Date: Tue, 17 Aug 2021 10:56:54 +0300 To: Sergey Kaplun Message-ID: <20210817075654.GC5743@tarantool.org> References: <1628864967.181226130@f723.i.mail.ru> <20210814113834.1171307-1-m.kokryashkin@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.10.1 (2018-07-13) X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD9F9A2272A1D086A28553D1D5C4B4124EF182A05F538085040BF0535A72661C8F622514A377810C3C41CD1BD5A8B639C71FAB5977904DB0F14 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7AED985C8E545F588EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063767500BC4578134A08638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D83564016E1570509652379C4B700F24E9117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAA867293B0326636D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8BF1175FABE1C0F9B6A471835C12D1D977C4224003CC8364762BB6847A3DEAEFB0F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7CE0F3BA37685B2B9043847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A50DB6420429A03619176FD3662754CA368F36C9E39FAE1A0AD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7567C209D01CC1E34B410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D348F343DA43F62289FFA2A2DA7BBD7D6ABDF0751E8A0ECCB525EE4CBF1679C5F2FFFDBCB7A6FE6292A1D7E09C32AA3244CA930E4CDED600A955B3D104659DAC83BE3D93501275E802F927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojIrFL/N5KnVFbWtnCsZWx0g== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5DCD5C631DBC9AEA6C07FA42F445F2B3BBA7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit v2] luajit-gdb: support dualnum mode 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: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Sergey, On 14.08.21, Sergey Kaplun wrote: > Hi, Maxim! > > Thanks for the fixes! > > LGTM, except two nitpicks below. > > On 14.08.21, Maxim Kokryashkin wrote: > > diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py > > index c50405ad..d4882dd7 100644 > > --- a/src/luajit-gdb.py > > +++ b/src/luajit-gdb.py > > @@ -238,8 +238,11 @@ def jit_state(g): > > 0x15: 'ERR', > > }.get(int(J(g)['state']), 'INVALID') > > > > +def tvisint(o): > > + return LJ_DUALNUM and itype(o) == LJ_TISNUM > > + > > def tvisnumber(o): > > - return itype(o) <= (0xfffeffff if LJ_64 and not LJ_GC64 else LJ_T['NUMX']) > > + return itype(o) <= LJ_TISNUM > > Strictly saying, it is `<`, because `==` is staying for integer > representation. At first, I believed you're right, but unfortunately, you're wrong. Consider the following: | $ cmake . -DLUAJIT_NUMMODE=2 -DCMAKE_BUILD_TYPE=Debug | # Manually enable LJ_DUALNUM for x64 | $ make -j | | $ cd src | $ gdb --args ./luajit -e 'print(1)' | | Reading symbols from ./luajit... | lj-arch command initialized | lj-tv command initialized | lj-str command initialized | lj-tab command initialized | lj-stack command initialized | lj-state command initialized | lj-gc command initialized | luajit-gdb.py is successfully loaded | (gdb) b lj_cf_print | Breakpoint 1 at 0x2960a: file /luajit/src/lib_base.c, line 485. | (gdb) r | Starting program: /luajit/src/luajit -e print\(1\) | | Breakpoint 1, lj_cf_print (L=0x0) at /luajit/src/lib_base.c:485 | 485 { | (gdb) n | 486 ptrdiff_t i, nargs = L->top - L->base; | (gdb) lj-stack L | 0x40001a50:0x40001a70 [ ] 5 slots: Red zone | 0x40001a48 [ M] | 0x40001958:0x40001a40 [ ] 30 slots: Free stack slots | 0x40001950 [ T ] | 0x40001948 [ B ] VALUE: not valid type @ 0x1 | 0x40001940 [ ] FRAME: [L] delta=1, fast function #29 | 0x40001938 [ ] FRAME: [V] delta=1, Lua function @ 0x40008428, 0 upvalues, "=(command line)":0 | 0x40001930 [ ] FRAME: [CP] delta=3, Lua function @ 0x40008428, 0 upvalues, "=(command line)":0 | 0x40001928 [ ] VALUE: C function @ 0x55555555c945 | 0x40001920 [ ] VALUE: light userdata @ 0x0 | 0x40001918 [ ] FRAME: [CP] delta=1, C function @ 0x55555555def8 | 0x40001910 [S ] FRAME: dummy L There is a "not valid type" stub, since < is used instead of <=. I reverted this change and here is the result: | $ git diff | diff --git a/src/luajit-gdb.py b/src/luajit-gdb.py | index f7347cf3..4488775c 100644 | --- a/src/luajit-gdb.py | +++ b/src/luajit-gdb.py | @@ -243,7 +243,7 @@ def tvisint(o): | return LJ_DUALNUM and itype(o) == LJ_TISNUM | | def tvisnumber(o): | - return itype(o) < LJ_TISNUM | + return itype(o) <= LJ_TISNUM | | def tvislightud(o): | if LJ_64 and not LJ_GC64: | $ cmake . -DLUAJIT_NUMMODE=2 -DCMAKE_BUILD_TYPE=Debug | # Manually enable LJ_DUALNUM for x64 | $ make -j | | $ cd src | $ gdb --args ./luajit -e 'print(1)' | | Reading symbols from ./luajit... | lj-arch command initialized | lj-tv command initialized | lj-str command initialized | lj-tab command initialized | lj-stack command initialized | lj-state command initialized | lj-gc command initialized | luajit-gdb.py is successfully loaded | (gdb) b lj_cf_print | Breakpoint 1 at 0x2960a: file /luajit/src/lib_base.c, line 485. | (gdb) r | Starting program: /luajit/src/luajit -e print\(1\) | | Breakpoint 1, lj_cf_print (L=0x0) at /luajit/src/lib_base.c:485 | 485 { | (gdb) n | 486 ptrdiff_t i, nargs = L->top - L->base; | (gdb) lj-stack L | 0x40001a50:0x40001a70 [ ] 5 slots: Red zone | 0x40001a48 [ M] | 0x40001958:0x40001a40 [ ] 30 slots: Free stack slots | 0x40001950 [ T ] | 0x40001948 [ B ] VALUE: integer 1 | 0x40001940 [ ] FRAME: [L] delta=1, fast function #29 | 0x40001938 [ ] FRAME: [V] delta=1, Lua function @ 0x40008428, 0 upvalues, "=(command line)":0 | 0x40001930 [ ] FRAME: [CP] delta=3, Lua function @ 0x40008428, 0 upvalues, "=(command line)":0 | 0x40001928 [ ] VALUE: C function @ 0x55555555c945 | 0x40001920 [ ] VALUE: light userdata @ 0x0 | 0x40001918 [ ] FRAME: [CP] delta=1, C function @ 0x55555555def8 | 0x40001910 [S ] FRAME: dummy L Hence, I dropped this change from the resulting patch. > > > -- > Best regards, > Sergey Kaplun -- Best regards, IM