Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin <imun@tarantool.org>
To: "Alexander V. Tikhonov" <avtikhon@tarantool.org>,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 1/2] test: disable JIT for Lua Fun totable function
Date: Tue, 23 Jun 2020 21:04:08 +0300	[thread overview]
Message-ID: <20200623180408.GH3503@tarantool.org> (raw)
In-Reply-To: <dd1d4a30c5f5daa0505a1538b6dc2a4594f9dfc9.1592597647.git.imun@tarantool.org>

Sasha,

Many thanks for such precise testing you've made for this patch!

It turned out the patch was totally wrong, since it disables JIT for the
wrong function (i.e. <totable> method) and its subfunctions. However it
doesn't disable JIT for <totable> *callees*, so invalid traces continue
to be compiled. I've made a totally new patch (at the end of the reply)
that is quite similar to this one. Sasha has already tested it manually
and CI is green (I've rebased my branch on the bleeding master).

Sasha, Vlad, could you please glance at the changes once more?

On 19.06.20, Igor Munkin wrote:
> JIT compiler can generate invalid trace for <totable> function breaking
> its semantics (see LuaJIT/LuaJIT#584). Since interpreter works fine and
> produces right results, disabling JIT for this function (and all its
> subfunctions) stops execution failures.
> 
> Relates to LuaJIT/LuaJIT#584
> Fixes #4252
> 
> Signed-off-by: Igor Munkin <imun@tarantool.org>
> ---
>  test/box-tap/key_def.test.lua | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/test/box-tap/key_def.test.lua b/test/box-tap/key_def.test.lua
> index d7dbf5b88..ce7a3cb63 100755
> --- a/test/box-tap/key_def.test.lua
> +++ b/test/box-tap/key_def.test.lua
> @@ -4,6 +4,14 @@ local tap = require('tap')
>  local ffi = require('ffi')
>  local json = require('json')
>  local fun = require('fun')
> +
> +-- Fix for gh-4252: to prevent invalid trace assembling (see
> +-- LuaJIT/LuaJIT#584) disable JIT for fun.totable function and
> +-- method (these functions are different GCfunc objects) and all
> +-- their subfunctions.
> +jit.off(fun.totable, true)
> +jit.off(fun.iter({}).totable, true)
> +
>  local key_def_lib = require('key_def')
>  
>  local usage_error = 'Bad params, use: key_def.new({' ..
> -- 
> 2.25.0
> 

================================================================================

[PATCH 1/2] test: disable JIT for Lua Fun chain iterator

JIT compiler can generate an invalid trace for <fun.chain> iterator
(i.e. chain_gen_r1) breaking its semantics (see LuaJIT/LuaJIT#584).
Since interpreter works fine and produces the right results, disabling
JIT for this function stops execution failures.

As a result box-tap/key_def.test.lua is removed from box-tap suite
fragile tests list.

Relates to LuaJIT/LuaJIT#584
Fixes #4252

Signed-off-by: Igor Munkin <imun@tarantool.org>
---
 test/box-tap/key_def.test.lua | 8 ++++++++
 test/box-tap/suite.ini        | 1 -
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/test/box-tap/key_def.test.lua b/test/box-tap/key_def.test.lua
index d7dbf5b88..3a4aad687 100755
--- a/test/box-tap/key_def.test.lua
+++ b/test/box-tap/key_def.test.lua
@@ -4,6 +4,14 @@ local tap = require('tap')
 local ffi = require('ffi')
 local json = require('json')
 local fun = require('fun')
+
+-- XXX fix for gh-4252: to prevent invalid trace assembling (see
+-- https://github.com/LuaJIT/LuaJIT/issues/584) disable JIT for
+-- <fun.chain> iterator (i.e. <chain_gen_r1>). Since the function
+-- is local, the dummy chain generator is created to obtain the
+-- function GC object.
+jit.off(fun.chain({}).gen)
+
 local key_def_lib = require('key_def')
 
 local usage_error = 'Bad params, use: key_def.new({' ..
diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini
index e62399a7e..07f8880b6 100644
--- a/test/box-tap/suite.ini
+++ b/test/box-tap/suite.ini
@@ -5,5 +5,4 @@ is_parallel = True
 pretest_clean = True
 use_unix_sockets_iproto = True
 fragile = cfg.test.lua     ; gh-4344
-          key_def.test.lua ; gh-4252
 config = suite.cfg
-- 
2.25.0

================================================================================

-- 
Best regards,
IM

  parent reply	other threads:[~2020-06-23 18:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 20:50 [Tarantool-patches] [PATCH 0/2] Reduce Lua GC pressure in Tarantool Igor Munkin
2020-06-19 20:40 ` [Tarantool-patches] [PATCH 1/2] test: disable JIT for Lua Fun totable function Igor Munkin
2020-06-21 10:26   ` Sergey Ostanevich
2020-06-21 20:24     ` Igor Munkin
2020-06-25  9:43       ` Sergey Ostanevich
2020-06-26 11:11         ` Igor Munkin
2020-06-26 13:11           ` Igor Munkin
2020-06-23 18:04   ` Igor Munkin [this message]
2020-06-23 18:45     ` Alexander V. Tikhonov
2020-06-23 21:58       ` Igor Munkin
2020-06-19 20:40 ` [Tarantool-patches] [PATCH 2/2] box: reduce box_process_lua Lua GC memory usage Igor Munkin
2020-06-20 17:42   ` Vladislav Shpilevoy
2020-06-20 21:24     ` Igor Munkin
2020-06-21 10:27       ` Sergey Ostanevich
2020-06-21 10:40         ` Igor Munkin
2020-06-21 15:35       ` Vladislav Shpilevoy
2020-06-21 19:09         ` Igor Munkin
2020-06-22 22:54 ` [Tarantool-patches] [PATCH 0/2] Reduce Lua GC pressure in Tarantool Vladislav Shpilevoy
2020-06-23 21:06 ` Vladislav Shpilevoy
2020-06-23 21:58   ` Igor Munkin
2020-06-23 21:59 ` Igor Munkin
2020-06-27 13:22   ` Igor Munkin

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=20200623180408.GH3503@tarantool.org \
    --to=imun@tarantool.org \
    --cc=avtikhon@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/2] test: disable JIT for Lua Fun totable function' \
    /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