Skip to content

Commit

Permalink
go back to 1.6 version of precompile
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Aug 10, 2021
1 parent 06a31a0 commit f64aecd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 1 addition & 7 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1926,13 +1926,7 @@ function precompile(@nospecialize(f), args::Tuple)
precompile(Tuple{Core.Typeof(f), args...})
end

function precompile(argt::Type)
success = ccall(:jl_compile_hint, Int32, (Any,), argt) != 0
if !success
@debug "Inactive precompile statement" maxlog=10 form=argt _module=nothing _file=nothing _line=0
end
return success
end
precompile(argt::Type) = ccall(:jl_compile_hint, Int32, (Any,), argt) != 0

precompile(include_package_for_output, (PkgId, String, Vector{String}, Vector{String}, Vector{String}, typeof(_concrete_dependencies), Nothing))
precompile(include_package_for_output, (PkgId, String, Vector{String}, Vector{String}, Vector{String}, typeof(_concrete_dependencies), String))
Expand Down
4 changes: 2 additions & 2 deletions test/ambiguous.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ end
## Other ways of accessing functions
# Test that non-ambiguous cases work
let io = IOBuffer()
@test @test_logs precompile(ambig, (Int, Int))
@test precompile(ambig, (Int, Int))
cf = @eval @cfunction(ambig, Int, (Int, Int))
@test ccall(cf, Int, (Int, Int), 1, 2) == 4
@test length(code_lowered(ambig, (Int, Int))) == 1
Expand All @@ -75,7 +75,7 @@ end

# Test that ambiguous cases fail appropriately
let io = IOBuffer()
@test @test_logs (:warn,) precompile(ambig, (UInt8, Int))
@test !precompile(ambig, (UInt8, Int))
cf = @eval @cfunction(ambig, Int, (UInt8, Int)) # test for a crash (doesn't throw an error)
@test_throws(MethodError(ambig, (UInt8(1), Int(2)), get_world_counter()),
ccall(cf, Int, (UInt8, Int), 1, 2))
Expand Down

0 comments on commit f64aecd

Please sign in to comment.