You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support "Functor-like" code_typed invocation (JuliaLang#57911)
This lets you easily inspect IR associated with "Functor-like" methods:
```julia
julia> (f::Foo)(offset::Float64) = f.x + f.y + offset
julia> code_typed((Foo, Float64))
1-element Vector{Any}:
CodeInfo(
1 ─ %1 = Base.getfield(f, :x)::Int64
│ %2 = Base.getfield(f, :y)::Int64
│ %3 = Base.add_int(%1, %2)::Int64
│ %4 = Base.sitofp(Float64, %3)::Float64
│ %5 = Base.add_float(%4, offset)::Float64
└── return %5
) => Float64
```
This is just a small convenience over `code_typed_by_type`, but I'm in
support of it (even though it technically changes the meaning of, e.g.,
`code_typed((1, 2))` which without this PR inspects
`(::Tuple{Int,Int})(::Vararg{Any})`
We should probably update all of our reflection machinery (`code_llvm`,
`code_lowered`, `methodinstance`, etc.) to support this "non-arg0" style
as well, but I wanted to open this first to make sure folks like it.
0 commit comments