Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH luajit] test: add test for conversions folding
@ 2023-11-16 13:44 Sergey Kaplun via Tarantool-patches
  2023-11-17 10:51 ` Maxim Kokryashkin via Tarantool-patches
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2023-11-16 13:44 UTC (permalink / raw)
  To: Maxim Kokryashkin, Sergey Bronnikov; +Cc: tarantool-patches

This patch adds the test for commit
1a401622fe83ae695226c94df3416e312315d659 ("Fix assertions."). This patch
removes incorrect assertions in the fold optimizations for conversions
from numbers to different integer types. Although the issue affects only
branch 2.0, there is no need to fix it. Nevertheless, the test is
required to avoid regressions in the future.

Part of tarantool/tarantool#9145
---

Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-833-fold-conv-from-num
Tarantool PR: https://github.com/tarantool/tarantool/pull/9375
Related issues:
* https://github.com/LuaJIT/LuaJIT/issues/833
* https://github.com/tarantool/tarantool/issues/9145

 .../lj-833-fold-conv-from-num.test.lua        | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 test/tarantool-tests/lj-833-fold-conv-from-num.test.lua

diff --git a/test/tarantool-tests/lj-833-fold-conv-from-num.test.lua b/test/tarantool-tests/lj-833-fold-conv-from-num.test.lua
new file mode 100644
index 00000000..9e2059bd
--- /dev/null
+++ b/test/tarantool-tests/lj-833-fold-conv-from-num.test.lua
@@ -0,0 +1,33 @@
+local tap = require('tap')
+
+-- XXX: Test the behaviour of fold optimizations from numbers to
+-- different integer types. The test itself doesn't fail before
+-- the commit since these changes relate only to version 2.0.
+
+local test = tap.test('lj-833-fold-conv-from-num'):skipcond({
+  ['Test requires JIT enabled'] = not jit.status(),
+})
+
+local ffi = require('ffi')
+
+test:plan(3)
+
+local arr_i64 = ffi.new('int64_t  [2]')
+local arr_u64 = ffi.new('uint64_t [2]')
+local arr_u32 = ffi.new('uint32_t [2]')
+
+jit.opt.start('hotloop=1')
+
+for _ = 1, 4 do
+  -- Test conversion to type (at store). Also, check the
+  -- conversion from number to int64_t at C array indexing.
+  arr_i64[1.1] = 1.1
+  arr_u64[1.1] = 1.1
+  arr_u32[1.1] = 1.1
+end
+
+test:is(arr_i64[1], 1LL,  'correct conversion to int64_t')
+test:is(arr_u64[1], 1ULL, 'correct conversion to uint64_t')
+test:is(arr_u32[1], 1ULL, 'correct conversion to uint32_t')
+
+test:done(true)
-- 
2.42.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Tarantool-patches] [PATCH luajit] test: add test for conversions folding
  2023-11-16 13:44 [Tarantool-patches] [PATCH luajit] test: add test for conversions folding Sergey Kaplun via Tarantool-patches
@ 2023-11-17 10:51 ` Maxim Kokryashkin via Tarantool-patches
  2023-11-20 11:22   ` Sergey Kaplun via Tarantool-patches
  2023-11-20 12:18 ` Sergey Bronnikov via Tarantool-patches
  2023-11-23  6:32 ` Igor Munkin via Tarantool-patches
  2 siblings, 1 reply; 5+ messages in thread
From: Maxim Kokryashkin via Tarantool-patches @ 2023-11-17 10:51 UTC (permalink / raw)
  To: Sergey Kaplun; +Cc: tarantool-patches

Hi, Sergey!
Thanks for the patch!
LGTM, except for the single nit regarding the commit message.
On Thu, Nov 16, 2023 at 04:44:56PM +0300, Sergey Kaplun wrote:
> This patch adds the test for commit
> 1a401622fe83ae695226c94df3416e312315d659 ("Fix assertions."). This patch
> removes incorrect assertions in the fold optimizations for conversions
> from numbers to different integer types. Although the issue affects only
Typo: s/Although/Since/
> branch 2.0, there is no need to fix it. Nevertheless, the test is
> required to avoid regressions in the future.
>
> Part of tarantool/tarantool#9145
> ---
>
> Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-833-fold-conv-from-num
> Tarantool PR: https://github.com/tarantool/tarantool/pull/9375
> Related issues:
> * https://github.com/LuaJIT/LuaJIT/issues/833
> * https://github.com/tarantool/tarantool/issues/9145
>
>  .../lj-833-fold-conv-from-num.test.lua        | 33 +++++++++++++++++++
>  1 file changed, 33 insertions(+)
>  create mode 100644 test/tarantool-tests/lj-833-fold-conv-from-num.test.lua
<snipped>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Tarantool-patches] [PATCH luajit] test: add test for conversions folding
  2023-11-17 10:51 ` Maxim Kokryashkin via Tarantool-patches
