369 } 370 #endif // INCLUDE_ALL_GCS 371 372 Flag::Error ParGCStridesPerThreadConstraintFunc(uintx value, bool verbose) { 373 #if INCLUDE_ALL_GCS 374 if (UseConcMarkSweepGC && (value > ((uintx)max_jint / (uintx)ParallelGCThreads))) { 375 CommandLineError::print(verbose, 376 "ParGCStridesPerThread (" UINTX_FORMAT ") must be " 377 "less than or equal to ergonomic maximum (" UINTX_FORMAT ")\n", 378 value, ((uintx)max_jint / (uintx)ParallelGCThreads)); 379 return Flag::VIOLATES_CONSTRAINT; 380 } 381 #endif 382 return Flag::SUCCESS; 383 } 384 385 Flag::Error ParGCCardsPerStrideChunkConstraintFunc(intx value, bool verbose) { 386 #if INCLUDE_ALL_GCS 387 if (UseConcMarkSweepGC) { 388 // ParGCCardsPerStrideChunk shoule be compared with card table size. 389 // As CardTableModRefBS::_last_valid_index is 'protected', calculate it in a same way. 390 size_t heap_size = Universe::heap()->reserved_region().word_size(); 391 size_t card_table_size = align_size_up(heap_size, CardTableModRefBS::card_size_in_words); 392 card_table_size /= (CardTableModRefBS::card_size_in_words + 1); 393 card_table_size -= 1; 394 395 if ((size_t)value > card_table_size) { 396 CommandLineError::print(verbose, 397 "ParGCCardsPerStrideChunk (" INTX_FORMAT ") must be " 398 "less than or equal to card table size (" SIZE_FORMAT ")\n", 399 value, card_table_size); 400 return Flag::VIOLATES_CONSTRAINT; 401 } 402 403 // If n_strides which is used with ParGCCardsPerStrideChunk is really large, we would face an overflow. 404 uintx n_strides = ParallelGCThreads * ParGCStridesPerThread; 405 uintx ergo_max = max_uintx / n_strides; 406 if ((uintx)value > ergo_max) { 407 CommandLineError::print(verbose, 408 "ParGCCardsPerStrideChunk (" INTX_FORMAT ") must be " 409 "less than or equal to ergonomic maximum (" UINTX_FORMAT ")\n", 410 value, ergo_max); 411 return Flag::VIOLATES_CONSTRAINT; 412 } 413 } 414 #endif 415 return Flag::SUCCESS; 416 } 417 418 Flag::Error CMSOldPLABMinConstraintFunc(size_t value, bool verbose) { 419 Flag::Error status = Flag::SUCCESS; 420 421 #if INCLUDE_ALL_GCS 422 if (UseConcMarkSweepGC) { 423 if (value > CMSOldPLABMax) { | 369 } 370 #endif // INCLUDE_ALL_GCS 371 372 Flag::Error ParGCStridesPerThreadConstraintFunc(uintx value, bool verbose) { 373 #if INCLUDE_ALL_GCS 374 if (UseConcMarkSweepGC && (value > ((uintx)max_jint / (uintx)ParallelGCThreads))) { 375 CommandLineError::print(verbose, 376 "ParGCStridesPerThread (" UINTX_FORMAT ") must be " 377 "less than or equal to ergonomic maximum (" UINTX_FORMAT ")\n", 378 value, ((uintx)max_jint / (uintx)ParallelGCThreads)); 379 return Flag::VIOLATES_CONSTRAINT; 380 } 381 #endif 382 return Flag::SUCCESS; 383 } 384 385 Flag::Error ParGCCardsPerStrideChunkConstraintFunc(intx value, bool verbose) { 386 #if INCLUDE_ALL_GCS 387 if (UseConcMarkSweepGC) { 388 // ParGCCardsPerStrideChunk shoule be compared with card table size. 389 size_t heap_size = Universe::heap()->reserved_region().word_size(); 390 CardTableModRefBS* bs = (CardTableModRefBS*)GenCollectedHeap::heap()->rem_set()->bs(); 391 size_t card_table_size = bs->cards_required(heap_size) - 1; // Valid card table size 392 393 if ((size_t)value > card_table_size) { 394 CommandLineError::print(verbose, 395 "ParGCCardsPerStrideChunk (" INTX_FORMAT ") is too large for the heap size and " 396 "must be less than or equal to card table size (" SIZE_FORMAT ")\n", 397 value, card_table_size); 398 return Flag::VIOLATES_CONSTRAINT; 399 } 400 401 // ParGCCardsPerStrideChunk is used with n_strides(ParallelGCThreads*ParGCStridesPerThread) 402 // from CardTableModRefBSForCTRS::process_stride(). However, ParGCStridesPerThread is already checked 403 // not to make an overflow with ParallelGCThreads from its constraint function. 404 uintx n_strides = ParallelGCThreads * ParGCStridesPerThread; 405 uintx ergo_max = max_uintx / n_strides; 406 if ((uintx)value > ergo_max) { 407 CommandLineError::print(verbose, 408 "ParGCCardsPerStrideChunk (" INTX_FORMAT ") must be " 409 "less than or equal to ergonomic maximum (" UINTX_FORMAT ")\n", 410 value, ergo_max); 411 return Flag::VIOLATES_CONSTRAINT; 412 } 413 } 414 #endif 415 return Flag::SUCCESS; 416 } 417 418 Flag::Error CMSOldPLABMinConstraintFunc(size_t value, bool verbose) { 419 Flag::Error status = Flag::SUCCESS; 420 421 #if INCLUDE_ALL_GCS 422 if (UseConcMarkSweepGC) { 423 if (value > CMSOldPLABMax) { |