Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Bronnikov <sergeyb@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH luajit 1/2] ARM64: Make tobit conversions match JIT backend behavior.
Date: Fri, 24 Jul 2026 13:59:54 +0300	[thread overview]
Message-ID: <amNFqu0q2bIJVW-m@root> (raw)
In-Reply-To: <0a098bc2-ddb1-4fca-afdf-2a91cc80f7b9@tarantool.org>

Hi, Sergey!
Thanks for the review!
Fixed your comment and force-pushed the branch.

On 24.07.26, Sergey Bronnikov wrote:
> Hello,
> 
> thanks for the patch! LGTM with a minor comment.
> 
> Sergey
> 
> On 7/21/26 17:53, Sergey Kaplun wrote:
> > From: Mike Pall <mike>
> >
> > Thanks to Peter Cawley.
> >
> > (cherry picked from commit cdc2db3aeac442e139c3b1fda715fdfa78da8791)
> >
> > On the aarch64 architecture, the `tobit()` function incorrectly
> > truncates instead of rounding to the nearest integer. This leads to
> > inconsistency between various VMs (comparing to x86/x64, for example)
> > and between the arm64 VM and JIT.
> >
> > This patch uses an addition of 2^52 + 2^51 constant to the given
> > argument to convert it to the nearest integer value. After reading the
> > lowest 32 bits of the register, we get the expected result.
> >
> > Sergey Kaplun:
> > * added the description and the test for the problem
> >
> > Part of tarantool/tarantool#12880
> > ---
> >   src/vm_arm64.dasc                             | 20 ++++---------
> >   .../lj-1253-tobit-conversion.test.lua         | 28 +++++++++++++++++++
> >   2 files changed, 34 insertions(+), 14 deletions(-)
> >   create mode 100644 test/tarantool-tests/lj-1253-tobit-conversion.test.lua
> >

<snipped>

> > diff --git a/test/tarantool-tests/lj-1253-tobit-conversion.test.lua b/test/tarantool-tests/lj-1253-tobit-conversion.test.lua
> > new file mode 100644
> > index 00000000..31cf97ca
> > --- /dev/null
> > +++ b/test/tarantool-tests/lj-1253-tobit-conversion.test.lua
> > @@ -0,0 +1,28 @@
> > +local tap = require('tap')
> > +
> > +-- Test file to demonstrate LuaJIT's incorrect bit.tobit
> 
> We usually add parentheses to the name of the function. Here and below.
> 
> Feel free to ignore.

Fixed, thanks:

===================================================================
diff --git a/test/tarantool-tests/lj-1253-tobit-conversion.test.lua b/test/tarantool-tests/lj-1253-tobit-conversion.test.lua
index 31cf97ca..2fd16cc4 100644
--- a/test/tarantool-tests/lj-1253-tobit-conversion.test.lua
+++ b/test/tarantool-tests/lj-1253-tobit-conversion.test.lua
@@ -1,6 +1,6 @@
 local tap = require('tap')
 
--- Test file to demonstrate LuaJIT's incorrect bit.tobit
+-- Test file to demonstrate LuaJIT's incorrect `bit.tobit()`
 -- behaviour for arm64.
 -- See also: https://github.com/LuaJIT/LuaJIT/issues/1253.
 
===================================================================

<snipped>

-- 
Best regards,
Sergey Kaplun

  reply	other threads:[~2026-07-24 11:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 14:53 [Tarantool-patches] [PATCH luajit 0/2] Fix tobit conversion on arm architectures Sergey Kaplun via Tarantool-patches
2026-07-21 14:53 ` [Tarantool-patches] [PATCH luajit 1/2] ARM64: Make tobit conversions match JIT backend behavior Sergey Kaplun via Tarantool-patches
2026-07-24 10:00   ` Sergey Bronnikov via Tarantool-patches
2026-07-24 10:59     ` Sergey Kaplun via Tarantool-patches [this message]
2026-07-21 14:53 ` [Tarantool-patches] [PATCH luajit 2/2] ARM: Make hard-float " Sergey Kaplun via Tarantool-patches
2026-07-24 10:02   ` Sergey Bronnikov via Tarantool-patches
2026-07-24 11:03     ` Sergey Kaplun 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=amNFqu0q2bIJVW-m@root \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit 1/2] ARM64: Make tobit conversions match JIT backend behavior.' \
    /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