@ 2023-11-20 11:22   ` Sergey Kaplun via Tarantool-patches
  0 siblings, 0 replies; 5+ messages in thread
From: Sergey Kaplun via Tarantool-patches @ 2023-11-20 11:22 UTC (permalink / raw)
  To: Maxim Kokryashkin; +Cc: tarantool-patches

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

On 17.11.23, Maxim Kokryashkin wrote:
> Hi, Sergey!
> Thanks for the patch!
> LGTM, except for the single nit regarding the commit message.
> On Thu, Nov 16, 2023 at 04:44:56PM +0300, Sergey Kaplun wrote:
> > This patch adds the test for commit
> > 1a401622fe83ae695226c94df3416e312315d659 ("Fix assertions."). This patch
> > removes incorrect assertions in the fold optimizations for conversions
> > from numbers to different integer types. Although the issue affects only
> Typo: s/Although/Since/

Fixed, thanks.

> > branch 2.0, there is no need to fix it. Nevertheless, the test is
> > required to avoid regressions in the future.
> >
> > Part of tarantool/tarantool#9145
> > ---
> >
> > Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-833-fold-conv-from-num
> > Tarantool PR: https://github.com/tarantool/tarantool/pull/9375
> > Related issues:
> > * https://github.com/LuaJIT/LuaJIT/issues/833
> > * https://github.com/tarantool/tarantool/issues/9145
> >
> >  .../lj-833-fold-conv-from-num.test.lua        | 33 +++++++++++++++++++
> >  1 file changed, 33 insertions(+)
> >  create mode 100644 test/tarantool-tests/lj-833-fold-conv-from-num.test.lua
> <snipped>

-- 
Best regards,
Sergey Kaplun

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Tarantool-patches] [PATCH luajit] test: add test for conversions folding
  2023-11-16 13:44 [Tarantool-patches] [PATCH luajit] test: add test for conversions folding Sergey Kaplun via Tarantool-patches
  2023-11-17 10:51 ` Maxim Kokryashkin via Tarantool-patches
@ 2023-11-20 12:18 ` Sergey Bronnikov via Tarantool-patches
  2023-11-23  6:32 ` Igor Munkin via Tarantool-patches
  2 siblings, 0 replies; 5+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2023-11-20 12:18 UTC (permalink / raw)
  To: Sergey Kaplun, Maxim Kokryashkin; +Cc: tarantool-patches

Hello, Sergey!

LGTM

