94 // HeapWordSize).
95 guarantee(HeapWordSize == wordSize, "HeapWordSize must equal wordSize");
96
97 // The heap must be at least as aligned as generations.
98 size_t gen_alignment = Generation::GenGrain;
99
100 _gen_specs = gen_policy()->generations();
101
102 // Make sure the sizes are all aligned.
103 for (i = 0; i < _n_gens; i++) {
104 _gen_specs[i]->align(gen_alignment);
105 }
106
107 // Allocate space for the heap.
108
109 char* heap_address;
110 size_t total_reserved = 0;
111 int n_covered_regions = 0;
112 ReservedSpace heap_rs;
113
114 size_t heap_alignment = collector_policy()->max_alignment();
115
116 heap_address = allocate(heap_alignment, &total_reserved,
117 &n_covered_regions, &heap_rs);
118
119 if (!heap_rs.is_reserved()) {
120 vm_shutdown_during_initialization(
121 "Could not reserve enough space for object heap");
122 return JNI_ENOMEM;
123 }
124
125 _reserved = MemRegion((HeapWord*)heap_rs.base(),
126 (HeapWord*)(heap_rs.base() + heap_rs.size()));
127
128 // It is important to do this in a way such that concurrent readers can't
129 // temporarily think somethings in the heap. (Seen this happen in asserts.)
130 _reserved.set_word_size(0);
131 _reserved.set_start((HeapWord*)heap_rs.base());
132 size_t actual_heap_size = heap_rs.size();
133 _reserved.set_end((HeapWord*)(heap_rs.base() + actual_heap_size));
134
|
94 // HeapWordSize).
95 guarantee(HeapWordSize == wordSize, "HeapWordSize must equal wordSize");
96
97 // The heap must be at least as aligned as generations.
98 size_t gen_alignment = Generation::GenGrain;
99
100 _gen_specs = gen_policy()->generations();
101
102 // Make sure the sizes are all aligned.
103 for (i = 0; i < _n_gens; i++) {
104 _gen_specs[i]->align(gen_alignment);
105 }
106
107 // Allocate space for the heap.
108
109 char* heap_address;
110 size_t total_reserved = 0;
111 int n_covered_regions = 0;
112 ReservedSpace heap_rs;
113
114 size_t heap_alignment = collector_policy()->heap_alignment();
115
116 heap_address = allocate(heap_alignment, &total_reserved,
117 &n_covered_regions, &heap_rs);
118
119 if (!heap_rs.is_reserved()) {
120 vm_shutdown_during_initialization(
121 "Could not reserve enough space for object heap");
122 return JNI_ENOMEM;
123 }
124
125 _reserved = MemRegion((HeapWord*)heap_rs.base(),
126 (HeapWord*)(heap_rs.base() + heap_rs.size()));
127
128 // It is important to do this in a way such that concurrent readers can't
129 // temporarily think somethings in the heap. (Seen this happen in asserts.)
130 _reserved.set_word_size(0);
131 _reserved.set_start((HeapWord*)heap_rs.base());
132 size_t actual_heap_size = heap_rs.size();
133 _reserved.set_end((HeapWord*)(heap_rs.base() + actual_heap_size));
134
|