Skip to content

Add matches for invoke invalidations#57999

Merged
timholy merged 3 commits intomasterfrom
teh/invoke_matches
Apr 4, 2025
Merged

Add matches for invoke invalidations#57999
timholy merged 3 commits intomasterfrom
teh/invoke_matches

Conversation

@timholy
Copy link
Copy Markdown
Member

@timholy timholy commented Apr 3, 2025

While working on JuliaDebug/SnoopCompile.jl#418 I noticed that the edge invalidation (but not the corresponding method-insertion invalidation) of the form

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

using PkgA
InvalidA.f(::Signed) = 4
using PkgB

did not attribute a "cause":

...
Tuple{typeof(InvalidA.f), Signed}
 "insert_backedges_callee"
 CodeInstance for MethodInstance for InvalidA.invokesfs(::Int64)
 nothing
...

This aims to fill in the new method that replaced the previous dispatch.

Co-authored-by: Jameson Nash <vtjnash@gmail.com>
@timholy timholy added the merge me PR is reviewed. Merge when all tests are passing label Apr 4, 2025
@timholy timholy merged commit 15e0deb into master Apr 4, 2025
6 of 8 checks passed
@timholy timholy deleted the teh/invoke_matches branch April 4, 2025 10:46
@timholy timholy added backport 1.12 Change should be backported to release-1.12 and removed merge me PR is reviewed. Merge when all tests are passing labels Apr 4, 2025
timholy added a commit that referenced this pull request Apr 9, 2025
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 <vtjnash@gmail.com>
(cherry picked from commit 15e0deb)
@timholy timholy mentioned this pull request Apr 9, 2025
51 tasks
@timholy timholy removed the backport 1.12 Change should be backported to release-1.12 label Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants