-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inference: Switch to typename-based override for constprop heuristics #55288
Conversation
As mentioned in #55271, I'd like to get rid of `istopfunction` for various reasons. Rather than hardcoding constprop overrides based on binding name, this annotates the relevant TypeNames (like the existing `max_methods` override), removing the binding lookups from inference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be the best way to implement the special cases.
I came up with this alternative, but I don't think this is necessarily more elegant than this approach:
Core.Compiler
const functions_with_sametype_heuristic = Any[]
base/essentials.jl
for f = Any[+, -, *, ==, !=, <=, >=, <, >, <<, >>]
push!(Core.Compiler.functions_with_sametype_heuristic, f)
end
The problem with using an array in the compiler is that you can't use it in pkgimages. We don't have a use case for that right now, but I don't see a good reason for the restriction. |
Yeah, I agree. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a clearer way to handle it
…JuliaLang#55288) As mentioned in JuliaLang#55271, I'd like to get rid of `istopfunction` for various reasons. Rather than hardcoding constprop overrides based on binding name, this annotates the relevant TypeNames (like the existing `max_methods` override), removing the binding lookups from inference.
This commit teaches to compiler to update its world bounds whenever it looks at a binding partition, making the compiler sound in the presence of a partitioned binding. The key adjustment is that the compiler is no longer allowed to directly query the binding table without recording the world bounds, so all the various abstract evaluations that look at bindings need to be adjusted and are no longer pure tfuncs. We used to look at bindings a lot more, but thanks to earlier prep work to remove unnecessary binding-dependent code (#55288, #55289 and #55271), these changes become relatively straightforward. Note that as before, we do not create any binding partitions by default, so this commit is mostly preperatory.
As mentioned in #55271, I'd like to get rid of
istopfunction
for various reasons. Rather than hardcoding constprop overrides based on binding name, this annotates the relevant TypeNames (like the existingmax_methods
override), removing the binding lookups from inference.