src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp

Print this page




   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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 class ConcurrentMarkSweepGeneration;
  26 class CMSCollector;
  27 
  28 // The Concurrent Mark Sweep GC Thread (could be several in the future).
  29 class ConcurrentMarkSweepThread: public ConcurrentGCThread {
  30   friend class VMStructs;
  31   friend class ConcurrentMarkSweepGeneration;   // XXX should remove friendship
  32   friend class CMSCollector;
  33  public:
  34   virtual void run();
  35 
  36  private:
  37   static ConcurrentMarkSweepThread*     _cmst;
  38   static CMSCollector*                  _collector;
  39   static SurrogateLockerThread*         _slt;
  40   static SurrogateLockerThread::SLT_msg_type _sltBuffer;
  41   static Monitor*                       _sltMonitor;
  42 
  43   ConcurrentMarkSweepThread*            _next;
  44 


 232 // looping (in "apparently endless loops") in CMS code.
 233 class CMSLoopCountWarn: public StackObj {
 234  private:
 235   const char* _src;
 236   const char* _msg;
 237   const intx  _threshold;
 238   intx        _ticks;
 239 
 240  public:
 241   inline CMSLoopCountWarn(const char* src, const char* msg,
 242                           const intx threshold) :
 243     _src(src), _msg(msg), _threshold(threshold), _ticks(0) { }
 244 
 245   inline void tick() {
 246     _ticks++;
 247     if (CMSLoopWarn && _ticks % _threshold == 0) {
 248       warning("%s has looped %d times %s", _src, _ticks, _msg);
 249     }
 250   }
 251 };




   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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 #ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CONCURRENTMARKSWEEPTHREAD_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CONCURRENTMARKSWEEPTHREAD_HPP
  27 
  28 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp"
  29 #include "gc_implementation/shared/concurrentGCThread.hpp"
  30 #ifdef TARGET_OS_FAMILY_linux
  31 # include "thread_linux.inline.hpp"
  32 #endif
  33 #ifdef TARGET_OS_FAMILY_solaris
  34 # include "thread_solaris.inline.hpp"
  35 #endif
  36 #ifdef TARGET_OS_FAMILY_windows
  37 # include "thread_windows.inline.hpp"
  38 #endif
  39 
  40 class ConcurrentMarkSweepGeneration;
  41 class CMSCollector;
  42 
  43 // The Concurrent Mark Sweep GC Thread (could be several in the future).
  44 class ConcurrentMarkSweepThread: public ConcurrentGCThread {
  45   friend class VMStructs;
  46   friend class ConcurrentMarkSweepGeneration;   // XXX should remove friendship
  47   friend class CMSCollector;
  48  public:
  49   virtual void run();
  50 
  51  private:
  52   static ConcurrentMarkSweepThread*     _cmst;
  53   static CMSCollector*                  _collector;
  54   static SurrogateLockerThread*         _slt;
  55   static SurrogateLockerThread::SLT_msg_type _sltBuffer;
  56   static Monitor*                       _sltMonitor;
  57 
  58   ConcurrentMarkSweepThread*            _next;
  59 


 247 // looping (in "apparently endless loops") in CMS code.
 248 class CMSLoopCountWarn: public StackObj {
 249  private:
 250   const char* _src;
 251   const char* _msg;
 252   const intx  _threshold;
 253   intx        _ticks;
 254 
 255  public:
 256   inline CMSLoopCountWarn(const char* src, const char* msg,
 257                           const intx threshold) :
 258     _src(src), _msg(msg), _threshold(threshold), _ticks(0) { }
 259 
 260   inline void tick() {
 261     _ticks++;
 262     if (CMSLoopWarn && _ticks % _threshold == 0) {
 263       warning("%s has looped %d times %s", _src, _ticks, _msg);
 264     }
 265   }
 266 };
 267 
 268 #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CONCURRENTMARKSWEEPTHREAD_HPP