7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
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/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:");
47 log_warning(gc)(" concurrent modes are not supported, only STW cycles are enabled;");
169 }
170
171 if ((InitialHeapSize == MaxHeapSize) && ShenandoahUncommit) {
172 log_info(gc)("Min heap equals to max heap, disabling ShenandoahUncommit");
173 FLAG_SET_DEFAULT(ShenandoahUncommit, false);
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 FullGCForwarding::initialize_flags(MaxHeapSize);
191 }
192
193 size_t ShenandoahArguments::conservative_max_heap_alignment() {
194 size_t align = ShenandoahMaxRegionSize;
195 if (UseLargePages) {
196 align = MAX2(align, os::large_page_size());
197 }
198 return align;
199 }
200
201 void ShenandoahArguments::initialize_alignments() {
202 CardTable::initialize_card_size();
203
204 // Need to setup sizes early to get correct alignments.
205 MaxHeapSize = ShenandoahHeapRegion::setup_sizes(MaxHeapSize);
206
207 // This is expected by our algorithm for ShenandoahHeap::heap_region_containing().
208 size_t align = ShenandoahHeapRegion::region_size_bytes();
209 if (UseLargePages) {
210 align = MAX2(align, os::large_page_size());
|
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
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/shenandoahCollectorPolicy.hpp"
32 #include "gc/shenandoah/shenandoahGenerationalHeap.hpp"
33 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
34 #include "gc/shenandoah/shenandoahHeapRegion.hpp"
35 #include "runtime/globals_extension.hpp"
36 #include "runtime/java.hpp"
37 #include "utilities/defaultStream.hpp"
38
39 void ShenandoahArguments::initialize() {
40 #if !(defined AARCH64 || defined AMD64 || defined IA32 || defined PPC64 || defined RISCV64)
41 vm_exit_during_initialization("Shenandoah GC is not supported on this platform.");
42 #endif
43
44 #if 0 // leave this block as stepping stone for future platforms
45 log_warning(gc)("Shenandoah GC is not fully supported on this platform:");
46 log_warning(gc)(" concurrent modes are not supported, only STW cycles are enabled;");
168 }
169
170 if ((InitialHeapSize == MaxHeapSize) && ShenandoahUncommit) {
171 log_info(gc)("Min heap equals to max heap, disabling ShenandoahUncommit");
172 FLAG_SET_DEFAULT(ShenandoahUncommit, false);
173 }
174
175 // If class unloading is disabled, no unloading for concurrent cycles as well.
176 if (!ClassUnloading) {
177 FLAG_SET_DEFAULT(ClassUnloadingWithConcurrentMark, false);
178 }
179
180 // TLAB sizing policy makes resizing decisions before each GC cycle. It averages
181 // historical data, assigning more recent data the weight according to TLABAllocationWeight.
182 // Current default is good for generational collectors that run frequent young GCs.
183 // With Shenandoah, GC cycles are much less frequent, so we need we need sizing policy
184 // to converge faster over smaller number of resizing decisions.
185 if (FLAG_IS_DEFAULT(TLABAllocationWeight)) {
186 FLAG_SET_DEFAULT(TLABAllocationWeight, 90);
187 }
188 }
189
190 size_t ShenandoahArguments::conservative_max_heap_alignment() {
191 size_t align = ShenandoahMaxRegionSize;
192 if (UseLargePages) {
193 align = MAX2(align, os::large_page_size());
194 }
195 return align;
196 }
197
198 void ShenandoahArguments::initialize_alignments() {
199 CardTable::initialize_card_size();
200
201 // Need to setup sizes early to get correct alignments.
202 MaxHeapSize = ShenandoahHeapRegion::setup_sizes(MaxHeapSize);
203
204 // This is expected by our algorithm for ShenandoahHeap::heap_region_containing().
205 size_t align = ShenandoahHeapRegion::region_size_bytes();
206 if (UseLargePages) {
207 align = MAX2(align, os::large_page_size());
|