Hi, Sergey,

thanks for the patch!

On 27.02.2025 12:18, Sergey Kaplun wrote:
> The aforementioned test is flaky when run under Tarantool due to not
> enough room for all traces. The flushing of all traces at the start and
> collecting them solves the issue.
Have you considered another options like increasing `maxtrace` value?
> The same issue may occur for the
> <gh-6098-fix-side-exit-patching-on-arm64.test.lua>, so it is adjusted as
> well.
> ---
>
> Branch:https://github.com/tarantool/luajit/tree/skaplun/gh-noticket-fix-mips64-flaky-test
> To reproduce, run the following command without the patch from the root
> of the Tarantool repository:
> | ctest --repeat-until-fail 1000 --test-dir third_party/luajit/ -R fix-mips64-spare-side-exit-patching
>
>   .../fix-mips64-spare-side-exit-patching.test.lua             | 5 +++++
>   .../gh-6098-fix-side-exit-patching-on-arm64.test.lua         | 5 +++++
>   2 files changed, 10 insertions(+)
>
> diff --git a/test/tarantool-tests/fix-mips64-spare-side-exit-patching.test.lua b/test/tarantool-tests/fix-mips64-spare-side-exit-patching.test.lua
> index 703d8e69..dd9f2073 100644
> --- a/test/tarantool-tests/fix-mips64-spare-side-exit-patching.test.lua
> +++ b/test/tarantool-tests/fix-mips64-spare-side-exit-patching.test.lua
> @@ -15,6 +15,11 @@ local MAXTRACE = 2000;
>   
>   test:plan(1)
>   
> +-- Flush all possible traces and collect them to be sure that
> +-- we have enough space.
> +jit.flush()
> +collectgarbage()
> +
>   local function find_last_trace()
>     local candidate = misc.getmetrics().jit_trace_num
>     for traceno = candidate, MAXTRACE do
> diff --git a/test/tarantool-tests/gh-6098-fix-side-exit-patching-on-arm64.test.lua b/test/tarantool-tests/gh-6098-fix-side-exit-patching-on-arm64.test.lua
> index 678ac914..f5fc4681 100644
> --- a/test/tarantool-tests/gh-6098-fix-side-exit-patching-on-arm64.test.lua
> +++ b/test/tarantool-tests/gh-6098-fix-side-exit-patching-on-arm64.test.lua
> @@ -9,6 +9,11 @@ local frontend = require('utils').frontend
>   
>   test:plan(1)
>   
> +-- Flush all possible traces and collect them to be sure that
> +-- we have enough space.
> +jit.flush()
> +collectgarbage()
> +
>   -- The function to be tested for side exit patching:
>   -- * At the beginning of the test case, the <if> branch is
>   --   recorded as a root trace.