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
190 err_msg("GCCardSizeInBytes ( %u ) must be >= %u\n", GCCardSizeInBytes, ShenandoahMinCardSizeInBytes));
191 }
192
193 // Gen shen does not support any ShenandoahGCHeuristics value except for the default "adaptive"
194 if ((strcmp(ShenandoahGCMode, "generational") == 0)
195 && strcmp(ShenandoahGCHeuristics, "adaptive") != 0) {
196 log_warning(gc)("Ignoring -XX:ShenandoahGCHeuristics input: %s, because generational shenandoah only"
197 " supports adaptive heuristics", ShenandoahGCHeuristics);
198 FLAG_SET_ERGO(ShenandoahGCHeuristics, "adaptive");
199 }
200
201 if (ShenandoahMomentaryAllocRateSampleWindow > ShenandoahRecentAllocRateSampleWindow
202 || ShenandoahRecentAllocRateSampleWindow > ShenandoahAllocRateSampleWindow) {
203 vm_exit_during_initialization(
204 err_msg("Relation must hold: ShenandoahMomentaryAllocRateSampleWindow (%u) "
205 "<= ShenandoahRecentAllocRateSampleWindow (%u) "
206 "<= ShenandoahAllocRateSampleWindow (%u)",
207 ShenandoahMomentaryAllocRateSampleWindow, ShenandoahRecentAllocRateSampleWindow,
208 ShenandoahAllocRateSampleWindow));
209 }
210
211 FullGCForwarding::initialize_flags(MaxHeapSize);
212 }
213
214 size_t ShenandoahArguments::conservative_max_heap_alignment() {
215 static_assert(is_power_of_2(ShenandoahHeapRegion::MAX_REGION_SIZE), "Max region size must be a power of 2.");
216 size_t align = ShenandoahHeapRegion::MAX_REGION_SIZE;
217 if (UseLargePages) {
218 align = MAX2(align, os::large_page_size());
219 }
220 return align;
221 }
222
223 void ShenandoahArguments::initialize_alignments() {
224 CardTable::initialize_card_size();
225
226 // Need to setup sizes early to get correct alignments.
227 MaxHeapSize = ShenandoahHeapRegion::setup_sizes(MaxHeapSize);
228
229 // This is expected by our algorithm for ShenandoahHeap::heap_region_containing().
230 size_t align = ShenandoahHeapRegion::region_size_bytes();
231 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
189 err_msg("GCCardSizeInBytes ( %u ) must be >= %u\n", GCCardSizeInBytes, ShenandoahMinCardSizeInBytes));
190 }
191
192 // Gen shen does not support any ShenandoahGCHeuristics value except for the default "adaptive"
193 if ((strcmp(ShenandoahGCMode, "generational") == 0)
194 && strcmp(ShenandoahGCHeuristics, "adaptive") != 0) {
195 log_warning(gc)("Ignoring -XX:ShenandoahGCHeuristics input: %s, because generational shenandoah only"
196 " supports adaptive heuristics", ShenandoahGCHeuristics);
197 FLAG_SET_ERGO(ShenandoahGCHeuristics, "adaptive");
198 }
199
200 if (ShenandoahMomentaryAllocRateSampleWindow > ShenandoahRecentAllocRateSampleWindow
201 || ShenandoahRecentAllocRateSampleWindow > ShenandoahAllocRateSampleWindow) {
202 vm_exit_during_initialization(
203 err_msg("Relation must hold: ShenandoahMomentaryAllocRateSampleWindow (%u) "
204 "<= ShenandoahRecentAllocRateSampleWindow (%u) "
205 "<= ShenandoahAllocRateSampleWindow (%u)",
206 ShenandoahMomentaryAllocRateSampleWindow, ShenandoahRecentAllocRateSampleWindow,
207 ShenandoahAllocRateSampleWindow));
208 }
209 }
210
211 size_t ShenandoahArguments::conservative_max_heap_alignment() {
212 static_assert(is_power_of_2(ShenandoahHeapRegion::MAX_REGION_SIZE), "Max region size must be a power of 2.");
213 size_t align = ShenandoahHeapRegion::MAX_REGION_SIZE;
214 if (UseLargePages) {
215 align = MAX2(align, os::large_page_size());
216 }
217 return align;
218 }
219
220 void ShenandoahArguments::initialize_alignments() {
221 CardTable::initialize_card_size();
222
223 // Need to setup sizes early to get correct alignments.
224 MaxHeapSize = ShenandoahHeapRegion::setup_sizes(MaxHeapSize);
225
226 // This is expected by our algorithm for ShenandoahHeap::heap_region_containing().
227 size_t align = ShenandoahHeapRegion::region_size_bytes();
228 if (UseLargePages) {
|