[Tarantool-patches] [PATCH v2 luajit 44/45] test: enable <misc/wbarrier_obar.lua> LuaJIT test
Sergey Bronnikov
sergeyb at tarantool.org
Thu Aug 22 18:17:13 MSK 2024
Sergey,
On 21.08.2024 11:58, Sergey Kaplun wrote:
> This patch moves the aforementioned test to the <trace/wbarrier.lua>
> test, with refactoring to restore the JIT engine and GC settings after
> the test.
>
> Part of tarantool/tarantool#9398
> ---
thanks for the patch! LGTM
> test/LuaJIT-tests/misc/wbarrier_obar.lua | 22 -------------
> test/LuaJIT-tests/trace/wbarrier.lua | 41 ++++++++++++++++++++++++
> 2 files changed, 41 insertions(+), 22 deletions(-)
> delete mode 100644 test/LuaJIT-tests/misc/wbarrier_obar.lua
>
> diff --git a/test/LuaJIT-tests/misc/wbarrier_obar.lua b/test/LuaJIT-tests/misc/wbarrier_obar.lua
> deleted file mode 100644
> index 258db215..00000000
> --- a/test/LuaJIT-tests/misc/wbarrier_obar.lua
> +++ /dev/null
> @@ -1,22 +0,0 @@
> --- DSE of USTORE must eliminate OBAR, too.
> -
> -if jit and jit.opt then pcall(jit.opt.start, "-sink") end
> -
> -local f
> -do
> - local x
> - f = function()
> - local y = 0
> - for i=1,10000 do
> - x = {1}
> - if y > 0 then end
> - x = 1
> - end
> - end
> -end
> -
> -collectgarbage()
> -collectgarbage("setstepmul", 1)
> -collectgarbage("restart")
> -f()
> -
> diff --git a/test/LuaJIT-tests/trace/wbarrier.lua b/test/LuaJIT-tests/trace/wbarrier.lua
> index 625c0ff2..9c9c50af 100644
> --- a/test/LuaJIT-tests/trace/wbarrier.lua
> +++ b/test/LuaJIT-tests/trace/wbarrier.lua
> @@ -1,3 +1,12 @@
> +local function jit_opt_is_on(needed)
> + for _, opt in ipairs({jit.status()}) do
> + if opt == needed then
> + return true
> + end
> + end
> + return false
> +end
> +
> do --- TBAR for HSTORE.
> local t = {[0]={}}
> for i = 1, 1e5 do t[i] = {t[i - 1]} end
> @@ -14,3 +23,35 @@ do --- OBAR for USTORE.
> end
> f()
> end
> +
> +do --- DSE of USTORE must eliminate OBAR too.
> + local need_restore_sink = false
> + if jit_opt_is_on("sink") then
> + need_restore_sink = true
> + jit.opt.start("-sink")
> + end
> +
> + local f
> + do
> + local x
> + f = function()
> + local y = 0
> + for _ = 1, 10000 do
> + x = {1}
> + if y > 0 then end
> + x = 1
> + end
> + end
> + end
> +
> + collectgarbage()
> + local oldstepmul = collectgarbage("setstepmul", 1)
> + collectgarbage("restart")
> +
> + f()
> +
> + collectgarbage("setstepmul", oldstepmul)
> + if need_restore_sink then
> + jit.opt.start("+sink")
> + end
> +end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20240822/d3d8baa7/attachment.htm>
More information about the Tarantool-patches
mailing list