Skip to content

Commit 23a5b04

Browse files
timholyvtjnash
andauthored
Add missing entry to invalidation log (#49449)
* Add missing entry to invalidation log Addresses JuliaDebug/SnoopCompile.jl#357 (comment) using the observation in the following comment. Co-authored-by: Jameson Nash <vtjnash@gmail.com> * Fix indentation --------- Co-authored-by: Jameson Nash <vtjnash@gmail.com>
1 parent bb83df1 commit 23a5b04

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

src/staticdata_utils.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,18 +1022,18 @@ static int jl_verify_graph_edge(size_t *maxvalids2_data, jl_array_t *edges, size
10221022
if (idx != childidx) {
10231023
if (max_valid < maxvalids2_data[childidx])
10241024
maxvalids2_data[childidx] = max_valid;
1025-
if (_jl_debug_method_invalidation && max_valid != ~(size_t)0) {
1026-
jl_method_instance_t *mi = (jl_method_instance_t*)jl_array_ptr_ref(edges, childidx * 2);
1027-
jl_value_t *loctag = NULL;
1028-
JL_GC_PUSH1(&loctag);
1029-
jl_array_ptr_1d_push(_jl_debug_method_invalidation, (jl_value_t*)mi);
1030-
loctag = jl_cstr_to_string("verify_methods");
1031-
jl_array_ptr_1d_push(_jl_debug_method_invalidation, loctag);
1032-
jl_array_ptr_1d_push(_jl_debug_method_invalidation, (jl_value_t*)cause);
1033-
JL_GC_POP();
1034-
}
10351025
}
10361026
visited->items[childidx] = (void*)1;
1027+
if (_jl_debug_method_invalidation && max_valid != ~(size_t)0) {
1028+
jl_method_instance_t *mi = (jl_method_instance_t*)jl_array_ptr_ref(edges, childidx * 2);
1029+
jl_value_t *loctag = NULL;
1030+
JL_GC_PUSH1(&loctag);
1031+
jl_array_ptr_1d_push(_jl_debug_method_invalidation, (jl_value_t*)mi);
1032+
loctag = jl_cstr_to_string("verify_methods");
1033+
jl_array_ptr_1d_push(_jl_debug_method_invalidation, loctag);
1034+
jl_array_ptr_1d_push(_jl_debug_method_invalidation, (jl_value_t*)cause);
1035+
JL_GC_POP();
1036+
}
10371037
}
10381038
return 0;
10391039
}

test/precompile.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,9 +857,13 @@ precompile_test_harness("code caching") do dir
857857
858858
# This will be invalidated if StaleC is loaded
859859
useA() = $StaleA.stale("hello")
860+
useA2() = useA()
860861
861862
# force precompilation
862-
useA()
863+
begin
864+
Base.Experimental.@force_compile
865+
useA2()
866+
end
863867
864868
## Reporting tests
865869
call_nbits(x::Integer) = $StaleA.nbits(x)
@@ -940,6 +944,10 @@ precompile_test_harness("code caching") do dir
940944
@test invalidations[j-1] == "insert_backedges_callee"
941945
@test isa(invalidations[j-2], Type)
942946
@test isa(invalidations[j+1], Vector{Any}) # [nbits(::UInt8)]
947+
m = only(methods(MB.useA2))
948+
mi = only(Base.specializations(m))
949+
@test !hasvalid(mi, world)
950+
@test mi invalidations
943951

944952
m = only(methods(MB.map_nbits))
945953
@test !hasvalid(m.specializations::Core.MethodInstance, world+1) # insert_backedges invalidations also trigger their backedges

0 commit comments

Comments
 (0)