352 // in mark-sweep, since we will be creating archive regions.
353 G1ArchiveAllocator* result = new G1ArchiveAllocator(g1h, open);
354 enable_archive_object_check();
355 return result;
356 }
357
358 bool G1ArchiveAllocator::alloc_new_region() {
359 // Allocate the highest free region in the reserved heap,
360 // and add it to our list of allocated regions. It is marked
361 // archive and added to the old set.
362 HeapRegion* hr = _g1h->alloc_highest_free_region();
363 if (hr == NULL) {
364 return false;
365 }
366 assert(hr->is_empty(), "expected empty region (index %u)", hr->hrm_index());
367 if (_open) {
368 hr->set_open_archive();
369 } else {
370 hr->set_closed_archive();
371 }
372 _g1h->g1_policy()->remset_tracker()->update_at_allocate(hr);
373 _g1h->archive_set_add(hr);
374 _g1h->hr_printer()->alloc(hr);
375 _allocated_regions.append(hr);
376 _allocation_region = hr;
377
378 // Set up _bottom and _max to begin allocating in the lowest
379 // min_region_size'd chunk of the allocated G1 region.
380 _bottom = hr->bottom();
381 _max = _bottom + HeapRegion::min_region_size_in_words();
382
383 // Tell mark-sweep that objects in this region are not to be marked.
384 set_range_archive(MemRegion(_bottom, HeapRegion::GrainWords), _open);
385
386 // Since we've modified the old set, call update_sizes.
387 _g1h->g1mm()->update_sizes();
388 return true;
389 }
390
391 HeapWord* G1ArchiveAllocator::archive_mem_allocate(size_t word_size) {
392 assert(word_size != 0, "size must not be zero");
|
352 // in mark-sweep, since we will be creating archive regions.
353 G1ArchiveAllocator* result = new G1ArchiveAllocator(g1h, open);
354 enable_archive_object_check();
355 return result;
356 }
357
358 bool G1ArchiveAllocator::alloc_new_region() {
359 // Allocate the highest free region in the reserved heap,
360 // and add it to our list of allocated regions. It is marked
361 // archive and added to the old set.
362 HeapRegion* hr = _g1h->alloc_highest_free_region();
363 if (hr == NULL) {
364 return false;
365 }
366 assert(hr->is_empty(), "expected empty region (index %u)", hr->hrm_index());
367 if (_open) {
368 hr->set_open_archive();
369 } else {
370 hr->set_closed_archive();
371 }
372 _g1h->policy()->remset_tracker()->update_at_allocate(hr);
373 _g1h->archive_set_add(hr);
374 _g1h->hr_printer()->alloc(hr);
375 _allocated_regions.append(hr);
376 _allocation_region = hr;
377
378 // Set up _bottom and _max to begin allocating in the lowest
379 // min_region_size'd chunk of the allocated G1 region.
380 _bottom = hr->bottom();
381 _max = _bottom + HeapRegion::min_region_size_in_words();
382
383 // Tell mark-sweep that objects in this region are not to be marked.
384 set_range_archive(MemRegion(_bottom, HeapRegion::GrainWords), _open);
385
386 // Since we've modified the old set, call update_sizes.
387 _g1h->g1mm()->update_sizes();
388 return true;
389 }
390
391 HeapWord* G1ArchiveAllocator::archive_mem_allocate(size_t word_size) {
392 assert(word_size != 0, "size must not be zero");
|