Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,6 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(f),
return CallMeta(rettype, info)
end

widenwrappedconditional(@nospecialize(typ)) = widenconditional(typ)
widenwrappedconditional(typ::LimitedAccuracy) = LimitedAccuracy(widenconditional(typ.typ), typ.causes)

function add_call_backedges!(interp::AbstractInterpreter,
@nospecialize(rettype),
edges::Vector{MethodInstance},
Expand Down Expand Up @@ -1128,7 +1125,7 @@ function abstract_invoke(interp::AbstractInterpreter, argtypes::Vector{Any}, sv:
end
method, valid_worlds = result
update_valid_age!(sv, valid_worlds)
(ti, env) = ccall(:jl_type_intersection_with_env, Any, (Any, Any), nargtype, method.sig)::SimpleVector
(ti, env::SimpleVector) = ccall(:jl_type_intersection_with_env, Any, (Any, Any), nargtype, method.sig)::SimpleVector
rt, edge = typeinf_edge(interp, method, ti, env, sv)
edge !== nothing && add_backedge!(edge::MethodInstance, sv)
return CallMeta(rt, InvokeCallInfo(MethodMatch(ti, env, method, argtype <: method.sig)))
Expand Down
3 changes: 1 addition & 2 deletions base/compiler/typeinfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,7 @@ function finish(me::InferenceState, interp::AbstractInterpreter)
# prepare to run optimization passes on fulltree
s_edges = me.stmt_edges[1]
if s_edges === nothing
s_edges = []
me.stmt_edges[1] = s_edges
s_edges = me.stmt_edges[1] = []
end
for edges in me.stmt_edges
edges === nothing && continue
Expand Down
13 changes: 5 additions & 8 deletions base/compiler/typelattice.jl
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ function widenconditional(typ::AnyConditional)
end
widenconditional(t::LimitedAccuracy) = error("unhandled LimitedAccuracy")

widenwrappedconditional(@nospecialize(typ)) = widenconditional(typ)
widenwrappedconditional(typ::LimitedAccuracy) = LimitedAccuracy(widenconditional(typ.typ), typ.causes)

ignorelimited(@nospecialize typ) = typ
ignorelimited(typ::LimitedAccuracy) = typ.typ

Expand All @@ -329,10 +332,7 @@ function stupdate!(state::Nothing, changes::StateUpdate)
if isa(newtype, VarState)
newtypetyp = ignorelimited(newtype.typ)
if isa(newtypetyp, Conditional) && slot_id(newtypetyp.var) == changeid
newtypetyp = widenconditional(newtypetyp)
if newtype.typ isa LimitedAccuracy
newtypetyp = LimitedAccuracy(newtypetyp, newtype.typ.causes)
end
newtypetyp = widenwrappedconditional(newtype.typ)
newst[i] = VarState(newtypetyp, newtype.undef)
end
end
Expand Down Expand Up @@ -360,10 +360,7 @@ function stupdate!(state::VarTable, changes::StateUpdate)
if !changes.conditional && isa(newtype, VarState)
newtypetyp = ignorelimited(newtype.typ)
if isa(newtypetyp, Conditional) && slot_id(newtypetyp.var) == changeid
newtypetyp = widenconditional(newtypetyp)
if newtype.typ isa LimitedAccuracy
newtypetyp = LimitedAccuracy(newtypetyp, newtype.typ.causes)
end
newtypetyp = widenwrappedconditional(newtype.typ)
newtype = VarState(newtypetyp, newtype.undef)
end
end
Expand Down
6 changes: 3 additions & 3 deletions base/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ function code_lowered(@nospecialize(f), @nospecialize(t=Tuple); generated::Bool=
throw(ArgumentError("'debuginfo' must be either :source or :none"))
end
return map(method_instances(f, t)) do m
if generated && isgenerated(m)
if generated && hasgenerator(m)
if may_invoke_generator(m)
return ccall(:jl_code_for_staged, Any, (Any,), m)::CodeInfo
else
Expand All @@ -877,8 +877,8 @@ function code_lowered(@nospecialize(f), @nospecialize(t=Tuple); generated::Bool=
end
end

isgenerated(m::Method) = isdefined(m, :generator)
isgenerated(m::Core.MethodInstance) = isgenerated(m.def)
hasgenerator(m::Method) = isdefined(m, :generator)
hasgenerator(m::Core.MethodInstance) = hasgenerator(m.def::Method)

# low-level method lookup functions used by the compiler

Expand Down