< prev index next >

src/share/vm/gc/cms/concurrentMarkSweepThread.hpp

Print this page
rev 8362 : 8079792: GC directory structure cleanup
Reviewed-by:
   1 /*
   2  * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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 #include "runtime/thread.hpp"
  31 
  32 class ConcurrentMarkSweepGeneration;
  33 class CMSCollector;
  34 
  35 // The Concurrent Mark Sweep GC Thread
  36 class ConcurrentMarkSweepThread: public ConcurrentGCThread {
  37   friend class VMStructs;
  38   friend class ConcurrentMarkSweepGeneration;   // XXX should remove friendship
  39   friend class CMSCollector;
  40  public:
  41   virtual void run();
  42 
  43  private:
  44   static ConcurrentMarkSweepThread*     _cmst;
  45   static CMSCollector*                  _collector;
  46   static SurrogateLockerThread*         _slt;
  47   static SurrogateLockerThread::SLT_msg_type _sltBuffer;
  48   static Monitor*                       _sltMonitor;
  49 


 161 class CMSLoopCountWarn: public StackObj {
 162  private:
 163   const char* _src;
 164   const char* _msg;
 165   const intx  _threshold;
 166   intx        _ticks;
 167 
 168  public:
 169   inline CMSLoopCountWarn(const char* src, const char* msg,
 170                           const intx threshold) :
 171     _src(src), _msg(msg), _threshold(threshold), _ticks(0) { }
 172 
 173   inline void tick() {
 174     _ticks++;
 175     if (CMSLoopWarn && _ticks % _threshold == 0) {
 176       warning("%s has looped " INTX_FORMAT " times %s", _src, _ticks, _msg);
 177     }
 178   }
 179 };
 180 
 181 #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CONCURRENTMARKSWEEPTHREAD_HPP
   1 /*
   2  * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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_CMS_CONCURRENTMARKSWEEPTHREAD_HPP
  26 #define SHARE_VM_GC_CMS_CONCURRENTMARKSWEEPTHREAD_HPP
  27 
  28 #include "gc/cms/concurrentMarkSweepGeneration.hpp"
  29 #include "gc/shared/concurrentGCThread.hpp"
  30 #include "runtime/thread.hpp"
  31 
  32 class ConcurrentMarkSweepGeneration;
  33 class CMSCollector;
  34 
  35 // The Concurrent Mark Sweep GC Thread
  36 class ConcurrentMarkSweepThread: public ConcurrentGCThread {
  37   friend class VMStructs;
  38   friend class ConcurrentMarkSweepGeneration;   // XXX should remove friendship
  39   friend class CMSCollector;
  40  public:
  41   virtual void run();
  42 
  43  private:
  44   static ConcurrentMarkSweepThread*     _cmst;
  45   static CMSCollector*                  _collector;
  46   static SurrogateLockerThread*         _slt;
  47   static SurrogateLockerThread::SLT_msg_type _sltBuffer;
  48   static Monitor*                       _sltMonitor;
  49 


 161 class CMSLoopCountWarn: public StackObj {
 162  private:
 163   const char* _src;
 164   const char* _msg;
 165   const intx  _threshold;
 166   intx        _ticks;
 167 
 168  public:
 169   inline CMSLoopCountWarn(const char* src, const char* msg,
 170                           const intx threshold) :
 171     _src(src), _msg(msg), _threshold(threshold), _ticks(0) { }
 172 
 173   inline void tick() {
 174     _ticks++;
 175     if (CMSLoopWarn && _ticks % _threshold == 0) {
 176       warning("%s has looped " INTX_FORMAT " times %s", _src, _ticks, _msg);
 177     }
 178   }
 179 };
 180 
 181 #endif // SHARE_VM_GC_CMS_CONCURRENTMARKSWEEPTHREAD_HPP
< prev index next >