Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Although these code paths don’t seem to be used very often.
  • Loading branch information
aviatesk committed Nov 21, 2024
1 parent c8e687f commit 53e13da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ function find_callsites(interp::AbstractInterpreter, CI::Union{Core.CodeInfo, IR
(; head, args) = stmt
if head === :invoke
rt = argextype(SSAValue(id), CI, sptypes, slottypes)
mi = args[1]::MethodInstance
arg1 = args[1]
if arg1 isa CodeInstance
mi = arg1.def
else
mi = arg1::MethodInstance
end
effects = get_effects(interp, mi, false)
callsite = Callsite(id, MICallInfo(mi, rt, effects), head)
elseif head === :foreigncall
Expand Down
4 changes: 4 additions & 0 deletions test/irutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ end
# check if `x` is a statically-resolved call of a function whose name is `sym`
isinvoke(y) = @nospecialize(x) -> isinvoke(y, x)
isinvoke(sym::Symbol, @nospecialize(x)) = isinvoke(mi->mi.def.name===sym, x)
if VERSION v"1.12.0-DEV.1667"
isinvoke(pred::Function, @nospecialize(x)) = isexpr(x, :invoke) && pred(x.args[1]::CodeInstance)
else
isinvoke(pred::Function, @nospecialize(x)) = isexpr(x, :invoke) && pred(x.args[1]::MethodInstance)
end

function fully_eliminated(@nospecialize args...; retval=(@__FILE__), kwargs...)
code = code_typed1(args...; kwargs...).code
Expand Down

0 comments on commit 53e13da

Please sign in to comment.