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
41 void ShenandoahArguments::initialize() {
42 #if !(defined AARCH64 || defined AMD64 || defined IA32 || defined PPC64 || defined RISCV64)
43 vm_exit_during_initialization("Shenandoah GC is not supported on this platform.");
44 #endif
45
46 #if 0 // leave this block as stepping stone for future platforms
47 log_warning(gc)("Shenandoah GC is not fully supported on this platform:");
175 }
176
177 // If class unloading is disabled, no unloading for concurrent cycles as well.
178 if (!ClassUnloading) {
179 FLAG_SET_DEFAULT(ClassUnloadingWithConcurrentMark, false);
180 }
181
182 // TLAB sizing policy makes resizing decisions before each GC cycle. It averages
183 // historical data, assigning more recent data the weight according to TLABAllocationWeight.
184 // Current default is good for generational collectors that run frequent young GCs.
185 // With Shenandoah, GC cycles are much less frequent, so we need we need sizing policy
186 // to converge faster over smaller number of resizing decisions.
187 if (FLAG_IS_DEFAULT(TLABAllocationWeight)) {
188 FLAG_SET_DEFAULT(TLABAllocationWeight, 90);
189 }
190
191 if (GCCardSizeInBytes < ShenandoahMinCardSizeInBytes) {
192 vm_exit_during_initialization(
193 err_msg("GCCardSizeInBytes ( %u ) must be >= %u\n", GCCardSizeInBytes, (unsigned int) ShenandoahMinCardSizeInBytes));
194 }
195
196 FullGCForwarding::initialize_flags(MaxHeapSize);
197 }
198
199 size_t ShenandoahArguments::conservative_max_heap_alignment() {
200 size_t align = ShenandoahMaxRegionSize;
201 if (UseLargePages) {
202 align = MAX2(align, os::large_page_size());
203 }
204 return align;
205 }
206
207 void ShenandoahArguments::initialize_alignments() {
208 CardTable::initialize_card_size();
209
210 // Need to setup sizes early to get correct alignments.
211 MaxHeapSize = ShenandoahHeapRegion::setup_sizes(MaxHeapSize);
212
213 // This is expected by our algorithm for ShenandoahHeap::heap_region_containing().
214 size_t align = ShenandoahHeapRegion::region_size_bytes();
215 if (UseLargePages) {
216 align = MAX2(align, os::large_page_size());
|
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
40 void ShenandoahArguments::initialize() {
41 #if !(defined AARCH64 || defined AMD64 || defined IA32 || defined PPC64 || defined RISCV64)
42 vm_exit_during_initialization("Shenandoah GC is not supported on this platform.");
43 #endif
44
45 #if 0 // leave this block as stepping stone for future platforms
46 log_warning(gc)("Shenandoah GC is not fully supported on this platform:");
174 }
175
176 // If class unloading is disabled, no unloading for concurrent cycles as well.
177 if (!ClassUnloading) {
178 FLAG_SET_DEFAULT(ClassUnloadingWithConcurrentMark, false);
179 }
180
181 // TLAB sizing policy makes resizing decisions before each GC cycle. It averages
182 // historical data, assigning more recent data the weight according to TLABAllocationWeight.
183 // Current default is good for generational collectors that run frequent young GCs.
184 // With Shenandoah, GC cycles are much less frequent, so we need we need sizing policy
185 // to converge faster over smaller number of resizing decisions.
186 if (FLAG_IS_DEFAULT(TLABAllocationWeight)) {
187 FLAG_SET_DEFAULT(TLABAllocationWeight, 90);
188 }
189
190 if (GCCardSizeInBytes < ShenandoahMinCardSizeInBytes) {
191 vm_exit_during_initialization(
192 err_msg("GCCardSizeInBytes ( %u ) must be >= %u\n", GCCardSizeInBytes, (unsigned int) ShenandoahMinCardSizeInBytes));
193 }
194 }
195
196 size_t ShenandoahArguments::conservative_max_heap_alignment() {
197 size_t align = ShenandoahMaxRegionSize;
198 if (UseLargePages) {
199 align = MAX2(align, os::large_page_size());
200 }
201 return align;
202 }
203
204 void ShenandoahArguments::initialize_alignments() {
205 CardTable::initialize_card_size();
206
207 // Need to setup sizes early to get correct alignments.
208 MaxHeapSize = ShenandoahHeapRegion::setup_sizes(MaxHeapSize);
209
210 // This is expected by our algorithm for ShenandoahHeap::heap_region_containing().
211 size_t align = ShenandoahHeapRegion::region_size_bytes();
212 if (UseLargePages) {
213 align = MAX2(align, os::large_page_size());
|