Skip to content

Commit

Permalink
Merge pull request #48944 from JuliaLang/kf/hardlimitoption
Browse files Browse the repository at this point in the history
Add an inference option to ignore the recursion hardlimit
  • Loading branch information
staticfloat authored Mar 8, 2023
2 parents 8851fc8 + e08689c commit 9b8d778
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ function edge_matches_sv(frame::InferenceState, method::Method, @nospecialize(si
if callee_method2 !== inf_method2
return false
end
if !hardlimit
if !hardlimit || InferenceParams(sv.interp).ignore_recursion_hardlimit
# if this is a soft limit,
# also inspect the parent of this edge,
# to see if they are the same Method as sv
Expand Down
16 changes: 11 additions & 5 deletions base/compiler/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ struct InferenceParams
aggressive_constant_propagation::Bool
unoptimize_throw_blocks::Bool
assume_bindings_static::Bool
ignore_recursion_hardlimit::Bool

function InferenceParams(
max_methods::Int,
Expand All @@ -151,7 +152,8 @@ struct InferenceParams
ipo_constant_propagation::Bool,
aggressive_constant_propagation::Bool,
unoptimize_throw_blocks::Bool,
assume_bindings_static::Bool)
assume_bindings_static::Bool,
ignore_recursion_hardlimit::Bool)
return new(
max_methods,
max_union_splitting,
Expand All @@ -161,7 +163,8 @@ struct InferenceParams
ipo_constant_propagation,
aggressive_constant_propagation,
unoptimize_throw_blocks,
assume_bindings_static)
assume_bindings_static,
ignore_recursion_hardlimit)
end
end
function InferenceParams(
Expand All @@ -174,7 +177,8 @@ function InferenceParams(
#=ipo_constant_propagation::Bool=# true,
#=aggressive_constant_propagation::Bool=# false,
#=unoptimize_throw_blocks::Bool=# true,
#=assume_bindings_static::Bool=# false);
#=assume_bindings_static::Bool=# false,
#=ignore_recursion_hardlimit::Bool=# false);
max_methods::Int = params.max_methods,
max_union_splitting::Int = params.max_union_splitting,
max_apply_union_enum::Int = params.max_apply_union_enum,
Expand All @@ -183,7 +187,8 @@ function InferenceParams(
ipo_constant_propagation::Bool = params.ipo_constant_propagation,
aggressive_constant_propagation::Bool = params.aggressive_constant_propagation,
unoptimize_throw_blocks::Bool = params.unoptimize_throw_blocks,
assume_bindings_static::Bool = params.assume_bindings_static)
assume_bindings_static::Bool = params.assume_bindings_static,
ignore_recursion_hardlimit::Bool = params.ignore_recursion_hardlimit)
return InferenceParams(
max_methods,
max_union_splitting,
Expand All @@ -193,7 +198,8 @@ function InferenceParams(
ipo_constant_propagation,
aggressive_constant_propagation,
unoptimize_throw_blocks,
assume_bindings_static)
assume_bindings_static,
ignore_recursion_hardlimit)
end

"""
Expand Down

0 comments on commit 9b8d778

Please sign in to comment.