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 57AC36EC40; Sat, 14 Aug 2021 16:48:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 57AC36EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1628948907; bh=xNQPY69O8T/C0gMtfb4btk/yyVjDtyj4T4a4QKtuAb4=; 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=APsHtATUrwOawn0PE2VMGmtXvxUecJRbKO0spJBwgvA6u1saUtsmiVYn6AA8GGjnF EL63nn3cylT855Ht6pZmk/LI8sFRoOr1KGSfekfHu93T9+lIkBoQJjX9ixlgzERouw dOPnoimbHhKJgxToAkgQzr1+kkpyoId0Jkv0WMhY= Received: from smtp42.i.mail.ru (smtp42.i.mail.ru [94.100.177.102]) (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 DA6C06EC40 for ; Sat, 14 Aug 2021 16:48:25 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DA6C06EC40 Received: by smtp42.i.mail.ru with esmtpa (envelope-from ) id 1mEu1Q-0000yk-Vn; Sat, 14 Aug 2021 16:48:25 +0300 Date: Sat, 14 Aug 2021 16:47:08 +0300 To: Maxim Kokryashkin Message-ID: References: <1628864967.181226130@f723.i.mail.ru> <20210814113834.1171307-1-m.kokryashkin@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210814113834.1171307-1-m.kokryashkin@tarantool.org> X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD9ECFD080E047A606F56291F8739A291D6182A05F53808504055A65123871E07FB020B4F64A60981CF6BE9E1A6C2978EF5A9D230D4E9F44727 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE70D278D70F8433719EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637EA9DEEAA3ECF8E948638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D81BACACFEC970630C838CB875AC2718C1117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC974A882099E279BDA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18F04B652EEC242312D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6A45692FFBBD75A6A089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A5A58834AB9DBA11B521401DFEE7B7EFEF3A5FAB46AFBBA3DCD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA752DA3D96DA0CEF5C48E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34431D0341F6B74DD343A6B717E1E74CD8F775EADC2198F151282D54C28C58A455E132B2DE6F5DC7391D7E09C32AA3244CC98FEDF40F888531ACA7ED1D52F921FA4DBEAD0ED6C55A80927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj57i8v0hCSFKdX3QSwNcVHQ== X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB4AA2A242E08BCA8EC1301A83083F622E0083424222E4ED80FF2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A89437F6177E88F7363CDA0F3B3F5B9367 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: 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" Hi, Maxim! Thanks for the fixes! LGTM, except two nitpicks below. On 14.08.21, Maxim Kokryashkin wrote: > luajit-gdb.py displays integers in LJ_DUALNUM mode as nan-s. The > dumper function produces output thinking of any input value as of a > double. However, in DUALNUM mode, integers and doubles are stored > differently, so the `itype` of a float number must be less than > `LJ_TISNUM`, and the `itype` of an integer must be `LJ_TISNUM`. With > this fact in mind, we can easily differentiate one from another. > > Closes tarantool/tarantool#6224 > --- > Changes in v2: > - Fixed comments as per review by Sergey > > src/luajit-gdb.py | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > 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. > > def tvislightud(o): > if LJ_64 and not LJ_GC64: > @@ -343,7 +346,10 @@ def dump_lj_tudata(tv): > return 'userdata @ {}'.format(strx64(gcval(tv['gcr']))) > > def dump_lj_tnumx(tv): > - return 'number {}'.format(cast('double', tv['n'])) > + if tvisint(tv): > + return 'number {}'.format(cast('int32_t', tv['i'])) Nit: Lets change it to 'integer {}', as far as it is an integer value in the internal LuaJIT representation. > + else: > + return 'number {}'.format(cast('double', tv['n'])) > > def dump_lj_invalid(tv): > return 'not valid type @ {}'.format(strx64(gcval(tv['gcr']))) > @@ -683,7 +689,7 @@ The command requires no args and dumps current GC stats: > )) > > def init(commands): > - global LJ_64, LJ_GC64, LJ_FR2, PADDING > + global LJ_64, LJ_GC64, LJ_DUALNUM, LJ_TISNUM, LJ_FR2, PADDING > > # XXX Fragile: though connecting the callback looks like a crap but it > # respects both Python 2 and Python 3 (see #4828). > @@ -724,6 +730,7 @@ def init(commands): > try: > LJ_64 = str(gdb.parse_and_eval('IRT_PTR')) == 'IRT_P64' > LJ_FR2 = LJ_GC64 = str(gdb.parse_and_eval('IRT_PGC')) == 'IRT_P64' > + LJ_DUALNUM = lookup('lj_lib_checknumber') is not None > except: > gdb.write('luajit-gdb.py failed to load: ' > 'no debugging symbols found for libluajit\n') > @@ -733,6 +740,7 @@ def init(commands): > command(name) > > PADDING = ' ' * len(':' + hex((1 << (47 if LJ_GC64 else 32)) - 1)) > + LJ_TISNUM = 0xfffeffff if LJ_64 and not LJ_GC64 else LJ_T['NUMX'] > > gdb.write('luajit-gdb.py is successfully loaded\n') > > -- > 2.32.0 > -- Best regards, Sergey Kaplun