7 * This code is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 only, as
9 * published by the Free Software Foundation.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 *
25 */
26
27 #include "gc/shared/fullGCForwarding.hpp"
28 #include "gc/shared/gcArguments.hpp"
29 #include "gc/shared/tlab_globals.hpp"
30 #include "gc/shared/workerPolicy.hpp"
31 #include "gc/shenandoah/shenandoahArguments.hpp"
32 #include "gc/shenandoah/shenandoahCardTable.hpp"
33 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
34 #include "gc/shenandoah/shenandoahGenerationalHeap.hpp"
35 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
36 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
37 #include "runtime/globals_extension.hpp"
38 #include "runtime/java.hpp"
39 #include "utilities/defaultStream.hpp"
40 #include "utilities/powerOfTwo.hpp"
41
42 void ShenandoahArguments::initialize() {
43 #if !(defined AARCH64 || defined AMD64 || defined PPC64 || defined RISCV64)
44 vm_exit_during_initialization("Shenandoah GC is not supported on this platform.");
45 #endif
46
47 // Shenandoah relies on the object header bits (including the self-forwarded bit
195 // Current default is good for generational collectors that run frequent young GCs.
196 // With Shenandoah, GC cycles are much less frequent, so we need we need sizing policy
197 // to converge faster over smaller number of resizing decisions.
198 if (strcmp(ShenandoahGCMode, "generational") && FLAG_IS_DEFAULT(TLABAllocationWeight)) {
199 FLAG_SET_DEFAULT(TLABAllocationWeight, 90);
200 }
201 // In generational mode, let TLABAllocationWeight keeps its default value of 35.
202
203 if (GCCardSizeInBytes < ShenandoahMinCardSizeInBytes) {
204 vm_exit_during_initialization(
205 err_msg("GCCardSizeInBytes ( %u ) must be >= %u\n", GCCardSizeInBytes, (unsigned int) ShenandoahMinCardSizeInBytes));
206 }
207
208 // Gen shen does not support any ShenandoahGCHeuristics value except for the default "adaptive"
209 if ((strcmp(ShenandoahGCMode, "generational") == 0)
210 && strcmp(ShenandoahGCHeuristics, "adaptive") != 0) {
211 log_warning(gc)("Ignoring -XX:ShenandoahGCHeuristics input: %s, because generational shenandoah only"
212 " supports adaptive heuristics", ShenandoahGCHeuristics);
213 FLAG_SET_ERGO(ShenandoahGCHeuristics, "adaptive");
214 }
215
216 FullGCForwarding::initialize_flags(MaxHeapSize);
217 }
218
219 size_t ShenandoahArguments::conservative_max_heap_alignment() {
220 static_assert(is_power_of_2(ShenandoahHeapRegion::MAX_REGION_SIZE), "Max region size must be a power of 2.");
221 size_t align = ShenandoahHeapRegion::MAX_REGION_SIZE;
222 if (UseLargePages) {
223 align = MAX2(align, os::large_page_size());
224 }
225 return align;
226 }
227
228 void ShenandoahArguments::initialize_alignments() {
229 CardTable::initialize_card_size();
230
231 // Need to setup sizes early to get correct alignments.
232 MaxHeapSize = ShenandoahHeapRegion::setup_sizes(MaxHeapSize);
233
234 // This is expected by our algorithm for ShenandoahHeap::heap_region_containing().
235 size_t align = ShenandoahHeapRegion::region_size_bytes();
236 if (UseLargePages) {
|
7 * This code is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 only, as
9 * published by the Free Software Foundation.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 *
25 */
26
27 #include "gc/shared/gcArguments.hpp"
28 #include "gc/shared/tlab_globals.hpp"
29 #include "gc/shared/workerPolicy.hpp"
30 #include "gc/shenandoah/shenandoahArguments.hpp"
31 #include "gc/shenandoah/shenandoahCardTable.hpp"
32 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
33 #include "gc/shenandoah/shenandoahGenerationalHeap.hpp"
34 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
35 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
36 #include "runtime/globals_extension.hpp"
37 #include "runtime/java.hpp"
38 #include "utilities/defaultStream.hpp"
39 #include "utilities/powerOfTwo.hpp"
40
41 void ShenandoahArguments::initialize() {
42 #if !(defined AARCH64 || defined AMD64 || defined PPC64 || defined RISCV64)
43 vm_exit_during_initialization("Shenandoah GC is not supported on this platform.");
44 #endif
45
46 // Shenandoah relies on the object header bits (including the self-forwarded bit
194 // Current default is good for generational collectors that run frequent young GCs.
195 // With Shenandoah, GC cycles are much less frequent, so we need we need sizing policy
196 // to converge faster over smaller number of resizing decisions.
197 if (strcmp(ShenandoahGCMode, "generational") && FLAG_IS_DEFAULT(TLABAllocationWeight)) {
198 FLAG_SET_DEFAULT(TLABAllocationWeight, 90);
199 }
200 // In generational mode, let TLABAllocationWeight keeps its default value of 35.
201
202 if (GCCardSizeInBytes < ShenandoahMinCardSizeInBytes) {
203 vm_exit_during_initialization(
204 err_msg("GCCardSizeInBytes ( %u ) must be >= %u\n", GCCardSizeInBytes, (unsigned int) ShenandoahMinCardSizeInBytes));
205 }
206
207 // Gen shen does not support any ShenandoahGCHeuristics value except for the default "adaptive"
208 if ((strcmp(ShenandoahGCMode, "generational") == 0)
209 && strcmp(ShenandoahGCHeuristics, "adaptive") != 0) {
210 log_warning(gc)("Ignoring -XX:ShenandoahGCHeuristics input: %s, because generational shenandoah only"
211 " supports adaptive heuristics", ShenandoahGCHeuristics);
212 FLAG_SET_ERGO(ShenandoahGCHeuristics, "adaptive");
213 }
214 }
215
216 size_t ShenandoahArguments::conservative_max_heap_alignment() {
217 static_assert(is_power_of_2(ShenandoahHeapRegion::MAX_REGION_SIZE), "Max region size must be a power of 2.");
218 size_t align = ShenandoahHeapRegion::MAX_REGION_SIZE;
219 if (UseLargePages) {
220 align = MAX2(align, os::large_page_size());
221 }
222 return align;
223 }
224
225 void ShenandoahArguments::initialize_alignments() {
226 CardTable::initialize_card_size();
227
228 // Need to setup sizes early to get correct alignments.
229 MaxHeapSize = ShenandoahHeapRegion::setup_sizes(MaxHeapSize);
230
231 // This is expected by our algorithm for ShenandoahHeap::heap_region_containing().
232 size_t align = ShenandoahHeapRegion::region_size_bytes();
233 if (UseLargePages) {
|