Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Mikhail Elhimov <m.elhimov@vk.team>,
	Sergey Kaplun <skaplun@tarantool.org>,
	Evgeniy Temirgaleev <e.temirgaleev@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH] dbg: fix mapping of FPMATHOP to string
Date: Tue, 15 Sep 2026 13:39:50 +0300	[thread overview]
Message-ID: <7ca96010-f094-4df5-9a80-fa28612417af@tarantool.org> (raw)
In-Reply-To: <20260908174027.337233-1-m.elhimov@vk.team>

Hi, Mikhail,

thanks for the patch! Please see my comments.

Sergey

On 9/8/26 20:40, Mikhail Elhimov wrote:
> Closes tarantool/tarantool#13159
it is desired to add a description for the changes (why `exp2` was 
removed etc.)
> ---
> Branch: https://github.com/tarantool/luajit/tree/elhimov/gh-13159-fix-fpmathop-mapping
> Related issue: https://github.com/tarantool/tarantool/issues/13159
>
>   src/luajit_dbg.py                             |  1 -
>   .../debug-extension-tests.py                  | 64 ++++++++++++++++++-
>   2 files changed, 63 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..9989032b 100644
> --- a/test/tarantool-debugger-tests/debug-extension-tests.py
> +++ b/test/tarantool-debugger-tests/debug-extension-tests.py
> @@ -688,6 +688,58 @@ 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()
> +
> +
> +@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'
> +

Usually we add a patch with fix for the problem and a test that covers a 
problem.

I propose leave a testcase TestLJIRFPMathLog and move other testcases to 
a separate commit.

> +
> +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 +1103,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__':

  reply	other threads:[~2026-09-15 10:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 17:40 Mikhail Elhimov via Tarantool-patches
2026-09-15 10:39 ` Sergey Bronnikov via Tarantool-patches [this message]
2026-09-16 10:16   ` Mikhail Elhimov via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ca96010-f094-4df5-9a80-fa28612417af@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=e.temirgaleev@tarantool.org \
    --cc=m.elhimov@vk.team \
    --cc=sergeyb@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] dbg: fix mapping of FPMATHOP to string' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox