Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/staticdata_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ static jl_array_t *queue_external_cis(jl_array_t *list, jl_query_cache *query_ca
assert(jl_is_code_instance(ci));
jl_method_instance_t *mi = jl_get_ci_mi(ci);
jl_method_t *m = mi->def.method;
if (ci->owner == jl_nothing && jl_atomic_load_relaxed(&ci->inferred) && jl_is_method(m) && jl_object_in_image((jl_value_t*)m->module)) {
if (jl_atomic_load_relaxed(&ci->inferred) && jl_is_method(m) && jl_object_in_image((jl_value_t*)m->module)) {
int found = has_backedge_to_worklist(mi, &visited, &stack, query_cache);
assert(found == 0 || found == 1 || found == 2);
assert(stack.len == 0);
Expand Down
30 changes: 11 additions & 19 deletions test/precompile_absint1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,43 +43,35 @@ precompile_test_harness() do load_path
let m = only(methods(TestAbsIntPrecompile1.basic_callee))
mi = only(Base.specializations(m))
ci = mi.cache
@test_broken isdefined(ci, :next)
ci = check_presence(mi, nothing)
@test ci !== nothing
@test ci.owner === nothing
@test ci.max_world == typemax(UInt)
@test Base.module_build_id(TestAbsIntPrecompile1) ==
Base.object_build_id(ci)
@test_skip begin
ci = ci.next
@test !isdefined(ci, :next)
ci = check_presence(mi, cache_owner)
@test ci !== nothing
@test ci.owner === cache_owner
@test ci.max_world == typemax(UInt)
@test Base.module_build_id(TestAbsIntPrecompile1) ==
Base.object_build_id(ci)
end
end
let m = only(methods(sum, (Vector{Float64},)))
found = false
for mi in Base.specializations(m)
if mi isa Core.MethodInstance && mi.specTypes == Tuple{typeof(sum),Vector{Float64}}
ci = mi.cache
@test_broken isdefined(ci, :next)
@test_broken ci.owner === cache_owner
@test_skip begin
@test ci.max_world == typemax(UInt)
@test Base.module_build_id(TestAbsIntPrecompile1) ==
Base.object_build_id(ci)
ci = ci.next
end
@test !isdefined(ci, :next)
ci = check_presence(mi, nothing)
@test ci !== nothing
@test ci.owner === nothing
@test ci.max_world == typemax(UInt)
@test Base.module_build_id(TestAbsIntPrecompile1) == Base.object_build_id(ci)
ci = check_presence(mi, cache_owner)
@test ci !== nothing
@test ci.owner === cache_owner
@test ci.max_world == typemax(UInt)
@test Base.module_build_id(TestAbsIntPrecompile1) ==
Base.object_build_id(ci)
found = true
break
end
end
@test found
end
end
end
Expand Down
37 changes: 13 additions & 24 deletions test/precompile_absint2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,44 +62,33 @@ precompile_test_harness() do load_path
TestAbsIntPrecompile2.Custom.PrecompileInterpreter())
let m = only(methods(TestAbsIntPrecompile2.basic_callee))
mi = only(Base.specializations(m))
ci = mi.cache
@test_broken isdefined(ci, :next)
ci = check_presence(mi, nothing)
@test ci !== nothing
@test ci.owner === nothing
@test ci.max_world == typemax(UInt)
@test Base.module_build_id(TestAbsIntPrecompile2) ==
Base.object_build_id(ci)
@test_skip begin
ci = ci.next
@test !isdefined(ci, :next)
ci = check_presence(mi, cache_owner)
@test ci !== nothing
@test ci.owner === cache_owner
@test ci.max_world == typemax(UInt)
@test Base.module_build_id(TestAbsIntPrecompile2) ==
Base.object_build_id(ci)
end
@test Base.module_build_id(TestAbsIntPrecompile2) == Base.object_build_id(ci)
end
let m = only(methods(sum, (Vector{Float64},)))
found = false
for mi = Base.specializations(m)
if mi isa Core.MethodInstance && mi.specTypes == Tuple{typeof(sum),Vector{Float64}}
ci = mi.cache
@test_broken isdefined(ci, :next)
@test_broken ci.owner === cache_owner
@test_skip begin
@test ci.max_world == typemax(UInt)
@test Base.module_build_id(TestAbsIntPrecompile2) ==
Base.object_build_id(ci)
ci = ci.next
end
@test !isdefined(ci, :next)
ci = check_presence(mi, nothing)
@test ci !== nothing
@test ci.owner === nothing
@test ci.max_world == typemax(UInt)
@test Base.module_build_id(TestAbsIntPrecompile2) ==
Base.object_build_id(ci)
found = true
break
@test Base.module_build_id(TestAbsIntPrecompile2) == Base.object_build_id(ci)
ci = check_presence(mi, cache_owner)
@test ci !== nothing
@test ci.owner === cache_owner
@test ci.max_world == typemax(UInt)
@test Base.module_build_id(TestAbsIntPrecompile2) == Base.object_build_id(ci)
end
end
@test found
end
end
end
Expand Down
11 changes: 11 additions & 0 deletions test/precompile_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,14 @@ let original_depot_path = copy(Base.DEPOT_PATH)
append!(Base.LOAD_PATH, original_load_path)
end
end

function check_presence(mi, token)
ci = isdefined(mi, :cache) ? mi.cache : nothing
while ci !== nothing
if ci.owner === token && ci.max_world == typemax(UInt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something probably went horribly wrong if ci.max_world != WORLD_AGE_REVALIDATION_SENTINEL, since that means the Compiler made a mistake and forgot to validate it

return ci
end
ci = isdefined(ci, :next) ? ci.next : nothing
end
return nothing
end