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 "cds/cdsConfig.hpp"
28 #include "gc/g1/g1Arguments.hpp"
29 #include "gc/g1/g1CardSet.hpp"
30 #include "gc/g1/g1CardSetContainers.inline.hpp"
31 #include "gc/g1/g1CollectedHeap.inline.hpp"
32 #include "gc/g1/g1HeapRegion.hpp"
33 #include "gc/g1/g1HeapRegionBounds.inline.hpp"
34 #include "gc/g1/g1HeapRegionRemSet.hpp"
35 #include "gc/g1/g1HeapVerifier.hpp"
36 #include "gc/shared/cardTable.hpp"
37 #include "gc/shared/fullGCForwarding.hpp"
38 #include "gc/shared/gcArguments.hpp"
39 #include "gc/shared/workerPolicy.hpp"
40 #include "runtime/globals.hpp"
41 #include "runtime/globals_extension.hpp"
42 #include "runtime/java.hpp"
43
44 static size_t calculate_heap_alignment(size_t space_alignment) {
45 size_t card_table_alignment = CardTable::ct_max_alignment_constraint();
46 size_t page_size = UseLargePages ? os::large_page_size() : os::vm_page_size();
47 return MAX3(card_table_alignment, space_alignment, page_size);
48 }
49
50 void G1Arguments::initialize_alignments() {
51 // Initialize card size before initializing alignments
52 CardTable::initialize_card_size();
53
54 // Set up the region size and associated fields.
55 //
56 // There is a circular dependency here. We base the region size on the heap
57 // size, but the heap size should be aligned with the region size. To get
227 #ifdef COMPILER2
228 // Enable loop strip mining to offer better pause time guarantees
229 if (FLAG_IS_DEFAULT(UseCountedLoopSafepoints)) {
230 FLAG_SET_DEFAULT(UseCountedLoopSafepoints, true);
231 if (FLAG_IS_DEFAULT(LoopStripMiningIter)) {
232 FLAG_SET_DEFAULT(LoopStripMiningIter, 1000);
233 }
234 }
235 #endif
236
237 initialize_mark_stack_size();
238 initialize_verification_types();
239
240 // Verify that the maximum parallelism isn't too high to eventually overflow
241 // the refcount in G1CardSetContainer.
242 uint max_parallel_refinement_threads = G1ConcRefinementThreads + G1DirtyCardQueueSet::num_par_ids();
243 uint const divisor = 3; // Safe divisor; we increment by 2 for each claim, but there is a small initial value.
244 if (max_parallel_refinement_threads > UINT_MAX / divisor) {
245 vm_exit_during_initialization("Too large parallelism for remembered sets.");
246 }
247
248 FullGCForwarding::initialize_flags(heap_reserved_size_bytes());
249 }
250
251 CollectedHeap* G1Arguments::create_heap() {
252 return new G1CollectedHeap();
253 }
254
255 size_t G1Arguments::heap_reserved_size_bytes() {
256 return MaxHeapSize;
257 }
|
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 "cds/cdsConfig.hpp"
28 #include "gc/g1/g1Arguments.hpp"
29 #include "gc/g1/g1CardSet.hpp"
30 #include "gc/g1/g1CardSetContainers.inline.hpp"
31 #include "gc/g1/g1CollectedHeap.inline.hpp"
32 #include "gc/g1/g1HeapRegion.hpp"
33 #include "gc/g1/g1HeapRegionBounds.inline.hpp"
34 #include "gc/g1/g1HeapRegionRemSet.hpp"
35 #include "gc/g1/g1HeapVerifier.hpp"
36 #include "gc/shared/cardTable.hpp"
37 #include "gc/shared/gcArguments.hpp"
38 #include "gc/shared/workerPolicy.hpp"
39 #include "runtime/globals.hpp"
40 #include "runtime/globals_extension.hpp"
41 #include "runtime/java.hpp"
42
43 static size_t calculate_heap_alignment(size_t space_alignment) {
44 size_t card_table_alignment = CardTable::ct_max_alignment_constraint();
45 size_t page_size = UseLargePages ? os::large_page_size() : os::vm_page_size();
46 return MAX3(card_table_alignment, space_alignment, page_size);
47 }
48
49 void G1Arguments::initialize_alignments() {
50 // Initialize card size before initializing alignments
51 CardTable::initialize_card_size();
52
53 // Set up the region size and associated fields.
54 //
55 // There is a circular dependency here. We base the region size on the heap
56 // size, but the heap size should be aligned with the region size. To get
226 #ifdef COMPILER2
227 // Enable loop strip mining to offer better pause time guarantees
228 if (FLAG_IS_DEFAULT(UseCountedLoopSafepoints)) {
229 FLAG_SET_DEFAULT(UseCountedLoopSafepoints, true);
230 if (FLAG_IS_DEFAULT(LoopStripMiningIter)) {
231 FLAG_SET_DEFAULT(LoopStripMiningIter, 1000);
232 }
233 }
234 #endif
235
236 initialize_mark_stack_size();
237 initialize_verification_types();
238
239 // Verify that the maximum parallelism isn't too high to eventually overflow
240 // the refcount in G1CardSetContainer.
241 uint max_parallel_refinement_threads = G1ConcRefinementThreads + G1DirtyCardQueueSet::num_par_ids();
242 uint const divisor = 3; // Safe divisor; we increment by 2 for each claim, but there is a small initial value.
243 if (max_parallel_refinement_threads > UINT_MAX / divisor) {
244 vm_exit_during_initialization("Too large parallelism for remembered sets.");
245 }
246 }
247
248 CollectedHeap* G1Arguments::create_heap() {
249 return new G1CollectedHeap();
250 }
251
252 size_t G1Arguments::heap_reserved_size_bytes() {
253 return MaxHeapSize;
254 }
|