1538 #if INCLUDE_ALL_GCS
1539 if (UseParallelGC) {
1540 heap_alignment = ParallelScavengeHeap::conservative_max_heap_alignment();
1541 } else if (UseG1GC) {
1542 heap_alignment = G1CollectedHeap::conservative_max_heap_alignment();
1543 }
1544 #endif // INCLUDE_ALL_GCS
1545 _conservative_max_heap_alignment = MAX4(heap_alignment,
1546 (size_t)os::vm_allocation_granularity(),
1547 os::max_page_size(),
1548 CollectorPolicy::compute_heap_alignment());
1549 }
1550
1551 void Arguments::select_gc_ergonomically() {
1552 if (os::is_server_class_machine()) {
1553 if (should_auto_select_low_pause_collector()) {
1554 FLAG_SET_ERGO(bool, UseConcMarkSweepGC, true);
1555 } else {
1556 FLAG_SET_ERGO(bool, UseParallelGC, true);
1557 }
1558 }
1559 }
1560
1561 void Arguments::select_gc() {
1562 if (!gc_selected()) {
1563 select_gc_ergonomically();
1564 }
1565 }
1566
1567 void Arguments::set_ergonomics_flags() {
1568 select_gc();
1569
1570 #ifdef COMPILER2
1571 // Shared spaces work fine with other GCs but causes bytecode rewriting
1572 // to be disabled, which hurts interpreter performance and decreases
1573 // server performance. When -server is specified, keep the default off
1574 // unless it is asked for. Future work: either add bytecode rewriting
1575 // at link time, or rewrite bytecodes in non-shared methods.
1576 if (!DumpSharedSpaces && !RequireSharedSpaces &&
1577 (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) {
1578 no_shared_spaces("COMPILER2 default: -Xshare:auto | off, have to manually setup to on.");
1579 }
1580 #endif
1581
1582 set_conservative_max_heap_alignment();
1583
2069 uint i = 0;
2070 if (UseSerialGC) i++;
2071 if (UseConcMarkSweepGC) i++;
2072 if (UseParallelGC || UseParallelOldGC) i++;
2073 if (UseG1GC) i++;
2074 if (i > 1) {
2075 jio_fprintf(defaultStream::error_stream(),
2076 "Conflicting collector combinations in option list; "
2077 "please refer to the release notes for the combinations "
2078 "allowed\n");
2079 return false;
2080 }
2081
2082 if (UseConcMarkSweepGC && !UseParNewGC) {
2083 jio_fprintf(defaultStream::error_stream(),
2084 "It is not possible to combine the DefNew young collector with the CMS collector.\n");
2085 return false;
2086 }
2087
2088 if (UseParNewGC && !UseConcMarkSweepGC) {
2089 // !UseConcMarkSweepGC means that we are using serial old gc. Unfortunately we don't
2090 // set up UseSerialGC properly, so that can't be used in the check here.
2091 jio_fprintf(defaultStream::error_stream(),
2092 "It is not possible to combine the ParNew young collector with the Serial old collector.\n");
2093 return false;
2094 }
2095
2096 return true;
2097 }
2098
2099 void Arguments::check_deprecated_gc_flags() {
2100 if (FLAG_IS_CMDLINE(UseParNewGC)) {
2101 warning("The UseParNewGC flag is deprecated and will likely be removed in a future release");
2102 }
2103 if (FLAG_IS_CMDLINE(MaxGCMinorPauseMillis)) {
2104 warning("Using MaxGCMinorPauseMillis as minor pause goal is deprecated"
2105 "and will likely be removed in future release");
2106 }
2107 if (FLAG_IS_CMDLINE(DefaultMaxRAMFraction)) {
2108 warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. "
2109 "Use MaxRAMFraction instead.");
2110 }
2111 }
2112
|
1538 #if INCLUDE_ALL_GCS
1539 if (UseParallelGC) {
1540 heap_alignment = ParallelScavengeHeap::conservative_max_heap_alignment();
1541 } else if (UseG1GC) {
1542 heap_alignment = G1CollectedHeap::conservative_max_heap_alignment();
1543 }
1544 #endif // INCLUDE_ALL_GCS
1545 _conservative_max_heap_alignment = MAX4(heap_alignment,
1546 (size_t)os::vm_allocation_granularity(),
1547 os::max_page_size(),
1548 CollectorPolicy::compute_heap_alignment());
1549 }
1550
1551 void Arguments::select_gc_ergonomically() {
1552 if (os::is_server_class_machine()) {
1553 if (should_auto_select_low_pause_collector()) {
1554 FLAG_SET_ERGO(bool, UseConcMarkSweepGC, true);
1555 } else {
1556 FLAG_SET_ERGO(bool, UseParallelGC, true);
1557 }
1558 } else {
1559 FLAG_SET_ERGO(bool, UseSerialGC, true);
1560 }
1561 }
1562
1563 void Arguments::select_gc() {
1564 if (!gc_selected()) {
1565 select_gc_ergonomically();
1566 guarantee(gc_selected(), "No GC selected");
1567 }
1568 }
1569
1570 void Arguments::set_ergonomics_flags() {
1571 select_gc();
1572
1573 #ifdef COMPILER2
1574 // Shared spaces work fine with other GCs but causes bytecode rewriting
1575 // to be disabled, which hurts interpreter performance and decreases
1576 // server performance. When -server is specified, keep the default off
1577 // unless it is asked for. Future work: either add bytecode rewriting
1578 // at link time, or rewrite bytecodes in non-shared methods.
1579 if (!DumpSharedSpaces && !RequireSharedSpaces &&
1580 (FLAG_IS_DEFAULT(UseSharedSpaces) || !UseSharedSpaces)) {
1581 no_shared_spaces("COMPILER2 default: -Xshare:auto | off, have to manually setup to on.");
1582 }
1583 #endif
1584
1585 set_conservative_max_heap_alignment();
1586
2072 uint i = 0;
2073 if (UseSerialGC) i++;
2074 if (UseConcMarkSweepGC) i++;
2075 if (UseParallelGC || UseParallelOldGC) i++;
2076 if (UseG1GC) i++;
2077 if (i > 1) {
2078 jio_fprintf(defaultStream::error_stream(),
2079 "Conflicting collector combinations in option list; "
2080 "please refer to the release notes for the combinations "
2081 "allowed\n");
2082 return false;
2083 }
2084
2085 if (UseConcMarkSweepGC && !UseParNewGC) {
2086 jio_fprintf(defaultStream::error_stream(),
2087 "It is not possible to combine the DefNew young collector with the CMS collector.\n");
2088 return false;
2089 }
2090
2091 if (UseParNewGC && !UseConcMarkSweepGC) {
2092 jio_fprintf(defaultStream::error_stream(),
2093 "It is not possible to combine the ParNew young collector with anything other than the CMS collector.\n");
2094 return false;
2095 }
2096
2097 return true;
2098 }
2099
2100 void Arguments::check_deprecated_gc_flags() {
2101 if (FLAG_IS_CMDLINE(UseParNewGC)) {
2102 warning("The UseParNewGC flag is deprecated and will likely be removed in a future release");
2103 }
2104 if (FLAG_IS_CMDLINE(MaxGCMinorPauseMillis)) {
2105 warning("Using MaxGCMinorPauseMillis as minor pause goal is deprecated"
2106 "and will likely be removed in future release");
2107 }
2108 if (FLAG_IS_CMDLINE(DefaultMaxRAMFraction)) {
2109 warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. "
2110 "Use MaxRAMFraction instead.");
2111 }
2112 }
2113
|