< prev index next >
src/share/vm/gc/g1/g1CollectedHeap.cpp
Print this page
rev 9280 : imported patch 8140585-PLAB-statistics-flushed-too-late
rev 9282 : dihop-changes
*** 425,444 ****
_humongous_set.add(first_hr);
return new_obj;
}
// If could fit into free regions w/o expansion, try.
// Otherwise, if can expand, do so.
// Otherwise, if using ex regions might help, try with ex given back.
HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size, AllocationContext_t context) {
assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
verify_region_sets_optional();
uint first = G1_NO_HRM_INDEX;
! uint obj_regions = (uint)(align_size_up_(word_size, HeapRegion::GrainWords) / HeapRegion::GrainWords);
if (obj_regions == 1) {
// Only one region to allocate, try to use a fast path by directly allocating
// from the free lists. Do not try to expand here, we will potentially do that
// later.
--- 425,449 ----
_humongous_set.add(first_hr);
return new_obj;
}
+ size_t G1CollectedHeap::humongous_obj_size_in_regions(size_t word_size) {
+ assert(is_humongous(word_size), "Object of size " SIZE_FORMAT " must be humongous here", word_size);
+ return align_size_up_(word_size, HeapRegion::GrainWords) / HeapRegion::GrainWords;
+ }
+
// If could fit into free regions w/o expansion, try.
// Otherwise, if can expand, do so.
// Otherwise, if using ex regions might help, try with ex given back.
HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size, AllocationContext_t context) {
assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
verify_region_sets_optional();
uint first = G1_NO_HRM_INDEX;
! uint obj_regions = (uint) humongous_obj_size_in_regions(word_size);
if (obj_regions == 1) {
// Only one region to allocate, try to use a fast path by directly allocating
// from the free lists. Do not try to expand here, we will potentially do that
// later.
*** 1034,1043 ****
--- 1039,1049 ----
// Given that humongous objects are not allocated in young
// regions, we'll first try to do the allocation without doing a
// collection hoping that there's enough space in the heap.
result = humongous_obj_allocate(word_size, AllocationContext::current());
if (result != NULL) {
+ g1_policy()->add_last_old_allocated_bytes(humongous_obj_size_in_regions(word_size) * HeapRegion::GrainBytes);
return result;
}
if (GC_locker::is_active_and_needs_gc()) {
should_try_gc = false;
*** 5281,5290 ****
--- 5287,5298 ----
DerivedPointerTable::update_pointers();
#endif
}
void G1CollectedHeap::record_obj_copy_mem_stats() {
+ g1_policy()->add_last_old_allocated_bytes(_old_evac_stats.allocated() * HeapWordSize);
+
_gc_tracer_stw->report_evacuation_statistics(create_g1_evac_summary(&_survivor_evac_stats),
create_g1_evac_summary(&_old_evac_stats));
}
void G1CollectedHeap::free_region(HeapRegion* hr,
< prev index next >