6730514: assertion failure in mangling code when expanding by 0 bytes

An expansion by 0 bytes was not anticipated when the assertion was composed.

Reviewed-by: jjh, jcoomes, apetrusenko
This commit is contained in:
Jon Masamitsu 2008-07-30 11:54:00 -07:00
parent b8633a3b01
commit 74b3de5c3b
9 changed files with 87 additions and 53 deletions

View file

@ -3195,31 +3195,16 @@ ConcurrentMarkSweepGeneration::expand_and_allocate(size_t word_size,
// YSR: All of this generation expansion/shrinking stuff is an exact copy of
// OneContigSpaceCardGeneration, which makes me wonder if we should move this
// to CardGeneration and share it...
bool ConcurrentMarkSweepGeneration::expand(size_t bytes, size_t expand_bytes) {
return CardGeneration::expand(bytes, expand_bytes);
}
void ConcurrentMarkSweepGeneration::expand(size_t bytes, size_t expand_bytes,
CMSExpansionCause::Cause cause)
{
assert_locked_or_safepoint(Heap_lock);
size_t aligned_bytes = ReservedSpace::page_align_size_up(bytes);
size_t aligned_expand_bytes = ReservedSpace::page_align_size_up(expand_bytes);
bool success = false;
if (aligned_expand_bytes > aligned_bytes) {
success = grow_by(aligned_expand_bytes);
}
if (!success) {
success = grow_by(aligned_bytes);
}
if (!success) {
size_t remaining_bytes = _virtual_space.uncommitted_size();
if (remaining_bytes > 0) {
success = grow_by(remaining_bytes);
}
}
if (GC_locker::is_active()) {
if (PrintGC && Verbose) {
gclog_or_tty->print_cr("Garbage collection disabled, expanded heap instead");
}
}
bool success = expand(bytes, expand_bytes);
// remember why we expanded; this information is used
// by shouldConcurrentCollect() when making decisions on whether to start
// a new CMS cycle.

View file

@ -1048,10 +1048,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
double _initiating_occupancy;
protected:
// Grow generation by specified size (returns false if unable to grow)
bool grow_by(size_t bytes);
// Grow generation to reserved size.
bool grow_to_reserved();
// Shrink generation by specified size (returns false if unable to shrink)
virtual void shrink_by(size_t bytes);
@ -1103,6 +1099,11 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
// Override
virtual void ref_processor_init();
// Grow generation by specified size (returns false if unable to grow)
bool grow_by(size_t bytes);
// Grow generation to reserved size.
bool grow_to_reserved();
void clear_expansion_cause() { _expansion_cause = CMSExpansionCause::_no_expansion; }
// Space enquiries
@ -1193,6 +1194,7 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
// Allocation failure
void expand(size_t bytes, size_t expand_bytes,
CMSExpansionCause::Cause cause);
virtual bool expand(size_t bytes, size_t expand_bytes);
void shrink(size_t bytes);
HeapWord* expand_and_par_lab_allocate(CMSParGCThreadState* ps, size_t word_sz);
bool expand_and_ensure_spooling_space(PromotionInfo* promo);