* [Tarantool-patches] [PATCH luajit v2 0/2] dbg: fix mapping of FPMATHOP @ 2026-09-15 13:09 Mikhail Elhimov via Tarantool-patches 2026-09-15 13:09 ` [Tarantool-patches] [PATCH luajit v2 1/2] dbg: fix mapping of FPMATHOP to string Mikhail Elhimov via Tarantool-patches 2026-09-15 13:09 ` [Tarantool-patches] [PATCH luajit v2 2/2] test: add debug extension tests for FPMATHOP Mikhail Elhimov via Tarantool-patches 0 siblings, 2 replies; 5+ messages in thread From: Mikhail Elhimov via Tarantool-patches @ 2026-09-15 13:09 UTC (permalink / raw) To: Sergey Kaplun, Sergey Bronnikov, Evgeniy Temirgaleev; +Cc: tarantool-patches This patchset fixes mapping of log/log2 FPMATHOP code into a human-readable form. The second patch extents tests to check the other FPMATHOP codes. Branch: https://github.com/tarantool/luajit/tree/elhimov/gh-13159-fix-fpmathop-mapping Related issue: https://github.com/tarantool/tarantool/issues/13159 Mikhail Elhimov (2): dbg: fix mapping of FPMATHOP to string test: add debug extension tests for FPMATHOP src/luajit_dbg.py | 1 - .../debug-extension-tests.py | 64 ++++++++++++++++++- 2 files changed, 63 insertions(+), 2 deletions(-) -- 2.43.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Tarantool-patches] [PATCH luajit v2 1/2] dbg: fix mapping of FPMATHOP to string 2026-09-15 13:09 [Tarantool-patches] [PATCH luajit v2 0/2] dbg: fix mapping of FPMATHOP Mikhail Elhimov via Tarantool-patches @ 2026-09-15 13:09 ` Mikhail Elhimov via Tarantool-patches 2026-09-21 11:23 ` Sergey Kaplun via Tarantool-patches 2026-09-15 13:09 ` [Tarantool-patches] [PATCH luajit v2 2/2] test: add debug extension tests for FPMATHOP Mikhail Elhimov via Tarantool-patches 1 sibling, 1 reply; 5+ messages in thread From: Mikhail Elhimov via Tarantool-patches @ 2026-09-15 13:09 UTC (permalink / raw) To: Sergey Kaplun, Sergey Bronnikov, Evgeniy Temirgaleev; +Cc: tarantool-patches Prior to this patch IRFPMS contained incorrect entry 'exp2'. IRFPMS is a human-readable form of enum IRFPMathOp, but there is no 'exp2' enum member (see IRFPMDEF(_)). It looks like it was added by mistake initially. Closes tarantool/tarantool#13159 --- src/luajit_dbg.py | 1 - .../debug-extension-tests.py | 45 ++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/luajit_dbg.py b/src/luajit_dbg.py index 80057a4e..76001b7d 100644 --- a/src/luajit_dbg.py +++ b/src/luajit_dbg.py @@ -1722,7 +1722,6 @@ IRFPMS = [ 'ceil', 'trunc', 'sqrt', - 'exp2', 'log', 'log2', 'other' diff --git a/test/tarantool-debugger-tests/debug-extension-tests.py b/test/tarantool-debugger-tests/debug-extension-tests.py index 895171a4..32701fd5 100644 --- a/test/tarantool-debugger-tests/debug-extension-tests.py +++ b/test/tarantool-debugger-tests/debug-extension-tests.py @@ -688,6 +688,39 @@ class TestLJIRFloadAbs(TestCaseBase): ) +class TestLJIRFPMathOpBase(TestCaseBase): + location = 'lj_cf_print' + extension_cmds = ( + 'n\n' # Load L. + 'lj-trace ' + '&((GG_State *)L)->J->cur' + ) + + @classmethod + def setUpClass(cls): + cls.lua_script = ( + 'jit.opt.start("hotloop=1")\n' + 'local function trace(a)\n' + ' local x = {}\n' + ' return x\n' + 'end\n' + 'trace(1)\n' + 'trace(1)\n' + 'print()\n' + ).format(cls.lua_expr) + cls.pattern = r'num FPMATH .* ref: ' + RX_IRN + r' lit: ' + cls.op + super(TestLJIRFPMathOpBase, cls).setUpClass() + + +class TestLJIRFPMathLog(TestLJIRFPMathOpBase): + lua_expr = 'math.log(a)' + op = 'log' + + +class TestLJIRFPMathLog2(TestLJIRFPMathOpBase): + lua_expr = 'math.log(a, 3)' + op = 'log2' + + # XXX: Implemented only for GC64 in LuaJIT until backporting the # corresponding commit. if IS_GC64: @@ -1051,7 +1084,17 @@ class TestLJCTypeBase(TestCaseBase): pattern = r'\[\d+\] <int>' -for test_cls in TestCaseBase.__subclasses__(): +def get_leaf_subclasses(cls): + subclasses = cls.__subclasses__() + if not subclasses: + yield cls + else: + for sub in subclasses: + for leaf in get_leaf_subclasses(sub): + yield leaf + + +for test_cls in get_leaf_subclasses(TestCaseBase): test_cls.test = lambda self: self.check() if __name__ == '__main__': -- 2.43.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit v2 1/2] dbg: fix mapping of FPMATHOP to string 2026-09-15 13:09 ` [Tarantool-patches] [PATCH luajit v2 1/2] dbg: fix mapping of FPMATHOP to string Mikhail Elhimov via Tarantool-patches @ 2026-09-21 11:23 ` Sergey Kaplun via Tarantool-patches 0 siblings, 0 replies; 5+ messages in thread From: Sergey Kaplun via Tarantool-patches @ 2026-09-21 11:23 UTC (permalink / raw) To: Mikhail Elhimov; +Cc: tarantool-patches Hi, Mikhail! Thanks for the patch! Please consider my comments below. On 15.09.26, Mikhail Elhimov wrote: > Prior to this patch IRFPMS contained incorrect entry 'exp2'. Typo: s/patch/patch,/ Typo: s/incorrect/the incorrect/ > IRFPMS is a human-readable form of enum IRFPMathOp, but there is no > 'exp2' enum member (see IRFPMDEF(_)). It looks like it was added by > mistake initially. > > Closes tarantool/tarantool#13159 Nit: s/Closes/Resolves/ (since it will be closed after bumping LuaJIT in Tarantool). > --- > src/luajit_dbg.py | 1 - > .../debug-extension-tests.py | 45 ++++++++++++++++++- > 2 files changed, 44 insertions(+), 2 deletions(-) > > diff --git a/src/luajit_dbg.py b/src/luajit_dbg.py > index 80057a4e..76001b7d 100644 > --- a/src/luajit_dbg.py > +++ b/src/luajit_dbg.py > @@ -1722,7 +1722,6 @@ IRFPMS = [ > 'ceil', > 'trunc', > 'sqrt', > - 'exp2', > 'log', > 'log2', > 'other' I suppose it should be fixed via the patch [1]. Avoiding hardcoded enums should fix the issue for enum IRFPMathOp as well. So, I suggest fixing this issue alongside with enum patchset, so we may join all tests to the corresponding patch. > diff --git a/test/tarantool-debugger-tests/debug-extension-tests.py b/test/tarantool-debugger-tests/debug-extension-tests.py > index 895171a4..32701fd5 100644 > --- a/test/tarantool-debugger-tests/debug-extension-tests.py > +++ b/test/tarantool-debugger-tests/debug-extension-tests.py > @@ -688,6 +688,39 @@ class TestLJIRFloadAbs(TestCaseBase): > ) > > > +class TestLJIRFPMathOpBase(TestCaseBase): > + location = 'lj_cf_print' > + extension_cmds = ( > + 'n\n' # Load L. > + 'lj-trace ' + '&((GG_State *)L)->J->cur' > + ) > + > + @classmethod > + def setUpClass(cls): > + cls.lua_script = ( > + 'jit.opt.start("hotloop=1")\n' > + 'local function trace(a)\n' > + ' local x = {}\n' > + ' return x\n' > + 'end\n' > + 'trace(1)\n' > + 'trace(1)\n' It is better to use 1.1 to test the issue for all architectures (i.e. for arm64 with DUALNUM mode enabled by default). > + 'print()\n' > + ).format(cls.lua_expr) > + cls.pattern = r'num FPMATH .* ref: ' + RX_IRN + r' lit: ' + cls.op > + super(TestLJIRFPMathOpBase, cls).setUpClass() <snipped> > -- > 2.43.0 > [1]: https://lists.tarantool.org/pipermail/tarantool-patches/2026-September/030791.html -- Best regards, Sergey Kaplun ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Tarantool-patches] [PATCH luajit v2 2/2] test: add debug extension tests for FPMATHOP 2026-09-15 13:09 [Tarantool-patches] [PATCH luajit v2 0/2] dbg: fix mapping of FPMATHOP Mikhail Elhimov via Tarantool-patches 2026-09-15 13:09 ` [Tarantool-patches] [PATCH luajit v2 1/2] dbg: fix mapping of FPMATHOP to string Mikhail Elhimov via Tarantool-patches @ 2026-09-15 13:09 ` Mikhail Elhimov via Tarantool-patches 2026-09-21 11:13 ` Sergey Kaplun via Tarantool-patches 1 sibling, 1 reply; 5+ messages in thread From: Mikhail Elhimov via Tarantool-patches @ 2026-09-15 13:09 UTC (permalink / raw) To: Sergey Kaplun, Sergey Bronnikov, Evgeniy Temirgaleev; +Cc: tarantool-patches These tests extends set of tests that check mapping of FPMATHOP code into a human-readable form while dumping FPMATH IR with the debug extension. --- .../debug-extension-tests.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/tarantool-debugger-tests/debug-extension-tests.py b/test/tarantool-debugger-tests/debug-extension-tests.py index 32701fd5..9989032b 100644 --- a/test/tarantool-debugger-tests/debug-extension-tests.py +++ b/test/tarantool-debugger-tests/debug-extension-tests.py @@ -711,6 +711,25 @@ class TestLJIRFPMathOpBase(TestCaseBase): super(TestLJIRFPMathOpBase, cls).setUpClass() +@unittest.skipIf(machine in ('arm64', 'aarch64'), + "not used as there is no corresponding hardware instruction") +class TestLJIRFPMathFloor(TestLJIRFPMathOpBase): + lua_expr = 'math.floor(a)' + op = 'floor' + + +@unittest.skipIf(machine in ('arm64', 'aarch64'), + "not used as there is no corresponding hardware instruction") +class TestLJIRFPMathCeil(TestLJIRFPMathOpBase): + lua_expr = 'math.ceil(a)' + op = 'ceil' + + +class TestLJIRFPMathSqrt(TestLJIRFPMathOpBase): + lua_expr = 'math.sqrt(a)' + op = 'sqrt' + + class TestLJIRFPMathLog(TestLJIRFPMathOpBase): lua_expr = 'math.log(a)' op = 'log' -- 2.43.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Tarantool-patches] [PATCH luajit v2 2/2] test: add debug extension tests for FPMATHOP 2026-09-15 13:09 ` [Tarantool-patches] [PATCH luajit v2 2/2] test: add debug extension tests for FPMATHOP Mikhail Elhimov via Tarantool-patches @ 2026-09-21 11:13 ` Sergey Kaplun via Tarantool-patches 0 siblings, 0 replies; 5+ messages in thread From: Sergey Kaplun via Tarantool-patches @ 2026-09-21 11:13 UTC (permalink / raw) To: Mikhail Elhimov; +Cc: tarantool-patches Hi, Mikhail! Thanks for the patch! Please consider my comments below. On 15.09.26, Mikhail Elhimov wrote: > These tests extends set of tests that check mapping of FPMATHOP code Typo: s/extends/extend/ Typo: s/set/the set/ Typo: s/mapping/the mapping/ > into a human-readable form while dumping FPMATH IR with the debug > extension. > --- > .../debug-extension-tests.py | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/test/tarantool-debugger-tests/debug-extension-tests.py b/test/tarantool-debugger-tests/debug-extension-tests.py > index 32701fd5..9989032b 100644 > --- a/test/tarantool-debugger-tests/debug-extension-tests.py > +++ b/test/tarantool-debugger-tests/debug-extension-tests.py > @@ -711,6 +711,25 @@ class TestLJIRFPMathOpBase(TestCaseBase): > super(TestLJIRFPMathOpBase, cls).setUpClass() > > > +@unittest.skipIf(machine in ('arm64', 'aarch64'), > + "not used as there is no corresponding hardware instruction") Instead of skipping the case, it is better to adjust the LJIRFPMathOpBase. The issue with missing IR is due to DUALNUM mode, which coerces the 1 to int, so there is no need to floor or ceil it. If we use 1.1 instead for all FPMMath tests, it fixes the issue. > +class TestLJIRFPMathFloor(TestLJIRFPMathOpBase): > + lua_expr = 'math.floor(a)' > + op = 'floor' > + > + > +@unittest.skipIf(machine in ('arm64', 'aarch64'), > + "not used as there is no corresponding hardware instruction") > +class TestLJIRFPMathCeil(TestLJIRFPMathOpBase): > + lua_expr = 'math.ceil(a)' > + op = 'ceil' > + > + > +class TestLJIRFPMathSqrt(TestLJIRFPMathOpBase): > + lua_expr = 'math.sqrt(a)' > + op = 'sqrt' > + > + > class TestLJIRFPMathLog(TestLJIRFPMathOpBase): > lua_expr = 'math.log(a)' > op = 'log' > -- > 2.43.0 > -- Best regards, Sergey Kaplun ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-21 11:23 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-09-15 13:09 [Tarantool-patches] [PATCH luajit v2 0/2] dbg: fix mapping of FPMATHOP Mikhail Elhimov via Tarantool-patches 2026-09-15 13:09 ` [Tarantool-patches] [PATCH luajit v2 1/2] dbg: fix mapping of FPMATHOP to string Mikhail Elhimov via Tarantool-patches 2026-09-21 11:23 ` Sergey Kaplun via Tarantool-patches 2026-09-15 13:09 ` [Tarantool-patches] [PATCH luajit v2 2/2] test: add debug extension tests for FPMATHOP Mikhail Elhimov via Tarantool-patches 2026-09-21 11:13 ` 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