Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust to upstream edges change #296

Merged
merged 1 commit into from
Nov 12, 2024
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
8 changes: 3 additions & 5 deletions src/analysis/forward.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ function fwd_abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize
frc = frule_call[]
pc = primal_call[]

if frc.rt !== Const(nothing)
result[] = CallMeta(pc.rt, pc.exct, pc.effects, FRuleCallInfo(pc.info, frc))
else
result[] = pc
if VERSION < v"1.12.0-DEV.1531" && frc.rt === Const(nothing)
CC.add_mt_backedge!(sv, frule_mt, frule_atype)
end

result[] = CallMeta(pc.rt, pc.exct, pc.effects, FRuleCallInfo(pc.info, frc))
return true
end
(!isready(primal_call) || !make_progress(interp, sv)) && push!(sv.tasks, make_progress)
Expand Down Expand Up @@ -89,7 +87,7 @@ function fwd_abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize
@static if VERSION ≥ v"1.11.0-DEV.945"
return CallMeta(primal_call.rt, primal_call.exct, primal_call.effects, FRuleCallInfo(primal_call.info, frule_call))
else
return CallMeta(primal_call.rt, primal_call.effects, FRuleCallInfo(primal_call.info, frule_call))
return CallMeta(primal_call.rt, primal_call.effects, FRuleCallInfo(primal_call.info, frule_call.info))
end
else
CC.add_mt_backedge!(sv, frule_mt, frule_atype)
Expand Down
10 changes: 9 additions & 1 deletion src/stage2/lattice.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,22 @@ end
struct FRuleCallInfo <: CallInfo
info::CallInfo
frule_call::CallMeta
FRuleCallInfo(@nospecialize(info::CallInfo), frule_call::CallMeta) = new(info, frule_call)
function FRuleCallInfo(@nospecialize(info::CallInfo), frule_call::CallMeta)
new(info, frule_call)
end
end
CC.nsplit_impl(info::FRuleCallInfo) = CC.nsplit(info.info)
CC.getsplit_impl(info::FRuleCallInfo, idx::Int) = CC.getsplit(info.info, idx)
CC.getresult_impl(info::FRuleCallInfo, idx::Int) = CC.getresult(info.info, idx)
if isdefined(CC, :add_uncovered_edges_impl)
CC.add_uncovered_edges_impl(edges::Vector{Any}, info::FRuleCallInfo, @nospecialize(atype)) = CC.add_uncovered_edges!(edges, info.info, atype)
end
if isdefined(CC, :add_edges_impl)
function CC.add_edges_impl(edges::Vector{Any}, info::FRuleCallInfo)
CC.add_edges!(edges, info.info)
CC.add_edges!(edges, info.frule_call.info)
end
Comment on lines +80 to +83
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think this implementation allows the method table backedge equivalent to CC.add_mt_backedge!(sv, frule_mt, frule_atype) to be created, but I also think this should be sufficient for the purpose of invalidating when a new frule is added—which was the reason for adding add_mt_backedge!. In the current implementation, a backedge is added to the fallback frule(...), which I think should trigger equivalent invalidation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, the point was to trigger on additions of new signatures that would change the lookup result. My understanding is that the callinfo encodes exactly the lookup we want, so this should do what we need.

end

function Base.show(io::IO, info::FRuleCallInfo)
print(io, "FRuleCallInfo(", typeof(info.info), ", ", typeof(info.frule_call.info), ")")
Expand Down
Loading