8146478: Node limit exceeded with -XX:AllocateInstancePrefetchLines=1073741823

Constrain the set of accepted values for the Allocate{PrefetchLines, InstancePrefetchLines, PrefetchStepSize, PrefetchDistance} flags. Increase macro node expansion budget.

Reviewed-by: kvn
This commit is contained in:
Zoltan Majo 2016-01-28 08:33:45 +01:00
parent 272ee0ade8
commit 477c40e4eb
5 changed files with 39 additions and 32 deletions

View file

@ -45,13 +45,6 @@ void VM_Version::initialize() {
if( cache_line_size > AllocatePrefetchStepSize ) if( cache_line_size > AllocatePrefetchStepSize )
AllocatePrefetchStepSize = cache_line_size; AllocatePrefetchStepSize = cache_line_size;
assert(AllocatePrefetchLines > 0, "invalid value");
if( AllocatePrefetchLines < 1 ) // set valid value in product VM
AllocatePrefetchLines = 3;
assert(AllocateInstancePrefetchLines > 0, "invalid value");
if( AllocateInstancePrefetchLines < 1 ) // set valid value in product VM
AllocateInstancePrefetchLines = 1;
AllocatePrefetchDistance = allocate_prefetch_distance(); AllocatePrefetchDistance = allocate_prefetch_distance();
AllocatePrefetchStyle = allocate_prefetch_style(); AllocatePrefetchStyle = allocate_prefetch_style();

View file

@ -1163,13 +1163,6 @@ void VM_Version::get_processor_features() {
if( cache_line_size > AllocatePrefetchStepSize ) if( cache_line_size > AllocatePrefetchStepSize )
AllocatePrefetchStepSize = cache_line_size; AllocatePrefetchStepSize = cache_line_size;
assert(AllocatePrefetchLines > 0, "invalid value");
if( AllocatePrefetchLines < 1 ) // set valid value in product VM
AllocatePrefetchLines = 3;
assert(AllocateInstancePrefetchLines > 0, "invalid value");
if( AllocateInstancePrefetchLines < 1 ) // set valid value in product VM
AllocateInstancePrefetchLines = 1;
AllocatePrefetchDistance = allocate_prefetch_distance(); AllocatePrefetchDistance = allocate_prefetch_distance();
AllocatePrefetchStyle = allocate_prefetch_style(); AllocatePrefetchStyle = allocate_prefetch_style();
@ -1183,7 +1176,9 @@ void VM_Version::get_processor_features() {
} }
if (supports_sse4_2() && supports_ht()) { // Nehalem based cpus if (supports_sse4_2() && supports_ht()) { // Nehalem based cpus
AllocatePrefetchDistance = 192; AllocatePrefetchDistance = 192;
AllocatePrefetchLines = 4; if (FLAG_IS_DEFAULT(AllocatePrefetchLines)) {
FLAG_SET_DEFAULT(AllocatePrefetchLines, 4);
}
} }
#ifdef COMPILER2 #ifdef COMPILER2
if (supports_sse4_2()) { if (supports_sse4_2()) {

View file

@ -2654,9 +2654,9 @@ bool PhaseMacroExpand::expand_macro_nodes() {
eliminate_macro_nodes(); eliminate_macro_nodes();
// Make sure expansion will not cause node limit to be exceeded. // Make sure expansion will not cause node limit to be exceeded.
// Worst case is a macro node gets expanded into about 50 nodes. // Worst case is a macro node gets expanded into about 200 nodes.
// Allow 50% more for optimization. // Allow 50% more for optimization.
if (C->check_node_count(C->macro_count() * 75, "out of nodes before macro expansion" ) ) if (C->check_node_count(C->macro_count() * 300, "out of nodes before macro expansion" ) )
return true; return true;
// Eliminate Opaque and LoopLimit nodes. Do it after all loop optimizations. // Eliminate Opaque and LoopLimit nodes. Do it after all loop optimizations.

View file

@ -118,27 +118,46 @@ Flag::Error AllocatePrefetchInstrConstraintFunc(intx value, bool verbose) {
} }
Flag::Error AllocatePrefetchStepSizeConstraintFunc(intx value, bool verbose) { Flag::Error AllocatePrefetchStepSizeConstraintFunc(intx value, bool verbose) {
if (value < 1 || value > max_jint) { intx max_value = 512;
if (value < 1 || value > max_value) {
CommandLineError::print(verbose, CommandLineError::print(verbose,
"AllocatePrefetchStepSize (" INTX_FORMAT ") " "AllocatePrefetchStepSize (" INTX_FORMAT ") "
"must be between 1 and %d\n", "must be between 1 and %d\n",
AllocatePrefetchStepSize, AllocatePrefetchStepSize,
max_jint); max_value);
return Flag::VIOLATES_CONSTRAINT; return Flag::VIOLATES_CONSTRAINT;
} }
if (AllocatePrefetchDistance % AllocatePrefetchStepSize != 0) { if (AllocatePrefetchDistance % AllocatePrefetchStepSize != 0) {
CommandLineError::print(verbose, CommandLineError::print(verbose,
"AllocatePrefetchDistance (" INTX_FORMAT ") " "AllocatePrefetchDistance (" INTX_FORMAT ") "
"%% AllocatePrefetchStepSize (" INTX_FORMAT ") " "%% AllocatePrefetchStepSize (" INTX_FORMAT ") "
"= " INTX_FORMAT " " "= " INTX_FORMAT " "
"must be 0\n", "must be 0\n",
AllocatePrefetchDistance, AllocatePrefetchStepSize, AllocatePrefetchDistance, AllocatePrefetchStepSize,
AllocatePrefetchDistance % AllocatePrefetchStepSize); AllocatePrefetchDistance % AllocatePrefetchStepSize);
return Flag::VIOLATES_CONSTRAINT; return Flag::VIOLATES_CONSTRAINT;
} }
return Flag::SUCCESS; /* The limit of 64 for the quotient of AllocatePrefetchDistance and AllocatePrefetchSize
* originates from the limit of 64 for AllocatePrefetchLines/AllocateInstancePrefetchLines.
* If AllocatePrefetchStyle == 2, the quotient from above is used in PhaseMacroExpand::prefetch_allocation()
* to determine the number of lines to prefetch. For other values of AllocatePrefetchStyle,
* AllocatePrefetchDistance and AllocatePrefetchSize is used. For consistency, all these
* quantities must have the same limit (64 in this case).
*/
if (AllocatePrefetchDistance / AllocatePrefetchStepSize > 64) {
CommandLineError::print(verbose,
"AllocatePrefetchDistance (" INTX_FORMAT ") too large or "
"AllocatePrefetchStepSize (" INTX_FORMAT ") too small; "
"try decreasing/increasing values so that "
"AllocatePrefetchDistance / AllocatePrefetchStepSize <= 64\n",
AllocatePrefetchDistance, AllocatePrefetchStepSize,
AllocatePrefetchDistance % AllocatePrefetchStepSize);
return Flag::VIOLATES_CONSTRAINT;
}
return Flag::SUCCESS;
} }
Flag::Error CompileThresholdConstraintFunc(intx value, bool verbose) { Flag::Error CompileThresholdConstraintFunc(intx value, bool verbose) {

View file

@ -2964,16 +2964,16 @@ public:
\ \
product(intx, AllocatePrefetchLines, 3, \ product(intx, AllocatePrefetchLines, 3, \
"Number of lines to prefetch ahead of array allocation pointer") \ "Number of lines to prefetch ahead of array allocation pointer") \
range(1, max_jint / 2) \ range(1, 64) \
\ \
product(intx, AllocateInstancePrefetchLines, 1, \ product(intx, AllocateInstancePrefetchLines, 1, \
"Number of lines to prefetch ahead of instance allocation " \ "Number of lines to prefetch ahead of instance allocation " \
"pointer") \ "pointer") \
range(1, max_jint / 2) \ range(1, 64) \
\ \
product(intx, AllocatePrefetchStepSize, 16, \ product(intx, AllocatePrefetchStepSize, 16, \
"Step size in bytes of sequential prefetch instructions") \ "Step size in bytes of sequential prefetch instructions") \
range(1, max_jint) \ range(1, 512) \
constraint(AllocatePrefetchStepSizeConstraintFunc,AfterMemoryInit)\ constraint(AllocatePrefetchStepSizeConstraintFunc,AfterMemoryInit)\
\ \
product(intx, AllocatePrefetchInstr, 0, \ product(intx, AllocatePrefetchInstr, 0, \