Skip to content

Commit 43ead47

Browse files
authored
reflection: Label "dynamic invoke" in code_typed (#58411)
1 parent 52e14cc commit 43ead47

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

Compiler/src/abstractinterpretation.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,7 +2215,7 @@ function abstract_call_unionall(interp::AbstractInterpreter, argtypes::Vector{An
22152215
return CallMeta(ret, Any, Effects(EFFECTS_TOTAL; nothrow), call.info)
22162216
end
22172217

2218-
function ci_abi(ci::CodeInstance)
2218+
function get_ci_abi(ci::CodeInstance)
22192219
def = ci.def
22202220
isa(def, ABIOverride) && return def.abi
22212221
(def::MethodInstance).specTypes
@@ -2238,7 +2238,7 @@ function abstract_invoke(interp::AbstractInterpreter, arginfo::ArgInfo, si::Stmt
22382238
if isa(method_or_ci, CodeInstance)
22392239
our_world = sv.world.this
22402240
argtype = argtypes_to_type(pushfirst!(argtype_tail(argtypes, 4), ft))
2241-
specsig = ci_abi(method_or_ci)
2241+
specsig = get_ci_abi(method_or_ci)
22422242
defdef = get_ci_mi(method_or_ci).def
22432243
exct = method_or_ci.exctype
22442244
if !hasintersect(argtype, specsig)

Compiler/src/ssair/show.jl

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ using .Compiler: ALWAYS_FALSE, ALWAYS_TRUE, argextype, BasicBlock, block_for_ins
1212
CachedMethodTable, CFG, compute_basic_blocks, DebugInfoStream, Effects,
1313
EMPTY_SPTYPES, getdebugidx, IncrementalCompact, InferenceResult, InferenceState,
1414
InvalidIRError, IRCode, LimitedAccuracy, NativeInterpreter, scan_ssa_use!,
15-
singleton_type, sptypes_from_meth_instance, StmtRange, Timings, VarState, widenconst
15+
singleton_type, sptypes_from_meth_instance, StmtRange, Timings, VarState, widenconst,
16+
get_ci_mi, get_ci_abi
1617

1718
@nospecialize
1819

@@ -95,16 +96,14 @@ function print_stmt(io::IO, idx::Int, @nospecialize(stmt), code::Union{IRCode,Co
9596
elseif isexpr(stmt, :invoke) && length(stmt.args) >= 2 && isa(stmt.args[1], Union{MethodInstance,CodeInstance})
9697
stmt = stmt::Expr
9798
# TODO: why is this here, and not in Base.show_unquoted
98-
printstyled(io, " invoke "; color = :light_black)
99-
mi = stmt.args[1]
100-
if !(mi isa Core.MethodInstance)
101-
mi = (mi::Core.CodeInstance).def
102-
end
103-
if isa(mi, Core.ABIOverride)
104-
abi = mi.abi
105-
mi = mi.def
99+
ci = stmt.args[1]
100+
if ci isa Core.CodeInstance
101+
printstyled(io, " invoke "; color = :light_black)
102+
mi = get_ci_mi(ci)
103+
abi = get_ci_abi(ci)
106104
else
107-
abi = mi.specTypes
105+
printstyled(io, "dynamic invoke "; color = :yellow)
106+
abi = (ci::Core.MethodInstance).specTypes
108107
end
109108
show_unquoted(io, stmt.args[2], indent)
110109
print(io, "(")

0 commit comments

Comments
 (0)