525 } |
525 } |
526 |
526 |
527 size_t region_size; |
527 size_t region_size; |
528 if (FLAG_IS_DEFAULT(ShenandoahHeapRegionSize)) { |
528 if (FLAG_IS_DEFAULT(ShenandoahHeapRegionSize)) { |
529 if (ShenandoahMinRegionSize > max_heap_size / MIN_NUM_REGIONS) { |
529 if (ShenandoahMinRegionSize > max_heap_size / MIN_NUM_REGIONS) { |
530 err_msg message("Max heap size (" SIZE_FORMAT "K) is too low to afford the minimum number " |
530 err_msg message("Max heap size (" SIZE_FORMAT "%s) is too low to afford the minimum number " |
531 "of regions (" SIZE_FORMAT ") of minimum region size (" SIZE_FORMAT "K).", |
531 "of regions (" SIZE_FORMAT ") of minimum region size (" SIZE_FORMAT "%s).", |
532 max_heap_size/K, MIN_NUM_REGIONS, ShenandoahMinRegionSize/K); |
532 byte_size_in_proper_unit(max_heap_size), proper_unit_for_byte_size(max_heap_size), |
|
533 MIN_NUM_REGIONS, |
|
534 byte_size_in_proper_unit(ShenandoahMinRegionSize), proper_unit_for_byte_size(ShenandoahMinRegionSize)); |
533 vm_exit_during_initialization("Invalid -XX:ShenandoahMinRegionSize option", message); |
535 vm_exit_during_initialization("Invalid -XX:ShenandoahMinRegionSize option", message); |
534 } |
536 } |
535 if (ShenandoahMinRegionSize < MIN_REGION_SIZE) { |
537 if (ShenandoahMinRegionSize < MIN_REGION_SIZE) { |
536 err_msg message("" SIZE_FORMAT "K should not be lower than minimum region size (" SIZE_FORMAT "K).", |
538 err_msg message("" SIZE_FORMAT "%s should not be lower than minimum region size (" SIZE_FORMAT "%s).", |
537 ShenandoahMinRegionSize/K, MIN_REGION_SIZE/K); |
539 byte_size_in_proper_unit(ShenandoahMinRegionSize), proper_unit_for_byte_size(ShenandoahMinRegionSize), |
|
540 byte_size_in_proper_unit(MIN_REGION_SIZE), proper_unit_for_byte_size(MIN_REGION_SIZE)); |
538 vm_exit_during_initialization("Invalid -XX:ShenandoahMinRegionSize option", message); |
541 vm_exit_during_initialization("Invalid -XX:ShenandoahMinRegionSize option", message); |
539 } |
542 } |
540 if (ShenandoahMinRegionSize < MinTLABSize) { |
543 if (ShenandoahMinRegionSize < MinTLABSize) { |
541 err_msg message("" SIZE_FORMAT "K should not be lower than TLAB size size (" SIZE_FORMAT "K).", |
544 err_msg message("" SIZE_FORMAT "%s should not be lower than TLAB size size (" SIZE_FORMAT "%s).", |
542 ShenandoahMinRegionSize/K, MinTLABSize/K); |
545 byte_size_in_proper_unit(ShenandoahMinRegionSize), proper_unit_for_byte_size(ShenandoahMinRegionSize), |
|
546 byte_size_in_proper_unit(MinTLABSize), proper_unit_for_byte_size(MinTLABSize)); |
543 vm_exit_during_initialization("Invalid -XX:ShenandoahMinRegionSize option", message); |
547 vm_exit_during_initialization("Invalid -XX:ShenandoahMinRegionSize option", message); |
544 } |
548 } |
545 if (ShenandoahMaxRegionSize < MIN_REGION_SIZE) { |
549 if (ShenandoahMaxRegionSize < MIN_REGION_SIZE) { |
546 err_msg message("" SIZE_FORMAT "K should not be lower than min region size (" SIZE_FORMAT "K).", |
550 err_msg message("" SIZE_FORMAT "%s should not be lower than min region size (" SIZE_FORMAT "%s).", |
547 ShenandoahMaxRegionSize/K, MIN_REGION_SIZE/K); |
551 byte_size_in_proper_unit(ShenandoahMaxRegionSize), proper_unit_for_byte_size(ShenandoahMaxRegionSize), |
|
552 byte_size_in_proper_unit(MIN_REGION_SIZE), proper_unit_for_byte_size(MIN_REGION_SIZE)); |
548 vm_exit_during_initialization("Invalid -XX:ShenandoahMaxRegionSize option", message); |
553 vm_exit_during_initialization("Invalid -XX:ShenandoahMaxRegionSize option", message); |
549 } |
554 } |
550 if (ShenandoahMinRegionSize > ShenandoahMaxRegionSize) { |
555 if (ShenandoahMinRegionSize > ShenandoahMaxRegionSize) { |
551 err_msg message("Minimum (" SIZE_FORMAT "K) should be larger than maximum (" SIZE_FORMAT "K).", |
556 err_msg message("Minimum (" SIZE_FORMAT "%s) should be larger than maximum (" SIZE_FORMAT "%s).", |
552 ShenandoahMinRegionSize/K, ShenandoahMaxRegionSize/K); |
557 byte_size_in_proper_unit(ShenandoahMinRegionSize), proper_unit_for_byte_size(ShenandoahMinRegionSize), |
|
558 byte_size_in_proper_unit(ShenandoahMaxRegionSize), proper_unit_for_byte_size(ShenandoahMaxRegionSize)); |
553 vm_exit_during_initialization("Invalid -XX:ShenandoahMinRegionSize or -XX:ShenandoahMaxRegionSize", message); |
559 vm_exit_during_initialization("Invalid -XX:ShenandoahMinRegionSize or -XX:ShenandoahMaxRegionSize", message); |
554 } |
560 } |
555 |
561 |
556 // We rapidly expand to max_heap_size in most scenarios, so that is the measure |
562 // We rapidly expand to max_heap_size in most scenarios, so that is the measure |
557 // for usual heap sizes. Do not depend on initial_heap_size here. |
563 // for usual heap sizes. Do not depend on initial_heap_size here. |
561 region_size = MAX2(ShenandoahMinRegionSize, region_size); |
567 region_size = MAX2(ShenandoahMinRegionSize, region_size); |
562 region_size = MIN2(ShenandoahMaxRegionSize, region_size); |
568 region_size = MIN2(ShenandoahMaxRegionSize, region_size); |
563 |
569 |
564 } else { |
570 } else { |
565 if (ShenandoahHeapRegionSize > max_heap_size / MIN_NUM_REGIONS) { |
571 if (ShenandoahHeapRegionSize > max_heap_size / MIN_NUM_REGIONS) { |
566 err_msg message("Max heap size (" SIZE_FORMAT "K) is too low to afford the minimum number " |
572 err_msg message("Max heap size (" SIZE_FORMAT "%s) is too low to afford the minimum number " |
567 "of regions (" SIZE_FORMAT ") of requested size (" SIZE_FORMAT "K).", |
573 "of regions (" SIZE_FORMAT ") of requested size (" SIZE_FORMAT "%s).", |
568 max_heap_size/K, MIN_NUM_REGIONS, ShenandoahHeapRegionSize/K); |
574 byte_size_in_proper_unit(max_heap_size), proper_unit_for_byte_size(max_heap_size), |
|
575 MIN_NUM_REGIONS, |
|
576 byte_size_in_proper_unit(ShenandoahHeapRegionSize), proper_unit_for_byte_size(ShenandoahHeapRegionSize)); |
569 vm_exit_during_initialization("Invalid -XX:ShenandoahHeapRegionSize option", message); |
577 vm_exit_during_initialization("Invalid -XX:ShenandoahHeapRegionSize option", message); |
570 } |
578 } |
571 if (ShenandoahHeapRegionSize < ShenandoahMinRegionSize) { |
579 if (ShenandoahHeapRegionSize < ShenandoahMinRegionSize) { |
572 err_msg message("Heap region size (" SIZE_FORMAT "K) should be larger than min region size (" SIZE_FORMAT "K).", |
580 err_msg message("Heap region size (" SIZE_FORMAT "%s) should be larger than min region size (" SIZE_FORMAT "%s).", |
573 ShenandoahHeapRegionSize/K, ShenandoahMinRegionSize/K); |
581 byte_size_in_proper_unit(ShenandoahHeapRegionSize), proper_unit_for_byte_size(ShenandoahHeapRegionSize), |
|
582 byte_size_in_proper_unit(ShenandoahMinRegionSize), proper_unit_for_byte_size(ShenandoahMinRegionSize)); |
574 vm_exit_during_initialization("Invalid -XX:ShenandoahHeapRegionSize option", message); |
583 vm_exit_during_initialization("Invalid -XX:ShenandoahHeapRegionSize option", message); |
575 } |
584 } |
576 if (ShenandoahHeapRegionSize > ShenandoahMaxRegionSize) { |
585 if (ShenandoahHeapRegionSize > ShenandoahMaxRegionSize) { |
577 err_msg message("Heap region size (" SIZE_FORMAT "K) should be lower than max region size (" SIZE_FORMAT "K).", |
586 err_msg message("Heap region size (" SIZE_FORMAT "%s) should be lower than max region size (" SIZE_FORMAT "%s).", |
578 ShenandoahHeapRegionSize/K, ShenandoahMaxRegionSize/K); |
587 byte_size_in_proper_unit(ShenandoahHeapRegionSize), proper_unit_for_byte_size(ShenandoahHeapRegionSize), |
|
588 byte_size_in_proper_unit(ShenandoahMaxRegionSize), proper_unit_for_byte_size(ShenandoahMaxRegionSize)); |
579 vm_exit_during_initialization("Invalid -XX:ShenandoahHeapRegionSize option", message); |
589 vm_exit_during_initialization("Invalid -XX:ShenandoahHeapRegionSize option", message); |
580 } |
590 } |
581 region_size = ShenandoahHeapRegionSize; |
591 region_size = ShenandoahHeapRegionSize; |
582 } |
592 } |
583 |
593 |