diff --git a/src/staticdata_utils.c b/src/staticdata_utils.c index e01ba40c63aed..83a0b59c88bb0 100644 --- a/src/staticdata_utils.c +++ b/src/staticdata_utils.c @@ -1022,18 +1022,18 @@ static int jl_verify_graph_edge(size_t *maxvalids2_data, jl_array_t *edges, size if (idx != childidx) { if (max_valid < maxvalids2_data[childidx]) maxvalids2_data[childidx] = max_valid; - if (_jl_debug_method_invalidation && max_valid != ~(size_t)0) { - jl_method_instance_t *mi = (jl_method_instance_t*)jl_array_ptr_ref(edges, childidx * 2); - jl_value_t *loctag = NULL; - JL_GC_PUSH1(&loctag); - jl_array_ptr_1d_push(_jl_debug_method_invalidation, (jl_value_t*)mi); - loctag = jl_cstr_to_string("verify_methods"); - jl_array_ptr_1d_push(_jl_debug_method_invalidation, loctag); - jl_array_ptr_1d_push(_jl_debug_method_invalidation, (jl_value_t*)cause); - JL_GC_POP(); - } } visited->items[childidx] = (void*)1; + if (_jl_debug_method_invalidation && max_valid != ~(size_t)0) { + jl_method_instance_t *mi = (jl_method_instance_t*)jl_array_ptr_ref(edges, childidx * 2); + jl_value_t *loctag = NULL; + JL_GC_PUSH1(&loctag); + jl_array_ptr_1d_push(_jl_debug_method_invalidation, (jl_value_t*)mi); + loctag = jl_cstr_to_string("verify_methods"); + jl_array_ptr_1d_push(_jl_debug_method_invalidation, loctag); + jl_array_ptr_1d_push(_jl_debug_method_invalidation, (jl_value_t*)cause); + JL_GC_POP(); + } } return 0; } diff --git a/test/precompile.jl b/test/precompile.jl index 37498068fd39c..79e12939c615e 100644 --- a/test/precompile.jl +++ b/test/precompile.jl @@ -857,9 +857,13 @@ precompile_test_harness("code caching") do dir # This will be invalidated if StaleC is loaded useA() = $StaleA.stale("hello") + useA2() = useA() # force precompilation - useA() + begin + Base.Experimental.@force_compile + useA2() + end ## Reporting tests call_nbits(x::Integer) = $StaleA.nbits(x) @@ -940,6 +944,10 @@ precompile_test_harness("code caching") do dir @test invalidations[j-1] == "insert_backedges_callee" @test isa(invalidations[j-2], Type) @test isa(invalidations[j+1], Vector{Any}) # [nbits(::UInt8)] + m = only(methods(MB.useA2)) + mi = only(Base.specializations(m)) + @test !hasvalid(mi, world) + @test mi ∈ invalidations m = only(methods(MB.map_nbits)) @test !hasvalid(m.specializations::Core.MethodInstance, world+1) # insert_backedges invalidations also trigger their backedges