1.1 --- a/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.hpp Fri Apr 09 13:08:34 2010 -0400 1.2 +++ b/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.hpp Tue Apr 13 13:52:10 2010 -0700 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright 2004-2006 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * Copyright 2004-2010 Sun Microsystems, Inc. All Rights Reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -27,6 +27,7 @@ 1.11 1.12 // Forward decls 1.13 class elapsedTimer; 1.14 +class CollectorPolicy; 1.15 1.16 class AdaptiveSizePolicy : public CHeapObj { 1.17 friend class GCAdaptivePolicyCounters; 1.18 @@ -75,13 +76,16 @@ 1.19 1.20 // This is a hint for the heap: we've detected that gc times 1.21 // are taking longer than GCTimeLimit allows. 1.22 - bool _gc_time_limit_exceeded; 1.23 - // Use for diagnostics only. If UseGCTimeLimit is false, 1.24 + bool _gc_overhead_limit_exceeded; 1.25 + // Use for diagnostics only. If UseGCOverheadLimit is false, 1.26 // this variable is still set. 1.27 - bool _print_gc_time_limit_would_be_exceeded; 1.28 + bool _print_gc_overhead_limit_would_be_exceeded; 1.29 // Count of consecutive GC that have exceeded the 1.30 // GC time limit criterion. 1.31 - uint _gc_time_limit_count; 1.32 + uint _gc_overhead_limit_count; 1.33 + // This flag signals that GCTimeLimit is being exceeded 1.34 + // but may not have done so for the required number of consequetive 1.35 + // collections. 1.36 1.37 // Minor collection timers used to determine both 1.38 // pause and interval times for collections. 1.39 @@ -406,22 +410,21 @@ 1.40 // Most heaps will choose to throw an OutOfMemoryError when 1.41 // this occurs but it is up to the heap to request this information 1.42 // of the policy 1.43 - bool gc_time_limit_exceeded() { 1.44 - return _gc_time_limit_exceeded; 1.45 + bool gc_overhead_limit_exceeded() { 1.46 + return _gc_overhead_limit_exceeded; 1.47 } 1.48 - void set_gc_time_limit_exceeded(bool v) { 1.49 - _gc_time_limit_exceeded = v; 1.50 - } 1.51 - bool print_gc_time_limit_would_be_exceeded() { 1.52 - return _print_gc_time_limit_would_be_exceeded; 1.53 - } 1.54 - void set_print_gc_time_limit_would_be_exceeded(bool v) { 1.55 - _print_gc_time_limit_would_be_exceeded = v; 1.56 + void set_gc_overhead_limit_exceeded(bool v) { 1.57 + _gc_overhead_limit_exceeded = v; 1.58 } 1.59 1.60 - uint gc_time_limit_count() { return _gc_time_limit_count; } 1.61 - void reset_gc_time_limit_count() { _gc_time_limit_count = 0; } 1.62 - void inc_gc_time_limit_count() { _gc_time_limit_count++; } 1.63 + // Tests conditions indicate the GC overhead limit is being approached. 1.64 + bool gc_overhead_limit_near() { 1.65 + return gc_overhead_limit_count() >= 1.66 + (AdaptiveSizePolicyGCTimeLimitThreshold - 1); 1.67 + } 1.68 + uint gc_overhead_limit_count() { return _gc_overhead_limit_count; } 1.69 + void reset_gc_overhead_limit_count() { _gc_overhead_limit_count = 0; } 1.70 + void inc_gc_overhead_limit_count() { _gc_overhead_limit_count++; } 1.71 // accessors for flags recording the decisions to resize the 1.72 // generations to meet the pause goal. 1.73 1.74 @@ -436,6 +439,16 @@ 1.75 int decide_at_full_gc() { return _decide_at_full_gc; } 1.76 void set_decide_at_full_gc(int v) { _decide_at_full_gc = v; } 1.77 1.78 + // Check the conditions for an out-of-memory due to excessive GC time. 1.79 + // Set _gc_overhead_limit_exceeded if all the conditions have been met. 1.80 + void check_gc_overhead_limit(size_t young_live, 1.81 + size_t eden_live, 1.82 + size_t max_old_gen_size, 1.83 + size_t max_eden_size, 1.84 + bool is_full_gc, 1.85 + GCCause::Cause gc_cause, 1.86 + CollectorPolicy* collector_policy); 1.87 + 1.88 // Printing support 1.89 virtual bool print_adaptive_size_policy_on(outputStream* st) const; 1.90 bool print_adaptive_size_policy_on(outputStream* st, int