Skip to content

Commit

Permalink
FIXME this is very bad commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Mar 19, 2023
1 parent 0d3b533 commit 798e107
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
16 changes: 10 additions & 6 deletions base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,8 @@ function add_call_backedges!(interp::AbstractInterpreter, @nospecialize(rettype)
if !isoverlayed(method_table(interp))
all_effects = Effects(all_effects; nonoverlayed=false)
end
if (# ignore the `:noinbounds` property if `:consistent`-cy is tainted already
if isa(sv, InferenceState) && (
# ignore the `:noinbounds` property if `:consistent`-cy is tainted already
sv.ipo_effects.consistent === ALWAYS_FALSE || all_effects.consistent === ALWAYS_FALSE ||
# or this `:noinbounds` doesn't taint it
!stmt_taints_inbounds_consistency(sv))
Expand Down Expand Up @@ -561,7 +562,8 @@ function abstract_call_method(interp::AbstractInterpreter, method::Method, @nosp
break
end
topmost === nothing || continue
if edge_matches_sv(sv′, method, sig, sparams, hardlimit, sv, InferenceParams(interp).ignore_recursion_hardlimit)
if edge_matches_sv(sv′, method, sig, sparams, hardlimit, sv,
InferenceParams(interp).ignore_recursion_hardlimit)
topmost = sv′
edgecycle = true
end
Expand Down Expand Up @@ -608,10 +610,12 @@ function abstract_call_method(interp::AbstractInterpreter, method::Method, @nosp
return MethodCallResult(Any, true, true, nothing, Effects())
end
add_remark!(interp, sv, washardlimit ? RECURSION_MSG_HARDLIMIT : RECURSION_MSG)
topmost = topmost::InferenceState
parentframe = topmost.parent
if isa(sv, InferenceState) && isa(parentframe, InferenceState)
poison_callstack!(sv, parentframe === nothing ? topmost : parentframe)
# XXX this is very dangerous
if isa(topmost, InferenceState)
parentframe = frame_parent(topmost)
if isa(sv, InferenceState) && isa(parentframe, InferenceState)
poison_callstack!(sv, parentframe === nothing ? topmost : parentframe)
end
end
sig = newsig
sparams = svec()
Expand Down
7 changes: 6 additions & 1 deletion base/compiler/typeinfer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,12 @@ function merge_call_chain!(interp::AbstractInterpreter, parent::InferenceState,
merge_effects!(interp, child, Effects(EFFECTS_TOTAL; terminates=false))
child = parent
child === ancestor && break
parent = child.parent::InferenceState
parent = child.parent
# XXX we should implement a proper recursion detection for `IRInterpretationState`
while isa(parent, IRInterpretationState)
parent = parent.parent
end
parent = parent::InferenceState
end
end

Expand Down

0 comments on commit 798e107

Please sign in to comment.