Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add entry point to construct an OpaqueClosure from pre-optimized IRCode #44197

Merged
merged 7 commits into from
Apr 28, 2022
Prev Previous commit
more test coverage
aviatesk committed Apr 12, 2022
commit 6c22265b00e9b1fba134383532190e2ebe1babb9
5 changes: 4 additions & 1 deletion test/opaque_closure.jl
Original file line number Diff line number Diff line change
@@ -271,14 +271,17 @@ end
let ci = code_typed(+, (Int, Int))[1][1]
ir = Core.Compiler.inflate_ir(ci)
@test OC(ir, 2, false)(40, 2) == 42
@test OC(ci)(40, 2) == 42
end

let ci = code_typed((x, y...)->(x, y), (Int, Int))[1][1]
ir = Core.Compiler.inflate_ir(ci)
@test OC(ir, 2, true)(40, 2) === (40, (2,))
@test OC(ci)(40, 2) === (40, (2,))
end

let ci = code_typed((x, y...)->(x, y), (Int, Int))[1][1]
@test OC(ci)(1, 2) === (1, (2,))
ir = Core.Compiler.inflate_ir(ci)
@test_throws MethodError OC(ir, 2, true)(1, 2, 3)
@test_throws MethodError OC(ci)(1, 2, 3)
end