Skip to content
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

edge creation mistake #56577

Closed
vtjnash opened this issue Nov 15, 2024 · 0 comments · Fixed by #56598
Closed

edge creation mistake #56577

vtjnash opened this issue Nov 15, 2024 · 0 comments · Fixed by #56598

Comments

@vtjnash
Copy link
Member

vtjnash commented Nov 15, 2024

Looking at why some code wasn't loading correctly, I found this edge list isn't being generated correctly for nteltype(::Type) with 3 entries present for it where there should only be at most one of a different kind (method table rather than call and widened invoke given the resulting code), though preferable this would be zero edges:

julia> code_typed(eltype, (Type{A} where A<:(NamedTuple{names, T} where T<:Tuple{Vararg{Any, N}} where names where N),))[2][1].edges
7-element Vector{Any}:
 2
  Tuple{typeof(Base.nteltype), Type{A} where A<:(NamedTuple{names, T} where {N, names, T<:NTuple{N, Any}})}
  CodeInstance for MethodInstance for Base.nteltype(::Type{NamedTuple{names, T}} where names) where {N, T<:NTuple{N, Any}}
  nteltype(::Type) @ Base namedtuple.jl:230
  MethodInstance for Base.nteltype(::Type{A} where A<:(NamedTuple{names, T} where {N, names, T<:NTuple{N, Any}}))
  Tuple{typeof(Base.nteltype), Type}
  MethodInstance for Base.nteltype(::Type)

julia> code_typed(eltype, (Type{A} where A<:(NamedTuple{names, T} where T<:Tuple{Vararg{Any, N}} where names where N),))[2][1]
CodeInfo(
    @ namedtuple.jl:229 within `eltype`
1%1 = $(Expr(:static_parameter, 1))::Type{A} where A<:(NamedTuple{names, T} where {N, names, T<:NTuple{N, Any}})%2 =   dynamic Base.nteltype(%1)::Any
└──      return %2
)
vtjnash added a commit that referenced this issue Nov 18, 2024
- incorrect edge types were being added from inlining: there is minimal
  dispatch info available, so best not to add that (which was already
  added earlier) as it results in failures to validate later
- MethodTable/sig order in edges could confuse the iterator: always put
  the type before the edge now as that is more consistent
- edges wasn't converted to a SimpleVector, so they might get ignored
  later from being in the wrong format
- edges were not populated for optimize=false, which made debugging them
  more inconvenient

Fixes #56577
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 a pull request may close this issue.

1 participant