src/share/vm/runtime/thread.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 ThreadSafepointState;
  26 class ThreadProfiler;
  27 
  28 class JvmtiThreadState;
  29 class JvmtiGetLoadedClassesClosure;
  30 class ThreadStatistics;
  31 class ConcurrentLocksDump;
  32 class ParkEvent ;
  33 class Parker;
  34 
  35 class ciEnv;
  36 class CompileThread;
  37 class CompileLog;
  38 class CompileTask;
  39 class CompileQueue;
  40 class CompilerCounters;
  41 class vframeArray;
  42 
  43 class DeoptResourceMark;
  44 class jvmtiDeferredLocalVariableSet;


1497   // the SATB queue if the thread is created while a marking cycle is
1498   // in progress. The activation / de-activation of the SATB queues at
1499   // the beginning / end of a marking cycle is done during safepoints
1500   // so we have to make sure this method is called outside one to be
1501   // able to safely read the active field of the SATB queue set. Right
1502   // now, it is called just before the thread is added to the Java
1503   // thread list in the Threads::add() method. That method is holding
1504   // the Threads_lock which ensures we are outside a safepoint. We
1505   // cannot do the obvious and set the active field of the SATB queue
1506   // when the thread is created given that, in some cases, safepoints
1507   // might happen between the JavaThread constructor being called and the
1508   // thread being added to the Java thread list (an example of this is
1509   // when the structure for the DestroyJavaVM thread is created).
1510 #ifndef SERIALGC
1511   void initialize_queues();
1512 #else // !SERIALGC
1513   void initialize_queues() { }
1514 #endif // !SERIALGC
1515 
1516   // Machine dependent stuff
1517   #include "incls/_thread_pd.hpp.incl"


















1518 
1519  public:
1520   void set_blocked_on_compilation(bool value) {
1521     _blocked_on_compilation = value;
1522   }
1523 
1524   bool blocked_on_compilation() {
1525     return _blocked_on_compilation;
1526   }
1527  protected:
1528   bool         _blocked_on_compilation;
1529 
1530 
1531   // JSR166 per-thread parker
1532 private:
1533   Parker*    _parker;
1534 public:
1535   Parker*     parker() { return _parker; }
1536 
1537   // Biased locking support


1752 // Thread iterator
1753 class ThreadClosure: public StackObj {
1754  public:
1755   virtual void do_thread(Thread* thread) = 0;
1756 };
1757 
1758 class SignalHandlerMark: public StackObj {
1759 private:
1760   Thread* _thread;
1761 public:
1762   SignalHandlerMark(Thread* t) {
1763     _thread = t;
1764     if (_thread) _thread->enter_signal_handler();
1765   }
1766   ~SignalHandlerMark() {
1767     if (_thread) _thread->leave_signal_handler();
1768     _thread = NULL;
1769   }
1770 };
1771 




   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_RUNTIME_THREAD_HPP
  26 #define SHARE_VM_RUNTIME_THREAD_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "memory/threadLocalAllocBuffer.hpp"
  30 #include "oops/oop.hpp"
  31 #include "prims/jni.h"
  32 #include "prims/jvmtiExport.hpp"
  33 #include "runtime/frame.hpp"
  34 #include "runtime/javaFrameAnchor.hpp"
  35 #include "runtime/jniHandles.hpp"
  36 #include "runtime/mutexLocker.hpp"
  37 #include "runtime/os.hpp"
  38 #include "runtime/osThread.hpp"
  39 #include "runtime/park.hpp"
  40 #include "runtime/safepoint.hpp"
  41 #include "runtime/stubRoutines.hpp"
  42 #include "runtime/threadLocalStorage.hpp"
  43 #include "runtime/unhandledOops.hpp"
  44 #include "utilities/exceptions.hpp"
  45 #include "utilities/top.hpp"
  46 #ifndef SERIALGC
  47 #include "gc_implementation/g1/dirtyCardQueue.hpp"
  48 #include "gc_implementation/g1/satbQueue.hpp"
  49 #endif
  50 #ifdef ZERO
  51 #ifdef TARGET_ARCH_zero
  52 # include "stack_zero.hpp"
  53 #endif
  54 #endif
  55 
  56 class ThreadSafepointState;
  57 class ThreadProfiler;
  58 
  59 class JvmtiThreadState;
  60 class JvmtiGetLoadedClassesClosure;
  61 class ThreadStatistics;
  62 class ConcurrentLocksDump;
  63 class ParkEvent ;
  64 class Parker;
  65 
  66 class ciEnv;
  67 class CompileThread;
  68 class CompileLog;
  69 class CompileTask;
  70 class CompileQueue;
  71 class CompilerCounters;
  72 class vframeArray;
  73 
  74 class DeoptResourceMark;
  75 class jvmtiDeferredLocalVariableSet;


