-
-
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
fix #44153, limit input types of reflection utilities #44155
Conversation
After #43113 Julia compiler can inline `@nospecialize ::AbstractType` signature, so we can reintroduce the input type annotations. Still I want to keep the current `::Any` signature for those utility functions heavily in `Core.Compiler` (e.g. `isbitstype`) because `isa(t, Type)` check inserted by the inliner otherwise might involve some cost. But I agree that the other non-performance sensitive functions like `which` is better to have input type restrictions.
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.
Still I want to keep the current
::Any
signature for those utility
functions heavily inCore.Compiler
(e.g.isbitstype
) becauseisa(t, Type)
check inserted by the inliner otherwise might involve some cost.
Yes, I think those should be fine, they shouldn't lead to segfaults at least.
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.
LGTM. At some point we should try to handle the Union case too though, since that is also a type it can encounter:
julia> which(Union{Tuple{typeof(+),Int64,Int64}, Tuple{typeof(+),Int32,Int32}})
julia: /data/vtjnash/julia/src/gf.c:2775: ml_matches: Assertion `jl_is_datatype(unw)' failed.
julia> Base._methods_by_ftype(Union{Tuple{typeof(+),Int64,Int64}, Tuple{typeof(+),Int32,Int32}}, -1, Base.get_world_counter())
julia: /data/vtjnash/julia/src/gf.c:2775: ml_matches: Assertion `jl_is_datatype(unw)' failed.
aha, so |
…Lang#44155) After JuliaLang#43113 Julia compiler can inline `@nospecialize ::AbstractType` signature, so we can reintroduce the input type annotations. Still I want to keep the current `::Any` signature for those utility functions heavily in `Core.Compiler` (e.g. `isbitstype`) because `isa(t, Type)` check inserted by the inliner otherwise might involve some cost. But I agree that the other non-performance sensitive functions like `which` is better to have input type restrictions.
…Lang#44155) After JuliaLang#43113 Julia compiler can inline `@nospecialize ::AbstractType` signature, so we can reintroduce the input type annotations. Still I want to keep the current `::Any` signature for those utility functions heavily in `Core.Compiler` (e.g. `isbitstype`) because `isa(t, Type)` check inserted by the inliner otherwise might involve some cost. But I agree that the other non-performance sensitive functions like `which` is better to have input type restrictions.
…Lang#44155) After JuliaLang#43113 Julia compiler can inline `@nospecialize ::AbstractType` signature, so we can reintroduce the input type annotations. Still I want to keep the current `::Any` signature for those utility functions heavily in `Core.Compiler` (e.g. `isbitstype`) because `isa(t, Type)` check inserted by the inliner otherwise might involve some cost. But I agree that the other non-performance sensitive functions like `which` is better to have input type restrictions.
After #43113 Julia compiler can inline
@nospecialize ::AbstractType
signature, so we can reintroduce the input type annotations.
Still I want to keep the current
::Any
signature for those utilityfunctions heavily in
Core.Compiler
(e.g.isbitstype
) becauseisa(t, Type)
check inserted by the inliner otherwise might involve some cost.
But I agree that the other non-performance sensitive functions like
which
is better to have input type restrictions.