src/share/vm/memory/tenuredGeneration.cpp

changeset 2243
a7214d79fcf1
parent 1907
c18cbe5936b8
child 2314
f95d63e2154a
     1.1 --- a/src/share/vm/memory/tenuredGeneration.cpp	Thu Oct 21 17:29:24 2010 -0700
     1.2 +++ b/src/share/vm/memory/tenuredGeneration.cpp	Sat Oct 23 23:03:49 2010 -0700
     1.3 @@ -419,29 +419,16 @@
     1.4  void TenuredGeneration::verify_alloc_buffers_clean() {}
     1.5  #endif // SERIALGC
     1.6  
     1.7 -bool TenuredGeneration::promotion_attempt_is_safe(
     1.8 -    size_t max_promotion_in_bytes,
     1.9 -    bool younger_handles_promotion_failure) const {
    1.10 -
    1.11 -  bool result = max_contiguous_available() >= max_promotion_in_bytes;
    1.12 -
    1.13 -  if (younger_handles_promotion_failure && !result) {
    1.14 -    result = max_contiguous_available() >=
    1.15 -      (size_t) gc_stats()->avg_promoted()->padded_average();
    1.16 -    if (PrintGC && Verbose && result) {
    1.17 -      gclog_or_tty->print_cr("TenuredGeneration::promotion_attempt_is_safe"
    1.18 -                  " contiguous_available: " SIZE_FORMAT
    1.19 -                  " avg_promoted: " SIZE_FORMAT,
    1.20 -                  max_contiguous_available(),
    1.21 -                  gc_stats()->avg_promoted()->padded_average());
    1.22 -    }
    1.23 -  } else {
    1.24 -    if (PrintGC && Verbose) {
    1.25 -      gclog_or_tty->print_cr("TenuredGeneration::promotion_attempt_is_safe"
    1.26 -                  " contiguous_available: " SIZE_FORMAT
    1.27 -                  " promotion_in_bytes: " SIZE_FORMAT,
    1.28 -                  max_contiguous_available(), max_promotion_in_bytes);
    1.29 -    }
    1.30 +bool TenuredGeneration::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const {
    1.31 +  size_t available = max_contiguous_available();
    1.32 +  size_t av_promo  = (size_t)gc_stats()->avg_promoted()->padded_average();
    1.33 +  bool   res = (available >= av_promo) || (available >= max_promotion_in_bytes);
    1.34 +  if (PrintGC && Verbose) {
    1.35 +    gclog_or_tty->print_cr(
    1.36 +      "Tenured: promo attempt is%s safe: available("SIZE_FORMAT") %s av_promo("SIZE_FORMAT"),"
    1.37 +      "max_promo("SIZE_FORMAT")",
    1.38 +      res? "":" not", available, res? ">=":"<",
    1.39 +      av_promo, max_promotion_in_bytes);
    1.40    }
    1.41 -  return result;
    1.42 +  return res;
    1.43  }

mercurial