[Tarantool-patches] [PATCH luajit 12/25] test: enable <ffi_jit_call.lua> in LuaJIT-tests

Sergey Bronnikov sergeyb at tarantool.org
Wed Jan 24 17:43:43 MSK 2024


Hi, Sergey!

thanks for the patch

On 1/19/24 14:32, Sergey Kaplun wrote:
<snipped>
>   
> -do
> +do --- call_ij

I would rename testcase. Using test function as a name is confusing.

Here and below and in other patches too.

>     local x = 0
>     for i=1,100 do
>       x = x + lib.call_ij(100+i, i*0x300000002LL)
> @@ -69,7 +73,7 @@ do
>     assert(x == 0x3b2e0000623eLL)
>   end
>   
> -do
> +do --- call_10d
>     local x
>     for i=1,100 do
>       x = lib.call_10d(-42.5, 17.125, 12345.5, 9987, -100.625, 11, 51, 0x12345678, 338, -78901234.75)
> @@ -77,15 +81,17 @@ do
>     assert(x == -42.5+17.125+12345.5+9987-100.625+11+51+0x12345678+338-78901234.75)
>   end
>   
> -do
> -  local x
> -  for i=1,100 do
> -    x = lib.call_10f(-42.5, 17.125, 12345.5, 9987, -100.625, 11, 51, 0x123456, 338, -789012.75)
> +do --- call_10f
> +  if not (jit.os == "OSX" and jit.arch == "arm64") then -- NYI
> +    local x
> +    for i=1,100 do
> +      x = lib.call_10f(-42.5, 17.125, 12345.5, 9987, -100.625, 11, 51, 0x123456, 338, -789012.75)
> +    end
> +    assert(x == -42.5+17.125+12345.5+9987-100.625+11+51+0x123456+338-789012.75)
>     end
> -  assert(x == -42.5+17.125+12345.5+9987-100.625+11+51+0x123456+338-789012.75)
>   end
>   
> -do
> +do --- call_b
>     local x
>     for i=-100,100 do
>       if not lib.call_b(i) then x = i end
> @@ -100,14 +106,14 @@ do
>     assert(x == 90)
>   end
>   
> -do
> +do --- tail call_b
>     local function tail(x)
>       return lib.call_b(x)
>     end
>     for i=1,100 do local a,b,c = tail(1), tail(1), tail(1) end
>   end
>   
> -do
> +do --- call i8[_i] u8[_i] i16[_i] u16[_i]
>     local x = 0
>     for i=0x01010080,0x010100ff do x = x + lib.call_i_i8(i) end
>     assert(x == -8128)
> @@ -135,7 +141,7 @@ do
>   end
>   
>   -- target-specific
> -if jit.arch == "x86" then
> +do --- fastcall +x86
>     for i=1,100 do assert(lib.fastcall_i(-42) == -41) end
>     for i=1,100 do assert(lib.fastcall_ii(-42, 17) == -42+17) end
>     for i=1,100 do assert(lib.fastcall_iii(-42, 17, 139) == -42+17+139) end
> @@ -143,12 +149,12 @@ if jit.arch == "x86" then
>     for i=1,100 do assert(lib.fastcall_dd(12.5, -3.25) == 12.5-3.25) end
>     local x = lib.fastcall_ji
>     for i=1,100 do assert(x(0x123456789LL, -17) == 0x123456789LL-17) end
> +end
>   
> -  if jit.os == "Windows" then
> -    for i=1,100 do assert(lib.stdcall_i(-42) == -41) end
> -    for i=1,100 do assert(lib.stdcall_ii(-42, 17) == -42+17) end
> -    for i=1,100 do assert(lib.stdcall_dd(12.5, -3.25) == 12.5-3.25) end
> -    for i=1,100 do assert(lib.stdcall_ff(12.5, -3.25) == 12.5-3.25) end
> -  end
> +do --- stdcall +x86 +windows
> +  for i=1,100 do assert(lib.stdcall_i(-42) == -41) end
> +  for i=1,100 do assert(lib.stdcall_ii(-42, 17) == -42+17) end
> +  for i=1,100 do assert(lib.stdcall_dd(12.5, -3.25) == 12.5-3.25) end
> +  for i=1,100 do assert(lib.stdcall_ff(12.5, -3.25) == 12.5-3.25) end
>   end
>   
> diff --git a/test/LuaJIT-tests/lib/ffi/index b/test/LuaJIT-tests/lib/ffi/index
> index 0c1e5e66..d6e2b64a 100644
> --- a/test/LuaJIT-tests/lib/ffi/index
> +++ b/test/LuaJIT-tests/lib/ffi/index
> @@ -11,6 +11,7 @@ ffi_convert.lua
>   ffi_enum.lua
>   ffi_gcstep_recursive.lua
>   ffi_jit_arith.lua
> +ffi_jit_call.lua
>   istype.lua
>   jit_array.lua
>   jit_complex.lua


More information about the Tarantool-patches mailing list