1528   // the SATB queue if the thread is created while a marking cycle is
1529   // in progress. The activation / de-activation of the SATB queues at
1530   // the beginning / end of a marking cycle is done during safepoints
1531   // so we have to make sure this method is called outside one to be
1532   // able to safely read the active field of the SATB queue set. Right
1533   // now, it is called just before the thread is added to the Java
1534   // thread list in the Threads::add() method. That method is holding
1535   // the Threads_lock which ensures we are outside a safepoint. We
1536   // cannot do the obvious and set the active field of the SATB queue
1537   // when the thread is created given that, in some cases, safepoints
1538   // might happen between the JavaThread constructor being called and the
1539   // thread being added to the Java thread list (an example of this is
1540   // when the structure for the DestroyJavaVM thread is created).
1541 #ifndef SERIALGC
1542   void initialize_queues();
1543 #else // !SERIALGC
1544   void initialize_queues() { }
1545 #endif // !SERIALGC
1546 
1547   // Machine dependent stuff
1548 #ifdef TARGET_OS_ARCH_linux_x86
1549 # include "thread_linux_x86.hpp"
1550 #endif
1551 #ifdef TARGET_OS_ARCH_linux_sparc
1552 # include "thread_linux_sparc.hpp"
1553 #endif
1554 #ifdef TARGET_OS_ARCH_linux_zero
1555 # include "thread_linux_zero.hpp"
1556 #endif
1557 #ifdef TARGET_OS_ARCH_solaris_x86
1558 # include "thread_solaris_x86.hpp"
1559 #endif
1560 #ifdef TARGET_OS_ARCH_solaris_sparc
1561 # include "thread_solaris_sparc.hpp"
1562 #endif
1563 #ifdef TARGET_OS_ARCH_windows_x86
1564 # include "thread_windows_x86.hpp"
1565 #endif
1566 
1567 
1568  public:
1569   void set_blocked_on_compilation(bool value) {
1570     _blocked_on_compilation = value;
1571   }
1572 
1573   bool blocked_on_compilation() {
1574     return _blocked_on_compilation;
1575   }
1576  protected:
1577   bool         _blocked_on_compilation;
1578 
1579 
1580   // JSR166 per-thread parker
1581 private:
1582   Parker*    _parker;
1583 public:
1584   Parker*     parker() { return _parker; }
1585 
1586   // Biased locking support


1801 // Thread iterator
1802 class ThreadClosure: public StackObj {
1803  public:
1804   virtual void do_thread(Thread* thread) = 0;
1805 };
1806 
1807 class SignalHandlerMark: public StackObj {
1808 private:
1809   Thread* _thread;
1810 public:
1811   SignalHandlerMark(Thread* t) {
1812     _thread = t;
1813     if (_thread) _thread->enter_signal_handler();
1814   }
1815   ~SignalHandlerMark() {
1816     if (_thread) _thread->leave_signal_handler();
1817     _thread = NULL;
1818   }
1819 };
1820 
1821 
1822 #endif // SHARE_VM_RUNTIME_THREAD_HPP