Mercurial > hg > graal-compiler
diff src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @ 4834:6a78aa6ac1ff
7132311: G1: assert((s == klass->oop_size(this)) || (Universe::heap()->is_gc_active() && ((is_typeArray()...
Summary: Move the check for when to call collect() to before we do a humongous object allocation
Reviewed-by: stefank, tonyp
author | brutisso |
---|---|
date | Mon, 23 Jan 2012 20:36:16 +0100 |
parents | 9509c20bba28 |
children | eff609af17d7 |
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Fri Jan 20 18:01:32 2012 +0100 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Mon Jan 23 20:36:16 2012 +0100 @@ -1138,36 +1138,41 @@ return ret; } -bool G1CollectorPolicy::need_to_start_conc_mark(const char* source) { - if (_g1->mark_in_progress()) { +bool G1CollectorPolicy::need_to_start_conc_mark(const char* source, size_t alloc_word_size) { + if (_g1->concurrent_mark()->cmThread()->during_cycle()) { return false; } size_t marking_initiating_used_threshold = (_g1->capacity() / 100) * InitiatingHeapOccupancyPercent; size_t cur_used_bytes = _g1->non_young_capacity_bytes(); - - if (cur_used_bytes > marking_initiating_used_threshold) { + size_t alloc_byte_size = alloc_word_size * HeapWordSize; + + if ((cur_used_bytes + alloc_byte_size) > marking_initiating_used_threshold) { if (gcs_are_young()) { - ergo_verbose4(ErgoConcCycles, + ergo_verbose5(ErgoConcCycles, "request concurrent cycle initiation", ergo_format_reason("occupancy higher than threshold") ergo_format_byte("occupancy") + ergo_format_byte("allocation request") ergo_format_byte_perc("threshold") ergo_format_str("source"), cur_used_bytes, + alloc_byte_size, marking_initiating_used_threshold, (double) InitiatingHeapOccupancyPercent, source); return true; } else { - ergo_verbose4(ErgoConcCycles, + ergo_verbose5(ErgoConcCycles, "do not request concurrent cycle initiation", ergo_format_reason("still doing mixed collections") ergo_format_byte("occupancy") + ergo_format_byte("allocation request") ergo_format_byte_perc("threshold") ergo_format_str("source"), cur_used_bytes, + alloc_byte_size, marking_initiating_used_threshold, (double) InitiatingHeapOccupancyPercent, source);