Skip to content

Commit

Permalink
test: enable <misc/wbarrier_obar.lua> LuaJIT test
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Buristan committed Aug 14, 2024
1 parent e66323d commit 9e5b28f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 22 deletions.
22 changes: 0 additions & 22 deletions test/LuaJIT-tests/misc/wbarrier_obar.lua

This file was deleted.

41 changes: 41 additions & 0 deletions test/LuaJIT-tests/trace/wbarrier.lua
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

0 comments on commit 9e5b28f

Please sign in to comment.