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 authored and c42f committed Sep 23, 2020
1 parent 9b39974 commit 2ca0cc9
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 @@ -258,7 +258,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)
inline_error_path_cost::Int # cost of (un-optimized) calls in blocks that throw

# Duplicating for now because optimizer inlining requires it.
Expand All @@ -59,7 +59,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,
inline_error_path_cost::Int = 20,
max_methods::Int = 3,
tuple_splat::Int = 32,
Expand Down

0 comments on commit 2ca0cc9

Please sign in to comment.