Skip to content

Commit

Permalink
8258553: Limit number of fields in instance to be considered for scal…
Browse files Browse the repository at this point in the history
…ar replacement

Reviewed-by: kvn, vlivanov
  • Loading branch information
Igor Veresov committed Dec 18, 2020
1 parent adf0e23 commit 7f92d18
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/hotspot/share/opto/c2_globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,10 @@
"Array size (number of elements) limit for scalar replacement") \
range(0, max_jint) \
\
product(intx, EliminateAllocationFieldsLimit, 512, DIAGNOSTIC, \
"Number of fields in instance limit for scalar replacement") \
range(0, max_jint) \
\
product(bool, OptimizePtrCompare, true, \
"Use escape analysis to optimize pointers compare") \
\
Expand Down
6 changes: 6 additions & 0 deletions src/hotspot/share/opto/escape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,12 @@ void ConnectionGraph::add_call_node(CallNode* call) {
!cik->as_instance_klass()->can_be_instantiated() ||
cik->as_instance_klass()->has_finalizer()) {
es = PointsToNode::GlobalEscape;
} else {
int nfields = cik->as_instance_klass()->nof_nonstatic_fields();
if (nfields > EliminateAllocationFieldsLimit) {
// Not scalar replaceable if there are too many fields.
scalar_replaceable = false;
}
}
}
add_java_object(call, es);
Expand Down

1 comment on commit 7f92d18

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.