index

src/share/vm/gc_implementation/g1/vm_operations_g1.cpp

Print this page
rev 8024 : imported patch event1
* * *
imported patch event2


  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 #include "precompiled.hpp"
  26 #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
  27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
  28 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
  29 #include "gc_implementation/g1/g1Log.hpp"
  30 #include "gc_implementation/g1/vm_operations_g1.hpp"
  31 #include "gc_implementation/shared/gcTimer.hpp"
  32 #include "gc_implementation/shared/gcTraceTime.hpp"
  33 #include "gc_implementation/shared/isGCActiveMark.hpp"
  34 #include "gc_implementation/g1/vm_operations_g1.hpp"
  35 #include "runtime/interfaceSupport.hpp"
  36 
  37 VM_G1CollectForAllocation::VM_G1CollectForAllocation(uint gc_count_before,
  38                                                      size_t word_size)

  39   : VM_G1OperationWithAllocRequest(gc_count_before, word_size,
  40                                    GCCause::_allocation_failure) {

  41   guarantee(word_size != 0, "An allocation should always be requested with this operation.");
  42 }
  43 
  44 void VM_G1CollectForAllocation::doit() {
  45   G1CollectedHeap* g1h = G1CollectedHeap::heap();
  46   GCCauseSetter x(g1h, _gc_cause);
  47 
  48   _result = g1h->satisfy_failed_allocation(_word_size, allocation_context(), &_pause_succeeded);
  49   assert(_result == NULL || _pause_succeeded,
  50          "if we get back a result, the pause should have succeeded");
  51 }
  52 
  53 void VM_G1CollectFull::doit() {
  54   G1CollectedHeap* g1h = G1CollectedHeap::heap();
  55   GCCauseSetter x(g1h, _gc_cause);
  56   g1h->do_full_collection(false /* clear_all_soft_refs */);
  57 }
  58 
  59 VM_G1IncCollectionPause::VM_G1IncCollectionPause(uint           gc_count_before,
  60                                                  size_t         word_size,
  61                                                  bool           should_initiate_conc_mark,
  62                                                  double         target_pause_time_ms,
  63                                                  GCCause::Cause gc_cause)
  64   : VM_G1OperationWithAllocRequest(gc_count_before, word_size, gc_cause),

  65     _should_initiate_conc_mark(should_initiate_conc_mark),
  66     _target_pause_time_ms(target_pause_time_ms),
  67     _should_retry_gc(false),
  68     _old_marking_cycles_completed_before(0) {
  69   guarantee(target_pause_time_ms > 0.0,
  70             err_msg("target_pause_time_ms = %1.6lf should be positive",
  71                     target_pause_time_ms));
  72   _gc_cause = gc_cause;
  73 }
  74 
  75 bool VM_G1IncCollectionPause::doit_prologue() {
  76   bool res = VM_G1OperationWithAllocRequest::doit_prologue();
  77   if (!res) {
  78     if (_should_initiate_conc_mark) {
  79       // The prologue can fail for a couple of reasons. The first is that another GC
  80       // got scheduled and prevented the scheduling of the initial mark GC. The
  81       // second is that the GC locker may be active and the heap can't be expanded.
  82       // In both cases we want to retry the GC so that the initial mark pause is
  83       // actually scheduled. In the second case, however, we should stall until
  84       // until the GC locker is no longer active and then retry the initial mark GC.




  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 #include "precompiled.hpp"
  26 #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
  27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
  28 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
  29 #include "gc_implementation/g1/g1Log.hpp"
  30 #include "gc_implementation/g1/vm_operations_g1.hpp"
  31 #include "gc_implementation/shared/gcTimer.hpp"
  32 #include "gc_implementation/shared/gcTraceTime.hpp"
  33 #include "gc_implementation/shared/isGCActiveMark.hpp"
  34 #include "gc_implementation/g1/vm_operations_g1.hpp"
  35 #include "runtime/interfaceSupport.hpp"
  36 
  37 VM_G1CollectForAllocation::VM_G1CollectForAllocation(uint gc_count_before,
  38                                                      size_t word_size,
  39                                                      uint gc_attempt)
  40   : VM_G1OperationWithAllocRequest(gc_count_before, word_size,
  41                                    GCCause::_allocation_failure,
  42                                    gc_attempt) {
  43   guarantee(word_size != 0, "An allocation should always be requested with this operation.");
  44 }
  45 
  46 void VM_G1CollectForAllocation::doit() {
  47   G1CollectedHeap* g1h = G1CollectedHeap::heap();
  48   GCCauseSetter x(g1h, _gc_cause);
  49 
  50   _result = g1h->satisfy_failed_allocation(_word_size, allocation_context(), &_pause_succeeded);
  51   assert(_result == NULL || _pause_succeeded,
  52          "if we get back a result, the pause should have succeeded");
  53 }
  54 
  55 void VM_G1CollectFull::doit() {
  56   G1CollectedHeap* g1h = G1CollectedHeap::heap();
  57   GCCauseSetter x(g1h, _gc_cause);
  58   g1h->do_full_collection(false /* clear_all_soft_refs */);
  59 }
  60 
  61 VM_G1IncCollectionPause::VM_G1IncCollectionPause(uint           gc_count_before,
  62                                                  size_t         word_size,
  63                                                  bool           should_initiate_conc_mark,
  64                                                  double         target_pause_time_ms,
  65                                                  GCCause::Cause gc_cause,
  66                                                  uint           gc_attempt)
  67   : VM_G1OperationWithAllocRequest(gc_count_before, word_size, gc_cause, gc_attempt),
  68     _should_initiate_conc_mark(should_initiate_conc_mark),
  69     _target_pause_time_ms(target_pause_time_ms),
  70     _should_retry_gc(false),
  71     _old_marking_cycles_completed_before(0) {
  72   guarantee(target_pause_time_ms > 0.0,
  73             err_msg("target_pause_time_ms = %1.6lf should be positive",
  74                     target_pause_time_ms));
  75   _gc_cause = gc_cause;
  76 }
  77 
  78 bool VM_G1IncCollectionPause::doit_prologue() {
  79   bool res = VM_G1OperationWithAllocRequest::doit_prologue();
  80   if (!res) {
  81     if (_should_initiate_conc_mark) {
  82       // The prologue can fail for a couple of reasons. The first is that another GC
  83       // got scheduled and prevented the scheduling of the initial mark GC. The
  84       // second is that the GC locker may be active and the heap can't be expanded.
  85       // In both cases we want to retry the GC so that the initial mark pause is
  86       // actually scheduled. In the second case, however, we should stall until
  87       // until the GC locker is no longer active and then retry the initial mark GC.


index