357 #endif // INCLUDE_ALL_GCS
358
359 Flag::Error ParGCStridesPerThreadConstraintFunc(uintx value, bool verbose) {
360 #if INCLUDE_ALL_GCS
361 if (UseConcMarkSweepGC && (value > ((uintx)max_jint / (uintx)ParallelGCThreads))) {
362 CommandLineError::print(verbose,
363 "ParGCStridesPerThread (" UINTX_FORMAT ") must be "
364 "less than or equal to ergonomic maximum (" UINTX_FORMAT ")\n",
365 value, ((uintx)max_jint / (uintx)ParallelGCThreads));
366 return Flag::VIOLATES_CONSTRAINT;
367 }
368 #endif
369 return Flag::SUCCESS;
370 }
371
372 Flag::Error ParGCCardsPerStrideChunkConstraintFunc(intx value, bool verbose) {
373 #if INCLUDE_ALL_GCS
374 if (UseConcMarkSweepGC) {
375 // ParGCCardsPerStrideChunk should be compared with card table size.
376 size_t heap_size = Universe::heap()->reserved_region().word_size();
377 CardTableModRefBS* bs = (CardTableModRefBS*)GenCollectedHeap::heap()->rem_set()->bs();
378 size_t card_table_size = bs->cards_required(heap_size) - 1; // Valid card table size
379
380 if ((size_t)value > card_table_size) {
381 CommandLineError::print(verbose,
382 "ParGCCardsPerStrideChunk (" INTX_FORMAT ") is too large for the heap size and "
383 "must be less than or equal to card table size (" SIZE_FORMAT ")\n",
384 value, card_table_size);
385 return Flag::VIOLATES_CONSTRAINT;
386 }
387
388 // ParGCCardsPerStrideChunk is used with n_strides(ParallelGCThreads*ParGCStridesPerThread)
389 // from CardTableModRefBSForCTRS::process_stride(). Note that ParGCStridesPerThread is already checked
390 // not to make an overflow with ParallelGCThreads from its constraint function.
391 uintx n_strides = ParallelGCThreads * ParGCStridesPerThread;
392 uintx ergo_max = max_uintx / n_strides;
393 if ((uintx)value > ergo_max) {
394 CommandLineError::print(verbose,
395 "ParGCCardsPerStrideChunk (" INTX_FORMAT ") must be "
396 "less than or equal to ergonomic maximum (" UINTX_FORMAT ")\n",
397 value, ergo_max);
398 return Flag::VIOLATES_CONSTRAINT;
399 }
400 }
401 #endif
402 return Flag::SUCCESS;
403 }
404
405 Flag::Error CMSOldPLABMinConstraintFunc(size_t value, bool verbose) {
406 Flag::Error status = Flag::SUCCESS;
407
408 #if INCLUDE_ALL_GCS
409 if (UseConcMarkSweepGC) {
451 if (value > ergo_max) {
452 CommandLineError::print(verbose,
453 "%s (" SIZE_FORMAT ") must be "
454 "less than or equal to ergonomic maximum (" SIZE_FORMAT ") "
455 "which is based on the maximum size of the old generation of the Java heap\n",
456 name, value, ergo_max);
457 return Flag::VIOLATES_CONSTRAINT;
458 }
459 }
460 #endif
461
462 return Flag::SUCCESS;
463 }
464
465 Flag::Error CMSRescanMultipleConstraintFunc(size_t value, bool verbose) {
466 Flag::Error status = CMSReservedAreaConstraintFunc("CMSRescanMultiple", value, verbose);
467
468 #if INCLUDE_ALL_GCS
469 if (status == Flag::SUCCESS && UseConcMarkSweepGC) {
470 // CMSParRemarkTask::do_dirty_card_rescan_tasks requires CompactibleFreeListSpace::rescan_task_size()
471 // to be aligned to CardTableModRefBS::card_size * BitsPerWord.
472 // Note that rescan_task_size() will be aligned if CMSRescanMultiple is a multiple of 'HeapWordSize'
473 // because rescan_task_size() is CardTableModRefBS::card_size / HeapWordSize * BitsPerWord.
474 if (value % HeapWordSize != 0) {
475 CommandLineError::print(verbose,
476 "CMSRescanMultiple (" SIZE_FORMAT ") must be "
477 "a multiple of " SIZE_FORMAT "\n",
478 value, HeapWordSize);
479 status = Flag::VIOLATES_CONSTRAINT;
480 }
481 }
482 #endif
483
484 return status;
485 }
486
487 Flag::Error CMSConcMarkMultipleConstraintFunc(size_t value, bool verbose) {
488 return CMSReservedAreaConstraintFunc("CMSConcMarkMultiple", value, verbose);
489 }
490
491 Flag::Error CMSPrecleanDenominatorConstraintFunc(uintx value, bool verbose) {
492 #if INCLUDE_ALL_GCS
493 if (UseConcMarkSweepGC && (value <= CMSPrecleanNumerator)) {
|
357 #endif // INCLUDE_ALL_GCS
358
359 Flag::Error ParGCStridesPerThreadConstraintFunc(uintx value, bool verbose) {
360 #if INCLUDE_ALL_GCS
361 if (UseConcMarkSweepGC && (value > ((uintx)max_jint / (uintx)ParallelGCThreads))) {
362 CommandLineError::print(verbose,
363 "ParGCStridesPerThread (" UINTX_FORMAT ") must be "
364 "less than or equal to ergonomic maximum (" UINTX_FORMAT ")\n",
365 value, ((uintx)max_jint / (uintx)ParallelGCThreads));
366 return Flag::VIOLATES_CONSTRAINT;
367 }
368 #endif
369 return Flag::SUCCESS;
370 }
371
372 Flag::Error ParGCCardsPerStrideChunkConstraintFunc(intx value, bool verbose) {
373 #if INCLUDE_ALL_GCS
374 if (UseConcMarkSweepGC) {
375 // ParGCCardsPerStrideChunk should be compared with card table size.
376 size_t heap_size = Universe::heap()->reserved_region().word_size();
377 CardTableRS* ct = GenCollectedHeap::heap()->rem_set();
378 size_t card_table_size = ct->cards_required(heap_size) - 1; // Valid card table size
379
380 if ((size_t)value > card_table_size) {
381 CommandLineError::print(verbose,
382 "ParGCCardsPerStrideChunk (" INTX_FORMAT ") is too large for the heap size and "
383 "must be less than or equal to card table size (" SIZE_FORMAT ")\n",
384 value, card_table_size);
385 return Flag::VIOLATES_CONSTRAINT;
386 }
387
388 // ParGCCardsPerStrideChunk is used with n_strides(ParallelGCThreads*ParGCStridesPerThread)
389 // from CardTableRS::process_stride(). Note that ParGCStridesPerThread is already checked
390 // not to make an overflow with ParallelGCThreads from its constraint function.
391 uintx n_strides = ParallelGCThreads * ParGCStridesPerThread;
392 uintx ergo_max = max_uintx / n_strides;
393 if ((uintx)value > ergo_max) {
394 CommandLineError::print(verbose,
395 "ParGCCardsPerStrideChunk (" INTX_FORMAT ") must be "
396 "less than or equal to ergonomic maximum (" UINTX_FORMAT ")\n",
397 value, ergo_max);
398 return Flag::VIOLATES_CONSTRAINT;
399 }
400 }
401 #endif
402 return Flag::SUCCESS;
403 }
404
405 Flag::Error CMSOldPLABMinConstraintFunc(size_t value, bool verbose) {
406 Flag::Error status = Flag::SUCCESS;
407
408 #if INCLUDE_ALL_GCS
409 if (UseConcMarkSweepGC) {
451 if (value > ergo_max) {
452 CommandLineError::print(verbose,
453 "%s (" SIZE_FORMAT ") must be "
454 "less than or equal to ergonomic maximum (" SIZE_FORMAT ") "
455 "which is based on the maximum size of the old generation of the Java heap\n",
456 name, value, ergo_max);
457 return Flag::VIOLATES_CONSTRAINT;
458 }
459 }
460 #endif
461
462 return Flag::SUCCESS;
463 }
464
465 Flag::Error CMSRescanMultipleConstraintFunc(size_t value, bool verbose) {
466 Flag::Error status = CMSReservedAreaConstraintFunc("CMSRescanMultiple", value, verbose);
467
468 #if INCLUDE_ALL_GCS
469 if (status == Flag::SUCCESS && UseConcMarkSweepGC) {
470 // CMSParRemarkTask::do_dirty_card_rescan_tasks requires CompactibleFreeListSpace::rescan_task_size()
471 // to be aligned to CardTable::card_size * BitsPerWord.
472 // Note that rescan_task_size() will be aligned if CMSRescanMultiple is a multiple of 'HeapWordSize'
473 // because rescan_task_size() is CardTable::card_size / HeapWordSize * BitsPerWord.
474 if (value % HeapWordSize != 0) {
475 CommandLineError::print(verbose,
476 "CMSRescanMultiple (" SIZE_FORMAT ") must be "
477 "a multiple of " SIZE_FORMAT "\n",
478 value, HeapWordSize);
479 status = Flag::VIOLATES_CONSTRAINT;
480 }
481 }
482 #endif
483
484 return status;
485 }
486
487 Flag::Error CMSConcMarkMultipleConstraintFunc(size_t value, bool verbose) {
488 return CMSReservedAreaConstraintFunc("CMSConcMarkMultiple", value, verbose);
489 }
490
491 Flag::Error CMSPrecleanDenominatorConstraintFunc(uintx value, bool verbose) {
492 #if INCLUDE_ALL_GCS
493 if (UseConcMarkSweepGC && (value <= CMSPrecleanNumerator)) {
|