hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
changeset 8684 7ebbd0b3e295
parent 7397 5b173b4ca846
child 11601 f359304c1856
equal deleted inserted replaced
8683:9d31cebc0f6e 8684:7ebbd0b3e295
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    49 int  ConcurrentMarkSweepThread::_CMS_flag         = CMS_nil;
    49 int  ConcurrentMarkSweepThread::_CMS_flag         = CMS_nil;
    50 
    50 
    51 volatile jint ConcurrentMarkSweepThread::_pending_yields      = 0;
    51 volatile jint ConcurrentMarkSweepThread::_pending_yields      = 0;
    52 volatile jint ConcurrentMarkSweepThread::_pending_decrements  = 0;
    52 volatile jint ConcurrentMarkSweepThread::_pending_decrements  = 0;
    53 
    53 
    54 volatile bool ConcurrentMarkSweepThread::_icms_enabled   = false;
    54 volatile jint ConcurrentMarkSweepThread::_icms_disabled   = 0;
    55 volatile bool ConcurrentMarkSweepThread::_should_run     = false;
    55 volatile bool ConcurrentMarkSweepThread::_should_run     = false;
    56 // When icms is enabled, the icms thread is stopped until explicitly
    56 // When icms is enabled, the icms thread is stopped until explicitly
    57 // started.
    57 // started.
    58 volatile bool ConcurrentMarkSweepThread::_should_stop    = true;
    58 volatile bool ConcurrentMarkSweepThread::_should_stop    = true;
    59 
    59 
    82     if (!DisableStartThread) {
    82     if (!DisableStartThread) {
    83       os::start_thread(this);
    83       os::start_thread(this);
    84     }
    84     }
    85   }
    85   }
    86   _sltMonitor = SLT_lock;
    86   _sltMonitor = SLT_lock;
    87   set_icms_enabled(CMSIncrementalMode);
    87   assert(!CMSIncrementalMode || icms_is_enabled(), "Error");
    88 }
    88 }
    89 
    89 
    90 void ConcurrentMarkSweepThread::run() {
    90 void ConcurrentMarkSweepThread::run() {
    91   assert(this == cmst(), "just checking");
    91   assert(this == cmst(), "just checking");
    92 
    92 
   339   }
   339   }
   340 }
   340 }
   341 
   341 
   342 void ConcurrentMarkSweepThread::icms_wait() {
   342 void ConcurrentMarkSweepThread::icms_wait() {
   343   assert(UseConcMarkSweepGC && CMSIncrementalMode, "just checking");
   343   assert(UseConcMarkSweepGC && CMSIncrementalMode, "just checking");
   344   if (_should_stop && icms_enabled()) {
   344   if (_should_stop && icms_is_enabled()) {
   345     MutexLockerEx x(iCMS_lock, Mutex::_no_safepoint_check_flag);
   345     MutexLockerEx x(iCMS_lock, Mutex::_no_safepoint_check_flag);
   346     trace_state("pause_icms");
   346     trace_state("pause_icms");
   347     _collector->stats().stop_cms_timer();
   347     _collector->stats().stop_cms_timer();
   348     while(!_should_run && icms_enabled()) {
   348     while(!_should_run && icms_is_enabled()) {
   349       iCMS_lock->wait(Mutex::_no_safepoint_check_flag);
   349       iCMS_lock->wait(Mutex::_no_safepoint_check_flag);
   350     }
   350     }
   351     _collector->stats().start_cms_timer();
   351     _collector->stats().start_cms_timer();
   352     _should_stop = false;
   352     _should_stop = false;
   353     trace_state("pause_icms end");
   353     trace_state("pause_icms end");