src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp

Print this page
rev 5893 : 8034080: Remove the USDT1 dtrace code from Hotspot


  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/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp"
  27 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
  28 #include "gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp"
  29 #include "gc_implementation/shared/gcTimer.hpp"
  30 #include "gc_implementation/shared/gcTraceTime.hpp"
  31 #include "gc_implementation/shared/isGCActiveMark.hpp"
  32 #include "memory/gcLocker.inline.hpp"
  33 #include "runtime/interfaceSupport.hpp"
  34 #include "runtime/os.hpp"
  35 #include "utilities/dtrace.hpp"
  36 
  37 
  38 #ifndef USDT2
  39 HS_DTRACE_PROBE_DECL(hs_private, cms__initmark__begin);
  40 HS_DTRACE_PROBE_DECL(hs_private, cms__initmark__end);
  41 
  42 HS_DTRACE_PROBE_DECL(hs_private, cms__remark__begin);
  43 HS_DTRACE_PROBE_DECL(hs_private, cms__remark__end);
  44 #endif /* !USDT2 */
  45 
  46 //////////////////////////////////////////////////////////
  47 // Methods in abstract class VM_CMS_Operation
  48 //////////////////////////////////////////////////////////
  49 void VM_CMS_Operation::acquire_pending_list_lock() {
  50   // The caller may block while communicating
  51   // with the SLT thread in order to acquire/release the PLL.
  52   ConcurrentMarkSweepThread::slt()->
  53     manipulatePLL(SurrogateLockerThread::acquirePLL);
  54 }
  55 
  56 void VM_CMS_Operation::release_and_notify_pending_list_lock() {
  57   // The caller may block while communicating
  58   // with the SLT thread in order to acquire/release the PLL.
  59   ConcurrentMarkSweepThread::slt()->
  60     manipulatePLL(SurrogateLockerThread::releaseAndNotifyPLL);
  61 }
  62 
  63 void VM_CMS_Operation::verify_before_gc() {
  64   if (VerifyBeforeGC &&
  65       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {


 121   assert(Thread::current()->is_ConcurrentGC_thread(), "just checking");
 122   assert(!CMSCollector::foregroundGCShouldWait(), "Possible deadlock");
 123   assert(!ConcurrentMarkSweepThread::cms_thread_has_cms_token(),
 124          "Possible deadlock");
 125 
 126   // Release the Heap_lock first.
 127   Heap_lock->unlock();
 128   if (needs_pll()) {
 129     release_and_notify_pending_list_lock();
 130   }
 131 }
 132 
 133 //////////////////////////////////////////////////////////
 134 // Methods in class VM_CMS_Initial_Mark
 135 //////////////////////////////////////////////////////////
 136 void VM_CMS_Initial_Mark::doit() {
 137   if (lost_race()) {
 138     // Nothing to do.
 139     return;
 140   }
 141 #ifndef USDT2
 142   HS_DTRACE_PROBE(hs_private, cms__initmark__begin);
 143 #else /* USDT2 */
 144   HS_PRIVATE_CMS_INITMARK_BEGIN();
 145 #endif /* USDT2 */
 146 
 147   _collector->_gc_timer_cm->register_gc_pause_start("Initial Mark");
 148 
 149   GenCollectedHeap* gch = GenCollectedHeap::heap();
 150   GCCauseSetter gccs(gch, GCCause::_cms_initial_mark);
 151 
 152   VM_CMS_Operation::verify_before_gc();
 153 
 154   IsGCActiveMark x; // stop-world GC active
 155   _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsInitial, gch->gc_cause());
 156 
 157   VM_CMS_Operation::verify_after_gc();
 158 
 159   _collector->_gc_timer_cm->register_gc_pause_end();
 160 
 161 #ifndef USDT2
 162   HS_DTRACE_PROBE(hs_private, cms__initmark__end);
 163 #else /* USDT2 */
 164   HS_PRIVATE_CMS_INITMARK_END();
 165 #endif /* USDT2 */
 166 }
 167 
 168 //////////////////////////////////////////////////////////
 169 // Methods in class VM_CMS_Final_Remark_Operation
 170 //////////////////////////////////////////////////////////
 171 void VM_CMS_Final_Remark::doit() {
 172   if (lost_race()) {
 173     // Nothing to do.
 174     return;
 175   }
 176 #ifndef USDT2
 177   HS_DTRACE_PROBE(hs_private, cms__remark__begin);
 178 #else /* USDT2 */
 179   HS_PRIVATE_CMS_REMARK_BEGIN();
 180 #endif /* USDT2 */
 181 
 182   _collector->_gc_timer_cm->register_gc_pause_start("Final Mark");
 183 
 184   GenCollectedHeap* gch = GenCollectedHeap::heap();
 185   GCCauseSetter gccs(gch, GCCause::_cms_final_remark);
 186 
 187   VM_CMS_Operation::verify_before_gc();
 188 
 189   IsGCActiveMark x; // stop-world GC active
 190   _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsFinal, gch->gc_cause());
 191 
 192   VM_CMS_Operation::verify_after_gc();
 193 
 194   _collector->save_heap_summary();
 195   _collector->_gc_timer_cm->register_gc_pause_end();
 196 
 197 #ifndef USDT2
 198   HS_DTRACE_PROBE(hs_private, cms__remark__end);
 199 #else /* USDT2 */
 200   HS_PRIVATE_CMS_REMARK_END();
 201 #endif /* USDT2 */
 202 }
 203 
 204 // VM operation to invoke a concurrent collection of a
 205 // GenCollectedHeap heap.
 206 void VM_GenCollectFullConcurrent::doit() {
 207   assert(Thread::current()->is_VM_thread(), "Should be VM thread");
 208   assert(GCLockerInvokesConcurrent || ExplicitGCInvokesConcurrent, "Unexpected");
 209 
 210   GenCollectedHeap* gch = GenCollectedHeap::heap();
 211   if (_gc_count_before == gch->total_collections()) {
 212     // The "full" of do_full_collection call below "forces"
 213     // a collection; the second arg, 0, below ensures that
 214     // only the young gen is collected. XXX In the future,
 215     // we'll probably need to have something in this interface
 216     // to say do this only if we are sure we will not bail
 217     // out to a full collection in this attempt, but that's
 218     // for the future.
 219     assert(SafepointSynchronize::is_at_safepoint(),
 220       "We can only be executing this arm of if at a safepoint");
 221     GCCauseSetter gccs(gch, _gc_cause);




  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/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp"
  27 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
  28 #include "gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp"
  29 #include "gc_implementation/shared/gcTimer.hpp"
  30 #include "gc_implementation/shared/gcTraceTime.hpp"
  31 #include "gc_implementation/shared/isGCActiveMark.hpp"
  32 #include "memory/gcLocker.inline.hpp"
  33 #include "runtime/interfaceSupport.hpp"
  34 #include "runtime/os.hpp"
  35 #include "utilities/dtrace.hpp"
  36 
  37 








  38 //////////////////////////////////////////////////////////
  39 // Methods in abstract class VM_CMS_Operation
  40 //////////////////////////////////////////////////////////
  41 void VM_CMS_Operation::acquire_pending_list_lock() {
  42   // The caller may block while communicating
  43   // with the SLT thread in order to acquire/release the PLL.
  44   ConcurrentMarkSweepThread::slt()->
  45     manipulatePLL(SurrogateLockerThread::acquirePLL);
  46 }
  47 
  48 void VM_CMS_Operation::release_and_notify_pending_list_lock() {
  49   // The caller may block while communicating
  50   // with the SLT thread in order to acquire/release the PLL.
  51   ConcurrentMarkSweepThread::slt()->
  52     manipulatePLL(SurrogateLockerThread::releaseAndNotifyPLL);
  53 }
  54 
  55 void VM_CMS_Operation::verify_before_gc() {
  56   if (VerifyBeforeGC &&
  57       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {


 113   assert(Thread::current()->is_ConcurrentGC_thread(), "just checking");
 114   assert(!CMSCollector::foregroundGCShouldWait(), "Possible deadlock");
 115   assert(!ConcurrentMarkSweepThread::cms_thread_has_cms_token(),
 116          "Possible deadlock");
 117 
 118   // Release the Heap_lock first.
 119   Heap_lock->unlock();
 120   if (needs_pll()) {
 121     release_and_notify_pending_list_lock();
 122   }
 123 }
 124 
 125 //////////////////////////////////////////////////////////
 126 // Methods in class VM_CMS_Initial_Mark
 127 //////////////////////////////////////////////////////////
 128 void VM_CMS_Initial_Mark::doit() {
 129   if (lost_race()) {
 130     // Nothing to do.
 131     return;
 132   }



 133   HS_PRIVATE_CMS_INITMARK_BEGIN();

 134 
 135   _collector->_gc_timer_cm->register_gc_pause_start("Initial Mark");
 136 
 137   GenCollectedHeap* gch = GenCollectedHeap::heap();
 138   GCCauseSetter gccs(gch, GCCause::_cms_initial_mark);
 139 
 140   VM_CMS_Operation::verify_before_gc();
 141 
 142   IsGCActiveMark x; // stop-world GC active
 143   _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsInitial, gch->gc_cause());
 144 
 145   VM_CMS_Operation::verify_after_gc();
 146 
 147   _collector->_gc_timer_cm->register_gc_pause_end();
 148 



 149   HS_PRIVATE_CMS_INITMARK_END();

 150 }
 151 
 152 //////////////////////////////////////////////////////////
 153 // Methods in class VM_CMS_Final_Remark_Operation
 154 //////////////////////////////////////////////////////////
 155 void VM_CMS_Final_Remark::doit() {
 156   if (lost_race()) {
 157     // Nothing to do.
 158     return;
 159   }



 160   HS_PRIVATE_CMS_REMARK_BEGIN();

 161 
 162   _collector->_gc_timer_cm->register_gc_pause_start("Final Mark");
 163 
 164   GenCollectedHeap* gch = GenCollectedHeap::heap();
 165   GCCauseSetter gccs(gch, GCCause::_cms_final_remark);
 166 
 167   VM_CMS_Operation::verify_before_gc();
 168 
 169   IsGCActiveMark x; // stop-world GC active
 170   _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsFinal, gch->gc_cause());
 171 
 172   VM_CMS_Operation::verify_after_gc();
 173 
 174   _collector->save_heap_summary();
 175   _collector->_gc_timer_cm->register_gc_pause_end();
 176 



 177   HS_PRIVATE_CMS_REMARK_END();

 178 }
 179 
 180 // VM operation to invoke a concurrent collection of a
 181 // GenCollectedHeap heap.
 182 void VM_GenCollectFullConcurrent::doit() {
 183   assert(Thread::current()->is_VM_thread(), "Should be VM thread");
 184   assert(GCLockerInvokesConcurrent || ExplicitGCInvokesConcurrent, "Unexpected");
 185 
 186   GenCollectedHeap* gch = GenCollectedHeap::heap();
 187   if (_gc_count_before == gch->total_collections()) {
 188     // The "full" of do_full_collection call below "forces"
 189     // a collection; the second arg, 0, below ensures that
 190     // only the young gen is collected. XXX In the future,
 191     // we'll probably need to have something in this interface
 192     // to say do this only if we are sure we will not bail
 193     // out to a full collection in this attempt, but that's
 194     // for the future.
 195     assert(SafepointSynchronize::is_at_safepoint(),
 196       "We can only be executing this arm of if at a safepoint");
 197     GCCauseSetter gccs(gch, _gc_cause);