Skip to content

Commit b49b352

Browse files
topolarityKristofferC
authored andcommitted
reflection: Label "dynamic invoke" in code_typed (#58411)
(cherry picked from commit 43ead47)
1 parent 369ed27 commit b49b352

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
@@ -2210,7 +2210,7 @@ function abstract_call_unionall(interp::AbstractInterpreter, argtypes::Vector{An
22102210
return CallMeta(ret, Any, Effects(EFFECTS_TOTAL; nothrow), call.info)
22112211
end
22122212

2213-
function ci_abi(ci::CodeInstance)
2213+
function get_ci_abi(ci::CodeInstance)
22142214
def = ci.def
22152215
isa(def, ABIOverride) && return def.abi
22162216
(def::MethodInstance).specTypes
@@ -2233,7 +2233,7 @@ function abstract_invoke(interp::AbstractInterpreter, arginfo::ArgInfo, si::Stmt
22332233
if isa(method_or_ci, CodeInstance)
22342234
our_world = sv.world.this
22352235
argtype = argtypes_to_type(pushfirst!(argtype_tail(argtypes, 4), ft))
2236-
specsig = ci_abi(method_or_ci)
2236+
specsig = get_ci_abi(method_or_ci)
22372237
defdef = get_ci_mi(method_or_ci).def
22382238
exct = method_or_ci.exctype
22392239
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)