< prev index next >

src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp

Print this page




  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP
  27 
  28 #include "gc_implementation/g1/concurrentMark.hpp"
  29 #include "gc_implementation/g1/g1CollectedHeap.hpp"
  30 #include "gc_implementation/g1/g1AllocRegion.inline.hpp"
  31 #include "gc_implementation/g1/g1CollectorPolicy.hpp"

  32 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
  33 #include "gc_implementation/g1/heapRegionManager.inline.hpp"
  34 #include "gc_implementation/g1/heapRegionSet.inline.hpp"
  35 #include "runtime/orderAccess.inline.hpp"
  36 #include "utilities/taskqueue.hpp"
  37 
  38 PLABStats* G1CollectedHeap::alloc_buffer_stats(InCSetState dest) {
  39   switch (dest.value()) {
  40     case InCSetState::Young:
  41       return &_survivor_plab_stats;
  42     case InCSetState::Old:
  43       return &_old_plab_stats;
  44     default:
  45       ShouldNotReachHere();
  46       return NULL; // Keep some compilers happy
  47   }
  48 }
  49 
  50 size_t G1CollectedHeap::desired_plab_sz(InCSetState dest) {
  51   size_t gclab_word_size = alloc_buffer_stats(dest)->desired_plab_sz();


 271     res |= G1EvacuationFailureALotDuringMixedGC;
 272   }
 273   return res;
 274 }
 275 
 276 inline void
 277 G1CollectedHeap::set_evacuation_failure_alot_for_current_gc() {
 278   if (G1EvacuationFailureALot) {
 279     // Note we can't assert that _evacuation_failure_alot_for_current_gc
 280     // is clear here. It may have been set during a previous GC but that GC
 281     // did not copy enough objects (i.e. G1EvacuationFailureALotCount) to
 282     // trigger an evacuation failure and clear the flags and and counts.
 283 
 284     // Check if we have gone over the interval.
 285     const size_t gc_num = total_collections();
 286     const size_t elapsed_gcs = gc_num - _evacuation_failure_alot_gc_number;
 287 
 288     _evacuation_failure_alot_for_current_gc = (elapsed_gcs >= G1EvacuationFailureALotInterval);
 289 
 290     // Now check if G1EvacuationFailureALot is enabled for the current GC type.
 291     const bool gcs_are_young = g1_policy()->gcs_are_young();
 292     const bool during_im = g1_policy()->during_initial_mark_pause();
 293     const bool during_marking = mark_in_progress();
 294 
 295     _evacuation_failure_alot_for_current_gc &=
 296       evacuation_failure_alot_for_gc_type(gcs_are_young,
 297                                           during_im,
 298                                           during_marking);
 299   }
 300 }
 301 
 302 inline bool G1CollectedHeap::evacuation_should_fail() {
 303   if (!G1EvacuationFailureALot || !_evacuation_failure_alot_for_current_gc) {
 304     return false;
 305   }
 306   // G1EvacuationFailureALot is in effect for current GC
 307   // Access to _evacuation_failure_alot_count is not atomic;
 308   // the value does not have to be exact.
 309   if (++_evacuation_failure_alot_count < G1EvacuationFailureALotCount) {
 310     return false;
 311   }
 312   _evacuation_failure_alot_count = 0;
 313   return true;




  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP
  27 
  28 #include "gc_implementation/g1/concurrentMark.hpp"
  29 #include "gc_implementation/g1/g1CollectedHeap.hpp"
  30 #include "gc_implementation/g1/g1AllocRegion.inline.hpp"
  31 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
  32 #include "gc_implementation/g1/g1CollectorState.hpp"
  33 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
  34 #include "gc_implementation/g1/heapRegionManager.inline.hpp"
  35 #include "gc_implementation/g1/heapRegionSet.inline.hpp"
  36 #include "runtime/orderAccess.inline.hpp"
  37 #include "utilities/taskqueue.hpp"
  38 
  39 PLABStats* G1CollectedHeap::alloc_buffer_stats(InCSetState dest) {
  40   switch (dest.value()) {
  41     case InCSetState::Young:
  42       return &_survivor_plab_stats;
  43     case InCSetState::Old:
  44       return &_old_plab_stats;
  45     default:
  46       ShouldNotReachHere();
  47       return NULL; // Keep some compilers happy
  48   }
  49 }
  50 
  51 size_t G1CollectedHeap::desired_plab_sz(InCSetState dest) {
  52   size_t gclab_word_size = alloc_buffer_stats(dest)->desired_plab_sz();


 272     res |= G1EvacuationFailureALotDuringMixedGC;
 273   }
 274   return res;
 275 }
 276 
 277 inline void
 278 G1CollectedHeap::set_evacuation_failure_alot_for_current_gc() {
 279   if (G1EvacuationFailureALot) {
 280     // Note we can't assert that _evacuation_failure_alot_for_current_gc
 281     // is clear here. It may have been set during a previous GC but that GC
 282     // did not copy enough objects (i.e. G1EvacuationFailureALotCount) to
 283     // trigger an evacuation failure and clear the flags and and counts.
 284 
 285     // Check if we have gone over the interval.
 286     const size_t gc_num = total_collections();
 287     const size_t elapsed_gcs = gc_num - _evacuation_failure_alot_gc_number;
 288 
 289     _evacuation_failure_alot_for_current_gc = (elapsed_gcs >= G1EvacuationFailureALotInterval);
 290 
 291     // Now check if G1EvacuationFailureALot is enabled for the current GC type.
 292     const bool gcs_are_young = collector_state()->gcs_are_young();
 293     const bool during_im = collector_state()->during_initial_mark_pause();
 294     const bool during_marking = collector_state()->mark_in_progress();
 295 
 296     _evacuation_failure_alot_for_current_gc &=
 297       evacuation_failure_alot_for_gc_type(gcs_are_young,
 298                                           during_im,
 299                                           during_marking);
 300   }
 301 }
 302 
 303 inline bool G1CollectedHeap::evacuation_should_fail() {
 304   if (!G1EvacuationFailureALot || !_evacuation_failure_alot_for_current_gc) {
 305     return false;
 306   }
 307   // G1EvacuationFailureALot is in effect for current GC
 308   // Access to _evacuation_failure_alot_count is not atomic;
 309   // the value does not have to be exact.
 310   if (++_evacuation_failure_alot_count < G1EvacuationFailureALotCount) {
 311     return false;
 312   }
 313   _evacuation_failure_alot_count = 0;
 314   return true;


< prev index next >