[Tarantool-patches] [PATCH v2 luajit 21/45] test: enable <misc/jit_flush.lua> LuaJIT test
Sergey Bronnikov
sergeyb at tarantool.org
Fri Aug 23 18:30:02 MSK 2024
Sergey,
On 21.08.2024 11:58, Sergey Kaplun wrote:
> This patch moves the aforementioned test from the <misc> to the <trace/>
> directory, includes it in <index>, and names subtests.
>
> Part of tarantool/tarantool#9398
> ---
thanks for the patch! LGTM with a minor comment
> test/LuaJIT-tests/misc/jit_flush.lua | 50 --------------------
> test/LuaJIT-tests/trace/index | 1 +
> test/LuaJIT-tests/trace/jit_flush.lua | 66 +++++++++++++++++++++++++++
> 3 files changed, 67 insertions(+), 50 deletions(-)
> delete mode 100644 test/LuaJIT-tests/misc/jit_flush.lua
> create mode 100644 test/LuaJIT-tests/trace/jit_flush.lua
>
> diff --git a/test/LuaJIT-tests/misc/jit_flush.lua b/test/LuaJIT-tests/misc/jit_flush.lua
> deleted file mode 100644
> index ead1e4e9..00000000
> --- a/test/LuaJIT-tests/misc/jit_flush.lua
> +++ /dev/null
> @@ -1,50 +0,0 @@
> -
> -if not jit or not jit.status or not jit.status() then return end
> -
> -for i=1,100 do
> - if i==50 then jit.flush(2) end
> - for j=1,100 do end
> - for j=1,100 do end
> -end
> -
> -jit.flush()
> -
> -local function f() for i=1,100 do end end
> -for i=1,100 do local x = gcinfo(); f() end
> -
> -jit.flush()
> -
> -local function fib(n)
> - if n < 2 then return 1 end
> - return fib(n-2) + fib(n-1)
> -end
> -
> -fib(11)
> -
> -jit.flush()
> -
> -local names = {}
> -for i=1,100 do names[i] = i end
> -
> -function f()
> - for k,v in ipairs(names) do end
> -end
> -
> -f()
> -
> -for i=1,2 do
> - f()
> - f()
> - jit.flush()
> -end
> -
> -jit.flush()
> -
> -jit.flush(1) -- ignored
> -jit.flush(2) -- ignored
> -for i=1,1e7 do end -- causes trace #1
> -
> -jit.flush(2) -- ignored
> -jit.flush(1) -- ok
> -jit.flush(1) -- crashes
> -
> diff --git a/test/LuaJIT-tests/trace/index b/test/LuaJIT-tests/trace/index
> index 63af7870..3ab095a7 100644
> --- a/test/LuaJIT-tests/trace/index
> +++ b/test/LuaJIT-tests/trace/index
> @@ -5,6 +5,7 @@ gc.lua
> gc64_slot_revival.lua
> hook_norecord.lua
> hook_record.lua
> +jit_flush.lua
> phi
> snap.lua
> stitch.lua
> diff --git a/test/LuaJIT-tests/trace/jit_flush.lua b/test/LuaJIT-tests/trace/jit_flush.lua
> new file mode 100644
> index 00000000..a995921e
> --- /dev/null
> +++ b/test/LuaJIT-tests/trace/jit_flush.lua
> @@ -0,0 +1,66 @@
> +do --- Flushing a trace that is a link for another trace.
> + -- TRACE 3 stop -> 2
> + jit.flush()
> + for i = 1, 100 do
> + if i == 50 then jit.flush(2) end
> + for _ = 1, 100 do end
> + for _ = 1, 100 do end
> + end
> +
> + jit.flush()
> +end
> +
> +do --- Flushing stitched trace.
> + jit.flush()
> + local function f() for _ = 1, 100 do end end
> + for _ = 1, 100 do local x = gcinfo(); f() end
> +
> + jit.flush()
> +end
> +
> +do --- Flushing trace with up-recursion.
> + jit.flush()
> +
> + local function fib(n)
> + if n < 2 then return 1 end
> + return fib(n - 2) + fib(n - 1)
> + end
> +
> + fib(11)
> +
> + jit.flush()
> +end
> +
> +do --- Flush in the loop.
> + jit.flush()
> +
> + local names = {}
> + for i = 1, 100 do names[i] = i end
> +
> + local function f()
> + for k, v in ipairs(names) do end
> + end
> +
> + f()
> +
> + for _ = 1, 2 do
> + f()
> + f()
> + jit.flush()
> + end
> +
> + jit.flush()
> +end
> +
> +
please remove excess newline
> +do --- Flushes of not existed traces.
> + jit.flush()
> +
> + jit.flush(1) -- ignored
> + jit.flush(2) -- ignored
> + for _ = 1, 1e7 do end -- causes trace #1
> +
> + jit.flush(2) -- ignored
> + jit.flush(1) -- ok
> + jit.flush(1) -- crashes
> +end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20240823/5cd7f2ea/attachment.htm>
More information about the Tarantool-patches
mailing list