Skip to content

Commit

Permalink
Add invokelatest to all tests using the Native target
Browse files Browse the repository at this point in the history
Julia 1.12 will be stricter about when world age gets incremented
implicitly in toplevel scope (see JuliaLang/julia#56509).
This PR adds explicit world age increments after compiling code
using the Native target, which will likely be required on Julia 1.12
(and are harmless on prior julia versions).
  • Loading branch information
Keno authored and felipenoris committed Dec 22, 2024
1 parent 70cc35f commit db0aad7
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ end

let
fnative = OIR.compile(OIR.Native, bb)
out_vec, out_inspect1, out_inspect2, out_inspect3, out_inspect4 = fnative(3)
out_vec, out_inspect1, out_inspect2, out_inspect3, out_inspect4 = invokelatest(fnative, 3)
@test out_inspect1 0.0
@test out_inspect2 10.0
@test isa(out_inspect2, Float64)
Expand Down Expand Up @@ -413,7 +413,7 @@ end
let
input = 10.0
f = OIR.compile(OIR.Native, bb)
@test f(input) julia_basic_block_test_function(input)
@test invokelatest(f, input) julia_basic_block_test_function(input)
end

@testset "Multiply by zero" begin
Expand All @@ -429,7 +429,7 @@ end

let
f = OIR.compile(OIR.Native, bb)
@test f(10.0) == 0.0
@test invokelatest(f, 10.0) == 0.0
end
end
end
Expand Down Expand Up @@ -461,7 +461,7 @@ end

let
f = OIR.compile(OIR.Native, bb)
@test f(30.0, 20.0, 10.0) foreign_fun_3args(30.0, 20.0, 10.0)
@test invokelatest(f, 30.0, 20.0, 10.0) foreign_fun_3args(30.0, 20.0, 10.0)
end
end

Expand All @@ -484,7 +484,7 @@ end

let
f = OIR.compile(OIR.Native, bb)
@test f() 30.0
@test invokelatest(f) 30.0
end
end

Expand All @@ -506,7 +506,7 @@ end

let
f = OIR.compile(OIR.Native, bb)
@test f() 50.0
@test invokelatest(f) 50.0
end
end

Expand All @@ -529,7 +529,7 @@ end

let
f = OIR.compile(OIR.Native, bb)
@test f() foreign_fun_3args(30.0, 20.0, 10.0)
@test invokelatest(f) foreign_fun_3args(30.0, 20.0, 10.0)
end
end

Expand All @@ -553,7 +553,7 @@ end

let
f = OIR.compile(OIR.Native, bb)
@test f() foreign_fun_4args(30.0, 20.0, 10.0, 100.0)
@test invokelatest(f) foreign_fun_4args(30.0, 20.0, 10.0, 100.0)
end
end

Expand All @@ -578,7 +578,7 @@ end

let
f = OIR.compile(OIR.Native, bb)
@test f() foreign_fun_5args(30.0, 20.0, 10.0, 100.0, 200.0)
@test invokelatest(f) foreign_fun_5args(30.0, 20.0, 10.0, 100.0, 200.0)
end
end

Expand All @@ -604,7 +604,7 @@ end

let
f = OIR.compile(OIR.Native, bb)
@test f() foreign_fun_6args(30.0, 20.0, 10.0, 100.0, 200.0, 300.0)
@test invokelatest(f) foreign_fun_6args(30.0, 20.0, 10.0, 100.0, 200.0, 300.0)
end
end
end
Expand Down Expand Up @@ -666,15 +666,15 @@ end

let
f = OIR.compile(OIR.Native, bb)
cnst, slot, output = f(input)
cnst, slot, output = invokelatest(f, input)
@test slot == 11.0
@test output == 1.0 + 10.0 + 10.0
@test cnst == 1.0
end

let
f = OIR.compile(OIR.Native, OIR.CompiledBasicBlock(bb))
cnst, slot, output = f(input)
cnst, slot, output = invokelatest(f, input)
@test slot == 11.0
@test output == 1.0 + 10.0 + 10.0
@test cnst == 1.0
Expand Down Expand Up @@ -748,7 +748,7 @@ end

let
f = OIR.compile(OIR.Native, bb)
@test f(30.0, 20.0, 10.0) == julia_native_test_function(30.0, 20.0, 10.0)
@test invokelatest(f, 30.0, 20.0, 10.0) == julia_native_test_function(30.0, 20.0, 10.0)
end
end

Expand Down

0 comments on commit db0aad7

Please sign in to comment.