On 11/16/23 16:44, Sergey Kaplun wrote:
> This patch adds the test for commit
> 1a401622fe83ae695226c94df3416e312315d659 ("Fix assertions."). This patch
> removes incorrect assertions in the fold optimizations for conversions
> from numbers to different integer types. Although the issue affects only
> branch 2.0, there is no need to fix it. Nevertheless, the test is
> required to avoid regressions in the future.
>
> Part of tarantool/tarantool#9145
> ---
>
> Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-833-fold-conv-from-num
> Tarantool PR: https://github.com/tarantool/tarantool/pull/9375
> Related issues:
> * https://github.com/LuaJIT/LuaJIT/issues/833
> * https://github.com/tarantool/tarantool/issues/9145
>
>   .../lj-833-fold-conv-from-num.test.lua        | 33 +++++++++++++++++++
>   1 file changed, 33 insertions(+)
>   create mode 100644 test/tarantool-tests/lj-833-fold-conv-from-num.test.lua
>
> diff --git a/test/tarantool-tests/lj-833-fold-conv-from-num.test.lua b/test/tarantool-tests/lj-833-fold-conv-from-num.test.lua
> new file mode 100644
> index 00000000..9e2059bd
> --- /dev/null
> +++ b/test/tarantool-tests/lj-833-fold-conv-from-num.test.lua
> @@ -0,0 +1,33 @@
> +local tap = require('tap')
> +
> +-- XXX: Test the behaviour of fold optimizations from numbers to
> +-- different integer types. The test itself doesn't fail before
> +-- the commit since these changes relate only to version 2.0.
> +
> +local test = tap.test('lj-833-fold-conv-from-num'):skipcond({
> +  ['Test requires JIT enabled'] = not jit.status(),
> +})
> +
> +local ffi = require('ffi')
> +
> +test:plan(3)
> +
> +local arr_i64 = ffi.new('int64_t  [2]')
> +local arr_u64 = ffi.new('uint64_t [2]')
> +local arr_u32 = ffi.new('uint32_t [2]')
> +
> +jit.opt.start('hotloop=1')
> +
> +for _ = 1, 4 do
> +  -- Test conversion to type (at store). Also, check the
> +  -- conversion from number to int64_t at C array indexing.
> +  arr_i64[1.1] = 1.1
> +  arr_u64[1.1] = 1.1
> +  arr_u32[1.1] = 1.1
> +end
> +
> +test:is(arr_i64[1], 1LL,  'correct conversion to int64_t')
> +test:is(arr_u64[1], 1ULL, 'correct conversion to uint64_t')
> +test:is(arr_u32[1], 1ULL, 'correct conversion to uint32_t')
> +
> +test:done(true)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Tarantool-patches] [PATCH luajit] test: add test for conversions folding
  2023-11-16 13:44 [Tarantool-patches] [PATCH luajit] test: add test for conversions folding Sergey Kaplun via Tarantool-patches
  2023-11-17 10:51 ` Maxim Kokryashkin via Tarantool-patches
  2023-11-20 12:18 ` Sergey Bronnikov via Tarantool-patches
@ 2023-11-23  6:32 ` Igor Munkin via Tarantool-patches
  2 siblings, 0 replies; 5+ messages in thread
From: Igor Munkin via Tarantool-patches @ 2023-11-23  6:32 UTC (permalink / raw)
  To: Sergey Kaplun; +Cc: tarantool-patches

Sergey,

I've checked the patchset into all long-term branches in
tarantool/luajit and bumped a new version in master, release/2.11 and
release/2.10.

On 16.11.23, Sergey Kaplun via Tarantool-patches wrote:
> This patch adds the test for commit
> 1a401622fe83ae695226c94df3416e312315d659 ("Fix assertions."). This patch
> removes incorrect assertions in the fold optimizations for conversions
> from numbers to different integer types. Although the issue affects only
> branch 2.0, there is no need to fix it. Nevertheless, the test is
> required to avoid regressions in the future.
> 
> Part of tarantool/tarantool#9145
> ---
> 
> Branch: https://github.com/tarantool/luajit/tree/skaplun/lj-833-fold-conv-from-num
> Tarantool PR: https://github.com/tarantool/tarantool/pull/9375
> Related issues:
> * https://github.com/LuaJIT/LuaJIT/issues/833
> * https://github.com/tarantool/tarantool/issues/9145
> 
>  .../lj-833-fold-conv-from-num.test.lua        | 33 +++++++++++++++++++
>  1 file changed, 33 insertions(+)
>  create mode 100644 test/tarantool-tests/lj-833-fold-conv-from-num.test.lua
> 

<snipped>

> -- 
> 2.42.0
> 

-- 
Best regards,
IM

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-11-23  6:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-16 13:44 [Tarantool-patches] [PATCH luajit] test: add test for conversions folding Sergey Kaplun via Tarantool-patches
2023-11-17 10:51 ` Maxim Kokryashkin via Tarantool-patches
2023-11-20 11:22   ` Sergey Kaplun via Tarantool-patches
2023-11-20 12:18 ` Sergey Bronnikov via Tarantool-patches
2023-11-23  6:32 ` Igor Munkin 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