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

Print this page
rev 5685 : 8028128: Add a type safe alternative for working with counter based data
Reviewed-by:


 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                                 );
 146 #endif /* USDT2 */
 147 
 148   _collector->_gc_timer_cm->register_gc_pause_start("Initial Mark", os::elapsed_counter());
 149 
 150   GenCollectedHeap* gch = GenCollectedHeap::heap();
 151   GCCauseSetter gccs(gch, GCCause::_cms_initial_mark);
 152 
 153   VM_CMS_Operation::verify_before_gc();
 154 
 155   IsGCActiveMark x; // stop-world GC active
 156   _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsInitial, gch->gc_cause());
 157 
 158   VM_CMS_Operation::verify_after_gc();
 159 
 160   _collector->_gc_timer_cm->register_gc_pause_end(os::elapsed_counter());
 161 
 162 #ifndef USDT2
 163   HS_DTRACE_PROBE(hs_private, cms__initmark__end);
 164 #else /* USDT2 */
 165   HS_PRIVATE_CMS_INITMARK_END(
 166                                 );
 167 #endif /* USDT2 */
 168 }
 169 
 170 //////////////////////////////////////////////////////////
 171 // Methods in class VM_CMS_Final_Remark_Operation
 172 //////////////////////////////////////////////////////////
 173 void VM_CMS_Final_Remark::doit() {
 174   if (lost_race()) {
 175     // Nothing to do.
 176     return;
 177   }
 178 #ifndef USDT2
 179   HS_DTRACE_PROBE(hs_private, cms__remark__begin);
 180 #else /* USDT2 */
 181   HS_PRIVATE_CMS_REMARK_BEGIN(
 182                                 );
 183 #endif /* USDT2 */
 184 
 185   _collector->_gc_timer_cm->register_gc_pause_start("Final Mark", os::elapsed_counter());
 186 
 187   GenCollectedHeap* gch = GenCollectedHeap::heap();
 188   GCCauseSetter gccs(gch, GCCause::_cms_final_remark);
 189 
 190   VM_CMS_Operation::verify_before_gc();
 191 
 192   IsGCActiveMark x; // stop-world GC active
 193   _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsFinal, gch->gc_cause());
 194 
 195   VM_CMS_Operation::verify_after_gc();
 196 
 197   _collector->save_heap_summary();
 198   _collector->_gc_timer_cm->register_gc_pause_end(os::elapsed_counter());
 199 
 200 #ifndef USDT2
 201   HS_DTRACE_PROBE(hs_private, cms__remark__end);
 202 #else /* USDT2 */
 203   HS_PRIVATE_CMS_REMARK_END(
 204                                 );
 205 #endif /* USDT2 */
 206 }
 207 
 208 // VM operation to invoke a concurrent collection of a
 209 // GenCollectedHeap heap.
 210 void VM_GenCollectFullConcurrent::doit() {
 211   assert(Thread::current()->is_VM_thread(), "Should be VM thread");
 212   assert(GCLockerInvokesConcurrent || ExplicitGCInvokesConcurrent, "Unexpected");
 213 
 214   GenCollectedHeap* gch = GenCollectedHeap::heap();
 215   if (_gc_count_before == gch->total_collections()) {
 216     // The "full" of do_full_collection call below "forces"
 217     // a collection; the second arg, 0, below ensures that
 218     // only the young gen is collected. XXX In the future,




 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                                 );
 146 #endif /* USDT2 */
 147 
 148   _collector->_gc_timer_cm->register_gc_pause_start("Initial Mark");
 149 
 150   GenCollectedHeap* gch = GenCollectedHeap::heap();
 151   GCCauseSetter gccs(gch, GCCause::_cms_initial_mark);
 152 
 153   VM_CMS_Operation::verify_before_gc();
 154 
 155   IsGCActiveMark x; // stop-world GC active
 156   _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsInitial, gch->gc_cause());
 157 
 158   VM_CMS_Operation::verify_after_gc();
 159 
 160   _collector->_gc_timer_cm->register_gc_pause_end();
 161 
 162 #ifndef USDT2
 163   HS_DTRACE_PROBE(hs_private, cms__initmark__end);
 164 #else /* USDT2 */
 165   HS_PRIVATE_CMS_INITMARK_END(
 166                                 );
 167 #endif /* USDT2 */
 168 }
 169 
 170 //////////////////////////////////////////////////////////
 171 // Methods in class VM_CMS_Final_Remark_Operation
 172 //////////////////////////////////////////////////////////
 173 void VM_CMS_Final_Remark::doit() {
 174   if (lost_race()) {
 175     // Nothing to do.
 176     return;
 177   }
 178 #ifndef USDT2
 179   HS_DTRACE_PROBE(hs_private, cms__remark__begin);
 180 #else /* USDT2 */
 181   HS_PRIVATE_CMS_REMARK_BEGIN(
 182                                 );
 183 #endif /* USDT2 */
 184 
 185   _collector->_gc_timer_cm->register_gc_pause_start("Final Mark");
 186 
 187   GenCollectedHeap* gch = GenCollectedHeap::heap();
 188   GCCauseSetter gccs(gch, GCCause::_cms_final_remark);
 189 
 190   VM_CMS_Operation::verify_before_gc();
 191 
 192   IsGCActiveMark x; // stop-world GC active
 193   _collector->do_CMS_operation(CMSCollector::CMS_op_checkpointRootsFinal, gch->gc_cause());
 194 
 195   VM_CMS_Operation::verify_after_gc();
 196 
 197   _collector->save_heap_summary();
 198   _collector->_gc_timer_cm->register_gc_pause_end();
 199 
 200 #ifndef USDT2
 201   HS_DTRACE_PROBE(hs_private, cms__remark__end);
 202 #else /* USDT2 */
 203   HS_PRIVATE_CMS_REMARK_END(
 204                                 );
 205 #endif /* USDT2 */
 206 }
 207 
 208 // VM operation to invoke a concurrent collection of a
 209 // GenCollectedHeap heap.
 210 void VM_GenCollectFullConcurrent::doit() {
 211   assert(Thread::current()->is_VM_thread(), "Should be VM thread");
 212   assert(GCLockerInvokesConcurrent || ExplicitGCInvokesConcurrent, "Unexpected");
 213 
 214   GenCollectedHeap* gch = GenCollectedHeap::heap();
 215   if (_gc_count_before == gch->total_collections()) {
 216     // The "full" of do_full_collection call below "forces"
 217     // a collection; the second arg, 0, below ensures that
 218     // only the young gen is collected. XXX In the future,