src/share/vm/runtime/arguments.cpp

Print this page
rev 6667 : 8048088: Conservative maximum heap alignment should take vm_allocation_granularity into account
Summary: The conservative max heap alignment does not take the alignment requirement imposed by the OS into account when calculating it. This may cause some assertions to fail, although it does not do at the moment because that alignment is always smaller than other alignments for the heap.
Reviewed-by:


1534       }
1535     }
1536   }
1537 #endif // _LP64
1538 #endif // !ZERO
1539 }
1540 
1541 void Arguments::set_conservative_max_heap_alignment() {
1542   // The conservative maximum required alignment for the heap is the maximum of
1543   // the alignments imposed by several sources: any requirements from the heap
1544   // itself, the collector policy and the maximum page size we may run the VM
1545   // with.
1546   size_t heap_alignment = GenCollectedHeap::conservative_max_heap_alignment();
1547 #if INCLUDE_ALL_GCS
1548   if (UseParallelGC) {
1549     heap_alignment = ParallelScavengeHeap::conservative_max_heap_alignment();
1550   } else if (UseG1GC) {
1551     heap_alignment = G1CollectedHeap::conservative_max_heap_alignment();
1552   }
1553 #endif // INCLUDE_ALL_GCS
1554   _conservative_max_heap_alignment = MAX3(heap_alignment, os::max_page_size(),


1555     CollectorPolicy::compute_heap_alignment());
1556 }
1557 
1558 void Arguments::set_ergonomics_flags() {
1559 
1560   if (os::is_server_class_machine()) {
1561     // If no other collector is requested explicitly,
1562     // let the VM select the collector based on
1563     // machine class and automatic selection policy.
1564     if (!UseSerialGC &&
1565         !UseConcMarkSweepGC &&
1566         !UseG1GC &&
1567         !UseParNewGC &&
1568         FLAG_IS_DEFAULT(UseParallelGC)) {
1569       if (should_auto_select_low_pause_collector()) {
1570         FLAG_SET_ERGO(bool, UseConcMarkSweepGC, true);
1571       } else {
1572         FLAG_SET_ERGO(bool, UseParallelGC, true);
1573       }
1574     }




1534       }
1535     }
1536   }
1537 #endif // _LP64
1538 #endif // !ZERO
1539 }
1540 
1541 void Arguments::set_conservative_max_heap_alignment() {
1542   // The conservative maximum required alignment for the heap is the maximum of
1543   // the alignments imposed by several sources: any requirements from the heap
1544   // itself, the collector policy and the maximum page size we may run the VM
1545   // with.
1546   size_t heap_alignment = GenCollectedHeap::conservative_max_heap_alignment();
1547 #if INCLUDE_ALL_GCS
1548   if (UseParallelGC) {
1549     heap_alignment = ParallelScavengeHeap::conservative_max_heap_alignment();
1550   } else if (UseG1GC) {
1551     heap_alignment = G1CollectedHeap::conservative_max_heap_alignment();
1552   }
1553 #endif // INCLUDE_ALL_GCS
1554   _conservative_max_heap_alignment = MAX4(heap_alignment,
1555                                           (size_t)os::vm_allocation_granularity(),
1556                                           os::max_page_size(),
1557                                           CollectorPolicy::compute_heap_alignment());
1558 }
1559 
1560 void Arguments::set_ergonomics_flags() {
1561 
1562   if (os::is_server_class_machine()) {
1563     // If no other collector is requested explicitly,
1564     // let the VM select the collector based on
1565     // machine class and automatic selection policy.
1566     if (!UseSerialGC &&
1567         !UseConcMarkSweepGC &&
1568         !UseG1GC &&
1569         !UseParNewGC &&
1570         FLAG_IS_DEFAULT(UseParallelGC)) {
1571       if (should_auto_select_low_pause_collector()) {
1572         FLAG_SET_ERGO(bool, UseConcMarkSweepGC, true);
1573       } else {
1574         FLAG_SET_ERGO(bool, UseParallelGC, true);
1575       }
1576     }