timholy / SnoopCompile.jl

Provide insights about latency (TTFX) for Julia packages
https://timholy.github.io/SnoopCompile.jl/dev/
Other
309 stars 48 forks source link

MethodError: Cannot `convert` an object of type Vector{Any} to an object of type UInt64 on julia nightly #305

Closed jishnub closed 1 year ago

jishnub commented 1 year ago

MWE (using the master branch of ApproxFunBase.jl, I've used the commit https://github.com/JuliaApproximation/ApproxFunBase.jl/commit/79da383788f749ed24dc52078fb93725ff068513 if this matters):

julia> VERSION
v"1.9.0-DEV.1584"

julia> using SnoopCompileCore

julia> invalidations = @snoopr using ApproxFunBase;

julia> length(invalidations)
1723

julia> using SnoopCompile

julia> trees = invalidation_trees(invalidations)
ERROR: MethodError: Cannot `convert` an object of type Vector{Any} to an object of type UInt64

Closest candidates are:
  convert(::Type{T}, ::Ptr) where T<:Integer
   @ Base pointer.jl:23
  convert(::Type{T}, ::ApproxFunBase.ConstantTimesOperator) where T<:Number
   @ ApproxFunBase ~/Dropbox/JuliaPackages/ApproxFunBase/src/Operators/general/algebra.jl:172
  convert(::Type{T}, ::BlockArrays.Block{1}) where T<:Number
   @ BlockArrays ~/.julia/packages/BlockArrays/5iQPM/src/blockindices.jl:95
  ...

Stacktrace:
 [1] cvt1
   @ ./essentials.jl:418 [inlined]
 [2] ntuple
   @ ./ntuple.jl:49 [inlined]
 [3] convert(#unused#::Type{Tuple{Int32, UInt64}}, x::Tuple{Int32, Vector{Any}})
   @ Base ./essentials.jl:419
 [4] setindex!(h::Dict{Tuple{Int32, UInt64}, Tuple{Any, Vector{Any}}}, v0::Tuple{Core.MethodInstance, DataType}, key0::Tuple{Int32, Vector{Any}})
   @ Base ./dict.jl:361
 [5] (::SnoopCompile.var"#handle_insert_backedges#138")(list::Vector{Any}, i::Int64, callee::Core.MethodInstance)
   @ SnoopCompile ~/.julia/packages/SnoopCompile/TtLwA/src/invalidations.jl:293
 [6] invalidation_trees(list::Vector{Any}; exclude_corecompiler::Bool)
   @ SnoopCompile ~/.julia/packages/SnoopCompile/TtLwA/src/invalidations.jl:373
 [7] invalidation_trees(list::Vector{Any})
   @ SnoopCompile ~/.julia/packages/SnoopCompile/TtLwA/src/invalidations.jl:288
 [8] top-level scope
   @ REPL[5]:1

A similar error was also seen in Polynomials.jl, although, oddly, I can't reproduce this

timholy commented 1 year ago

On SnoopCompile v2.9.7, I can't replicate this with either Julia 1.8.4 or nightly. There have been many fixes to both the package and Julia (https://github.com/timholy/SnoopCompile.jl/issues/315#issuecomment-1377218195). Feel free to reopen if this is still an issue.