Skip to content

Commit 15e0deb

Browse files
timholyvtjnash
andauthored
Add matches for invoke invalidations (JuliaLang#57999)
Edge invalidations of the form ```julia Package InvalidA: module InvalidA f(::Integer) = 1 invokesfs(x) = invoke(f, Tuple{Signed}, x) end Package InvalidB: module InvalidB using InvalidA InvalidA.invokesfs(1) # precompile end ``` used as ```julia using PkgA InvalidA.f(::Signed) = 4 using PkgB ``` did not formerly attribute a "cause": ``` ... Tuple{typeof(InvalidA.f), Signed} "insert_backedges_callee" CodeInstance for MethodInstance for InvalidA.invokesfs(::Int64) nothing ... ``` This fills in the new method that replaced the previous dispatch. --------- Co-authored-by: Jameson Nash <[email protected]>
1 parent 3627a85 commit 15e0deb

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

base/staticdata.jl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ function verify_method(codeinst::CodeInstance, stack::Vector{CodeInstance}, visi
162162
else
163163
meth = callee::Method
164164
end
165-
min_valid2, max_valid2 = verify_invokesig(edge, meth, world)
166-
matches = nothing
165+
min_valid2, max_valid2, matches = verify_invokesig(edge, meth, world)
167166
j += 2
168167
end
169168
if minworld < min_valid2
@@ -295,6 +294,7 @@ end
295294
function verify_invokesig(@nospecialize(invokesig), expected::Method, world::UInt)
296295
@assert invokesig isa Type
297296
local minworld::UInt, maxworld::UInt
297+
matched = nothing
298298
if invokesig === expected.sig
299299
# the invoke match is `expected` for `expected->sig`, unless `expected` is invalid
300300
minworld = expected.primary_world
@@ -314,12 +314,15 @@ function verify_invokesig(@nospecialize(invokesig), expected::Method, world::UIn
314314
minworld, maxworld = valid_worlds.min_world, valid_worlds.max_world
315315
if matched === nothing
316316
maxworld = 0
317-
elseif matched.method != expected
318-
maxworld = 0
317+
else
318+
matched = Any[matched.method]
319+
if matched[] !== expected
320+
maxworld = 0
321+
end
319322
end
320323
end
321324
end
322-
return minworld, maxworld
325+
return minworld, maxworld, matched
323326
end
324327

325328
end # module StaticData

0 commit comments

Comments
 (0)