src/share/vm/runtime/thread.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot-npg Sdiff src/share/vm/runtime

src/share/vm/runtime/thread.hpp

Print this page




  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 "services/memRecorder.hpp"


  45 #include "trace/tracing.hpp"
  46 #include "utilities/exceptions.hpp"
  47 #include "utilities/top.hpp"
  48 #ifndef SERIALGC
  49 #include "gc_implementation/g1/dirtyCardQueue.hpp"
  50 #include "gc_implementation/g1/satbQueue.hpp"
  51 #endif
  52 #ifdef ZERO
  53 #ifdef TARGET_ARCH_zero
  54 # include "stack_zero.hpp"
  55 #endif
  56 #endif
  57 
  58 class ThreadSafepointState;
  59 class ThreadProfiler;
  60 
  61 class JvmtiThreadState;
  62 class JvmtiGetLoadedClassesClosure;
  63 class ThreadStatistics;
  64 class ConcurrentLocksDump;


1021   void set_safepoint_state(ThreadSafepointState *state) { _safepoint_state = state; }
1022   bool is_at_poll_safepoint()                    { return _safepoint_state->is_at_poll_safepoint(); }
1023 
1024   // thread has called JavaThread::exit() or is terminated
1025   bool is_exiting()                              { return _terminated == _thread_exiting || is_terminated(); }
1026   // thread is terminated (no longer on the threads list); we compare
1027   // against the two non-terminated values so that a freed JavaThread
1028   // will also be considered terminated.
1029   bool is_terminated()                           { return _terminated != _not_terminated && _terminated != _thread_exiting; }
1030   void set_terminated(TerminatedTypes t)         { _terminated = t; }
1031   // special for Threads::remove() which is static:
1032   void set_terminated_value()                    { _terminated = _thread_terminated; }
1033   void block_if_vm_exited();
1034 
1035   bool doing_unsafe_access()                     { return _doing_unsafe_access; }
1036   void set_doing_unsafe_access(bool val)         { _doing_unsafe_access = val; }
1037 
1038   bool do_not_unlock_if_synchronized()             { return _do_not_unlock_if_synchronized; }
1039   void set_do_not_unlock_if_synchronized(bool val) { _do_not_unlock_if_synchronized = val; }
1040 

1041   // native memory tracking
1042   inline MemRecorder* get_recorder() const          { return (MemRecorder*)_recorder; }
1043   inline void         set_recorder(MemRecorder* rc) { _recorder = (volatile MemRecorder*)rc; }
1044 
1045  private:
1046   // per-thread memory recorder
1047   volatile MemRecorder* _recorder;

1048 
1049   // Suspend/resume support for JavaThread
1050  private:
1051   void set_ext_suspended()       { set_suspend_flag (_ext_suspended);  }
1052   void clear_ext_suspended()     { clear_suspend_flag(_ext_suspended); }
1053 
1054  public:
1055   void java_suspend();
1056   void java_resume();
1057   int  java_suspend_self();
1058 
1059   void check_and_wait_while_suspended() {
1060     assert(JavaThread::current() == this, "sanity check");
1061 
1062     bool do_self_suspend;
1063     do {
1064       // were we externally suspended while we were waiting?
1065       do_self_suspend = handle_special_suspend_equivalent_condition();
1066       if (do_self_suspend) {
1067         // don't surprise the thread that suspended us by returning




  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 
  45 #if INCLUDE_NMT
  46 #include "services/memRecorder.hpp"
  47 #endif // INCLUDE_NMT
  48 
  49 #include "trace/tracing.hpp"
  50 #include "utilities/exceptions.hpp"
  51 #include "utilities/top.hpp"
  52 #ifndef SERIALGC
  53 #include "gc_implementation/g1/dirtyCardQueue.hpp"
  54 #include "gc_implementation/g1/satbQueue.hpp"
  55 #endif
  56 #ifdef ZERO
  57 #ifdef TARGET_ARCH_zero
  58 # include "stack_zero.hpp"
  59 #endif
  60 #endif
  61 
  62 class ThreadSafepointState;
  63 class ThreadProfiler;
  64 
  65 class JvmtiThreadState;
  66 class JvmtiGetLoadedClassesClosure;
  67 class ThreadStatistics;
  68 class ConcurrentLocksDump;


1025   void set_safepoint_state(ThreadSafepointState *state) { _safepoint_state = state; }
1026   bool is_at_poll_safepoint()                    { return _safepoint_state->is_at_poll_safepoint(); }
1027 
1028   // thread has called JavaThread::exit() or is terminated
1029   bool is_exiting()                              { return _terminated == _thread_exiting || is_terminated(); }
1030   // thread is terminated (no longer on the threads list); we compare
1031   // against the two non-terminated values so that a freed JavaThread
1032   // will also be considered terminated.
1033   bool is_terminated()                           { return _terminated != _not_terminated && _terminated != _thread_exiting; }
1034   void set_terminated(TerminatedTypes t)         { _terminated = t; }
1035   // special for Threads::remove() which is static:
1036   void set_terminated_value()                    { _terminated = _thread_terminated; }
1037   void block_if_vm_exited();
1038 
1039   bool doing_unsafe_access()                     { return _doing_unsafe_access; }
1040   void set_doing_unsafe_access(bool val)         { _doing_unsafe_access = val; }
1041 
1042   bool do_not_unlock_if_synchronized()             { return _do_not_unlock_if_synchronized; }
1043   void set_do_not_unlock_if_synchronized(bool val) { _do_not_unlock_if_synchronized = val; }
1044 
1045 #if INCLUDE_NMT
1046   // native memory tracking
1047   inline MemRecorder* get_recorder() const          { return (MemRecorder*)_recorder; }
1048   inline void         set_recorder(MemRecorder* rc) { _recorder = (volatile MemRecorder*)rc; }
1049 
1050  private:
1051   // per-thread memory recorder
1052   volatile MemRecorder* _recorder;
1053 #endif // INCLUDE_NMT
1054 
1055   // Suspend/resume support for JavaThread
1056  private:
1057   void set_ext_suspended()       { set_suspend_flag (_ext_suspended);  }
1058   void clear_ext_suspended()     { clear_suspend_flag(_ext_suspended); }
1059 
1060  public:
1061   void java_suspend();
1062   void java_resume();
1063   int  java_suspend_self();
1064 
1065   void check_and_wait_while_suspended() {
1066     assert(JavaThread::current() == this, "sanity check");
1067 
1068     bool do_self_suspend;
1069     do {
1070       // were we externally suspended while we were waiting?
1071       do_self_suspend = handle_special_suspend_equivalent_condition();
1072       if (do_self_suspend) {
1073         // don't surprise the thread that suspended us by returning


src/share/vm/runtime/thread.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File