< prev index next >

src/share/vm/gc/cms/vmCMSOperations.cpp

Print this page




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  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 #include "precompiled.hpp"
  26 #include "gc/cms/concurrentMarkSweepGeneration.inline.hpp"
  27 #include "gc/cms/concurrentMarkSweepThread.hpp"
  28 #include "gc/cms/vmCMSOperations.hpp"
  29 #include "gc/shared/gcLocker.inline.hpp"
  30 #include "gc/shared/gcTimer.hpp"
  31 #include "gc/shared/gcTraceTime.hpp"
  32 #include "gc/shared/isGCActiveMark.hpp"
  33 #include "runtime/interfaceSupport.hpp"
  34 #include "runtime/os.hpp"
  35 #include "utilities/dtrace.hpp"
  36 
  37 //////////////////////////////////////////////////////////
  38 // Methods in abstract class VM_CMS_Operation
  39 //////////////////////////////////////////////////////////
  40 void VM_CMS_Operation::acquire_pending_list_lock() {
  41   // The caller may block while communicating
  42   // with the SLT thread in order to acquire/release the PLL.
  43   SurrogateLockerThread* slt = ConcurrentMarkSweepThread::slt();
  44   if (slt != NULL) {
  45     slt->manipulatePLL(SurrogateLockerThread::acquirePLL);
  46   } else {
  47     SurrogateLockerThread::report_missing_slt();
  48   }
  49 }
  50 
  51 void VM_CMS_Operation::release_and_notify_pending_list_lock() {
  52   // The caller may block while communicating
  53   // with the SLT thread in order to acquire/release the PLL.
  54   ConcurrentMarkSweepThread::slt()->
  55     manipulatePLL(SurrogateLockerThread::releaseAndNotifyPLL);
  56 }
  57 
  58 void VM_CMS_Operation::verify_before_gc() {
  59   if (VerifyBeforeGC &&
  60       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  61     GCTraceTime tm("Verify Before", false, false, _collector->_gc_timer_cm);
  62     HandleMark hm;
  63     FreelistLocker x(_collector);
  64     MutexLockerEx  y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag);
  65     GenCollectedHeap::heap()->prepare_for_verify();
  66     Universe::verify();
  67   }
  68 }
  69 
  70 void VM_CMS_Operation::verify_after_gc() {
  71   if (VerifyAfterGC &&
  72       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  73     GCTraceTime tm("Verify After", false, false, _collector->_gc_timer_cm);
  74     HandleMark hm;
  75     FreelistLocker x(_collector);
  76     MutexLockerEx  y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag);
  77     Universe::verify();
  78   }
  79 }
  80 
  81 bool VM_CMS_Operation::lost_race() const {
  82   if (CMSCollector::abstract_state() == CMSCollector::Idling) {
  83     // We lost a race to a foreground collection
  84     // -- there's nothing to do
  85     return true;
  86   }
  87   assert(CMSCollector::abstract_state() == legal_state(),
  88          "Inconsistent collector state?");
  89   return false;
  90 }
  91 
  92 bool VM_CMS_Operation::doit_prologue() {
  93   assert(Thread::current()->is_ConcurrentGC_thread(), "just checking");




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  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 #include "precompiled.hpp"
  26 #include "gc/cms/concurrentMarkSweepGeneration.inline.hpp"
  27 #include "gc/cms/concurrentMarkSweepThread.hpp"
  28 #include "gc/cms/vmCMSOperations.hpp"
  29 #include "gc/shared/gcLocker.inline.hpp"
  30 #include "gc/shared/gcTimer.hpp"
  31 #include "gc/shared/gcTraceTime.inline.hpp"
  32 #include "gc/shared/isGCActiveMark.hpp"
  33 #include "runtime/interfaceSupport.hpp"
  34 #include "runtime/os.hpp"
  35 #include "utilities/dtrace.hpp"
  36 
  37 //////////////////////////////////////////////////////////
  38 // Methods in abstract class VM_CMS_Operation
  39 //////////////////////////////////////////////////////////
  40 void VM_CMS_Operation::acquire_pending_list_lock() {
  41   // The caller may block while communicating
  42   // with the SLT thread in order to acquire/release the PLL.
  43   SurrogateLockerThread* slt = ConcurrentMarkSweepThread::slt();
  44   if (slt != NULL) {
  45     slt->manipulatePLL(SurrogateLockerThread::acquirePLL);
  46   } else {
  47     SurrogateLockerThread::report_missing_slt();
  48   }
  49 }
  50 
  51 void VM_CMS_Operation::release_and_notify_pending_list_lock() {
  52   // The caller may block while communicating
  53   // with the SLT thread in order to acquire/release the PLL.
  54   ConcurrentMarkSweepThread::slt()->
  55     manipulatePLL(SurrogateLockerThread::releaseAndNotifyPLL);
  56 }
  57 
  58 void VM_CMS_Operation::verify_before_gc() {
  59   if (VerifyBeforeGC &&
  60       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  61     GCTraceTime(Info, gc, verify) tm("Verify Before", _collector->_gc_timer_cm);
  62     HandleMark hm;
  63     FreelistLocker x(_collector);
  64     MutexLockerEx  y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag);
  65     GenCollectedHeap::heap()->prepare_for_verify();
  66     Universe::verify();
  67   }
  68 }
  69 
  70 void VM_CMS_Operation::verify_after_gc() {
  71   if (VerifyAfterGC &&
  72       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
  73     GCTraceTime(Info, gc, verify) tm("Verify After", _collector->_gc_timer_cm);
  74     HandleMark hm;
  75     FreelistLocker x(_collector);
  76     MutexLockerEx  y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag);
  77     Universe::verify();
  78   }
  79 }
  80 
  81 bool VM_CMS_Operation::lost_race() const {
  82   if (CMSCollector::abstract_state() == CMSCollector::Idling) {
  83     // We lost a race to a foreground collection
  84     // -- there's nothing to do
  85     return true;
  86   }
  87   assert(CMSCollector::abstract_state() == legal_state(),
  88          "Inconsistent collector state?");
  89   return false;
  90 }
  91 
  92 bool VM_CMS_Operation::doit_prologue() {
  93   assert(Thread::current()->is_ConcurrentGC_thread(), "just checking");


< prev index next >