[Tarantool-patches] [PATCH luajit v2 1/2] dbg: fix mapping of FPMATHOP to string
Mikhail Elhimov
m.elhimov at vk.team
Tue Sep 15 16:09:39 MSK 2026
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
More information about the Tarantool-patches
mailing list