Skip to content

Commit 2c35132

Browse files
authored
Address some post-commit review from JuliaLang#56660 (JuliaLang#56747)
Some more questions still to be answered, but this should address the immediate actionable review items.
1 parent dc37fb5 commit 2c35132

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

extras/CompilerDevTools/src/CompilerDevTools.jl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,11 @@ import Core.OptimizedGenerics.CompilerPlugins: typeinf, typeinf_edge
3434
Compiler.typeinf_edge(interp, mi.def, mi.specTypes, Core.svec(), parent_frame, false, false)
3535
end
3636

37-
# TODO: This needs special compiler support to properly case split for multiple
38-
# method matches, etc.
39-
@noinline function mi_for_tt(tt, world=Base.tls_world_age())
40-
interp = SplitCacheInterp(; world)
41-
match, _ = Compiler.findsup(tt, Compiler.method_table(interp))
42-
Base.specialize_method(match)
43-
end
44-
4537
function with_new_compiler(f, args...)
46-
tt = Base.signature_type(f, typeof(args))
38+
mi = @ccall jl_method_lookup(Any[f, args...]::Ptr{Any}, (1+length(args))::Csize_t, Base.tls_world_age()::Csize_t)::Ref{Core.MethodInstance}
4739
world = Base.tls_world_age()
4840
new_compiler_ci = Core.OptimizedGenerics.CompilerPlugins.typeinf(
49-
SplitCacheOwner(), mi_for_tt(tt), Compiler.SOURCE_MODE_ABI
41+
SplitCacheOwner(), mi, Compiler.SOURCE_MODE_ABI
5042
)
5143
invoke(f, new_compiler_ci, args...)
5244
end

src/abstractinterpretation.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,11 +2223,12 @@ function abstract_invoke(interp::AbstractInterpreter, arginfo::ArgInfo, si::Stmt
22232223
if isa(method_or_ci, CodeInstance)
22242224
our_world = sv.world.this
22252225
argtype = argtypes_to_type(pushfirst!(argtype_tail(argtypes, 4), ft))
2226-
sig = method_or_ci.def.specTypes
2226+
specsig = method_or_ci.def.specTypes
2227+
defdef = method_or_ci.def.def
22272228
exct = method_or_ci.exctype
2228-
if !hasintersect(argtype, sig)
2229+
if !hasintersect(argtype, specsig)
22292230
return Future(CallMeta(Bottom, TypeError, EFFECTS_THROWS, NoCallInfo()))
2230-
elseif !(argtype <: sig)
2231+
elseif !(argtype <: specsig) || (isa(defdef, Method) && !(argtype <: defdef.sig))
22312232
exct = Union{exct, TypeError}
22322233
end
22332234
callee_valid_range = WorldRange(method_or_ci.min_world, method_or_ci.max_world)
@@ -2257,7 +2258,7 @@ function abstract_invoke(interp::AbstractInterpreter, arginfo::ArgInfo, si::Stmt
22572258
# Fall through to generic invoke handling
22582259
end
22592260
else
2260-
widenconst(types) >: Union{Method, CodeInstance} && return Future(CallMeta(Any, Any, Effects(), NoCallInfo()))
2261+
hasintersect(widenconst(types), Union{Method, CodeInstance}) && return Future(CallMeta(Any, Any, Effects(), NoCallInfo()))
22612262
(types, isexact, isconcrete, istype) = instanceof_tfunc(argtype_by_index(argtypes, 3), false)
22622263
isexact || return Future(CallMeta(Any, Any, Effects(), NoCallInfo()))
22632264
unwrapped = unwrap_unionall(types)

src/stmtinfo.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ struct InvokeCICallInfo <: CallInfo
277277
edge::CodeInstance
278278
end
279279
add_edges_impl(edges::Vector{Any}, info::InvokeCICallInfo) =
280-
add_one_edge!(edges, info.edge)
280+
add_inlining_edge!(edges, info.edge)
281281

282282
"""
283283
info::InvokeCallInfo

0 commit comments

Comments
 (0)