Skip to content

Commit

Permalink
inlining: remove bonus for Tuple return with heap references
Browse files Browse the repository at this point in the history
Added in #22210 (and earlier begun in #20853), this is no longer
necessary to avoid heap allocations, and thus serves little purpose now.
  • Loading branch information
vtjnash committed Jul 9, 2020
1 parent bee6546 commit fd6149e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion base/compiler/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ function optimize(opt::OptimizationState, params::OptimizationParams, @nospecial
# obey @inline declaration if a dispatch barrier would not help
else
bonus = 0
if result Tuple && !isbitstype(widenconst(result))
if result Tuple && !isconcretetype(widenconst(result))
bonus = params.inline_tupleret_bonus
end
if opt.src.inlineable
Expand Down
4 changes: 2 additions & 2 deletions base/compiler/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct OptimizationParams
inlining::Bool # whether inlining is enabled
inline_cost_threshold::Int # number of CPU cycles beyond which it's not worth inlining
inline_nonleaf_penalty::Int # penalty for dynamic dispatch
inline_tupleret_bonus::Int # extra willingness for non-isbits tuple return types
inline_tupleret_bonus::Int # extra inlining willingness for non-concrete tuple return types (in hopes of splitting it up)

# Duplicating for now because optimizer inlining requires it.
# Keno assures me this will be removed in the near future
Expand All @@ -56,7 +56,7 @@ struct OptimizationParams
inlining::Bool = inlining_enabled(),
inline_cost_threshold::Int = 100,
inline_nonleaf_penalty::Int = 1000,
inline_tupleret_bonus::Int = 400,
inline_tupleret_bonus::Int = 250,
max_methods::Int = 3,
tuple_splat::Int = 32,
union_splitting::Int = 4,
Expand Down

0 comments on commit fd6149e

Please sign in to comment.