258 // Allocate the highest free region in the reserved heap,
259 // and add it to our list of allocated regions. It is marked
260 // archive and added to the old set.
261 HeapRegion* hr = _g1h->alloc_highest_free_region();
262 if (hr == NULL) {
263 return false;
264 }
265 assert(hr->is_empty(), err_msg("expected empty region (index %u)", hr->hrm_index()));
266 hr->set_archive();
267 _g1h->old_set_add(hr);
268 _g1h->hr_printer()->alloc(hr, G1HRPrinter::Archive);
269 _allocated_regions.append(hr);
270 _allocation_region = hr;
271
272 // Set up _bottom and _max to begin allocating in the lowest
273 // min_region_size'd chunk of the allocated G1 region.
274 _bottom = hr->bottom();
275 _max = _bottom + HeapRegion::min_region_size_in_words();
276
277 // Tell mark-sweep that objects in this region are not to be marked.
278 G1MarkSweep::mark_range_archive(MemRegion(_bottom, HeapRegion::GrainWords));
279
280 // Since we've modified the old set, call update_sizes.
281 _g1h->g1mm()->update_sizes();
282 return true;
283 }
284
285 HeapWord* G1ArchiveAllocator::archive_mem_allocate(size_t word_size) {
286 assert(word_size != 0, "size must not be zero");
287 if (_allocation_region == NULL) {
288 if (!alloc_new_region()) {
289 return NULL;
290 }
291 }
292 HeapWord* old_top = _allocation_region->top();
293 assert(_bottom >= _allocation_region->bottom(),
294 err_msg("inconsistent allocation state: " PTR_FORMAT " < " PTR_FORMAT,
295 p2i(_bottom), p2i(_allocation_region->bottom())));
296 assert(_max <= _allocation_region->end(),
297 err_msg("inconsistent allocation state: " PTR_FORMAT " > " PTR_FORMAT,
298 p2i(_max), p2i(_allocation_region->end())));
|
258 // Allocate the highest free region in the reserved heap,
259 // and add it to our list of allocated regions. It is marked
260 // archive and added to the old set.
261 HeapRegion* hr = _g1h->alloc_highest_free_region();
262 if (hr == NULL) {
263 return false;
264 }
265 assert(hr->is_empty(), err_msg("expected empty region (index %u)", hr->hrm_index()));
266 hr->set_archive();
267 _g1h->old_set_add(hr);
268 _g1h->hr_printer()->alloc(hr, G1HRPrinter::Archive);
269 _allocated_regions.append(hr);
270 _allocation_region = hr;
271
272 // Set up _bottom and _max to begin allocating in the lowest
273 // min_region_size'd chunk of the allocated G1 region.
274 _bottom = hr->bottom();
275 _max = _bottom + HeapRegion::min_region_size_in_words();
276
277 // Tell mark-sweep that objects in this region are not to be marked.
278 G1MarkSweep::set_range_archive(MemRegion(_bottom, HeapRegion::GrainWords), true);
279
280 // Since we've modified the old set, call update_sizes.
281 _g1h->g1mm()->update_sizes();
282 return true;
283 }
284
285 HeapWord* G1ArchiveAllocator::archive_mem_allocate(size_t word_size) {
286 assert(word_size != 0, "size must not be zero");
287 if (_allocation_region == NULL) {
288 if (!alloc_new_region()) {
289 return NULL;
290 }
291 }
292 HeapWord* old_top = _allocation_region->top();
293 assert(_bottom >= _allocation_region->bottom(),
294 err_msg("inconsistent allocation state: " PTR_FORMAT " < " PTR_FORMAT,
295 p2i(_bottom), p2i(_allocation_region->bottom())));
296 assert(_max <= _allocation_region->end(),
297 err_msg("inconsistent allocation state: " PTR_FORMAT " > " PTR_FORMAT,
298 p2i(_max), p2i(_allocation_region->end())));
|