< prev index next >

src/hotspot/share/runtime/javaThread.hpp

Print this page

  44 #include "runtime/threadStatisticalInfo.hpp"
  45 #include "utilities/exceptions.hpp"
  46 #include "utilities/globalDefinitions.hpp"
  47 #include "utilities/macros.hpp"
  48 #if INCLUDE_JFR
  49 #include "jfr/support/jfrThreadExtension.hpp"
  50 #endif
  51 
  52 class AsyncExceptionHandshake;
  53 class ContinuationEntry;
  54 class DeoptResourceMark;
  55 class InternalOOMEMark;
  56 class JNIHandleBlock;
  57 class JVMCIRuntime;
  58 
  59 class JvmtiDeferredUpdates;
  60 class JvmtiSampledObjectAllocEventCollector;
  61 class JvmtiThreadState;
  62 
  63 class Metadata;

  64 class OopHandleList;
  65 class OopStorage;
  66 class OSThread;
  67 
  68 class ThreadsList;
  69 class ThreadSafepointState;
  70 class ThreadStatistics;
  71 
  72 class vframeArray;
  73 class vframe;
  74 class javaVFrame;
  75 
  76 class JavaThread;
  77 typedef void (*ThreadFunction)(JavaThread*, TRAPS);
  78 
  79 class JavaThread: public Thread {
  80   friend class VMStructs;
  81   friend class JVMCIVMStructs;
  82   friend class WhiteBox;
  83   friend class ThreadsSMRSupport; // to access _threadObj for exiting_threads_oops_do

1146 
1147 private:
1148   InstanceKlass* _class_to_be_initialized;
1149 
1150   // java.lang.Thread.sleep support
1151   ParkEvent * _SleepEvent;
1152 public:
1153   bool sleep(jlong millis);
1154   bool sleep_nanos(jlong nanos);
1155 
1156   // java.lang.Thread interruption support
1157   void interrupt();
1158   bool is_interrupted(bool clear_interrupted);
1159 
1160   // This is only for use by JVMTI RawMonitorWait. It emulates the actions of
1161   // the Java code in Object::wait which are not present in RawMonitorWait.
1162   bool get_and_clear_interrupted();
1163 
1164 private:
1165   LockStack _lock_stack;

1166 
1167 public:
1168   LockStack& lock_stack() { return _lock_stack; }
1169 
1170   static ByteSize lock_stack_offset()      { return byte_offset_of(JavaThread, _lock_stack); }
1171   // Those offsets are used in code generators to access the LockStack that is embedded in this
1172   // JavaThread structure. Those accesses are relative to the current thread, which
1173   // is typically in a dedicated register.
1174   static ByteSize lock_stack_top_offset()  { return lock_stack_offset() + LockStack::top_offset(); }
1175   static ByteSize lock_stack_base_offset() { return lock_stack_offset() + LockStack::base_offset(); }
1176 








1177   static OopStorage* thread_oop_storage();
1178 
1179   static void verify_cross_modify_fence_failure(JavaThread *thread) PRODUCT_RETURN;
1180 
1181   // Helper function to create the java.lang.Thread object for a
1182   // VM-internal thread. The thread will have the given name and be
1183   // part of the System ThreadGroup.
1184   static Handle create_system_thread_object(const char* name, TRAPS);
1185 
1186   // Helper function to start a VM-internal daemon thread.
1187   // E.g. ServiceThread, NotificationThread, CompilerThread etc.
1188   static void start_internal_daemon(JavaThread* current, JavaThread* target,
1189                                     Handle thread_oop, ThreadPriority prio);
1190 
1191   // Helper function to do vm_exit_on_initialization for osthread
1192   // resource allocation failure.
1193   static void vm_exit_on_osthread_failure(JavaThread* thread);
1194 
1195   // Deferred OopHandle release support
1196  private:

  44 #include "runtime/threadStatisticalInfo.hpp"
  45 #include "utilities/exceptions.hpp"
  46 #include "utilities/globalDefinitions.hpp"
  47 #include "utilities/macros.hpp"
  48 #if INCLUDE_JFR
  49 #include "jfr/support/jfrThreadExtension.hpp"
  50 #endif
  51 
  52 class AsyncExceptionHandshake;
  53 class ContinuationEntry;
  54 class DeoptResourceMark;
  55 class InternalOOMEMark;
  56 class JNIHandleBlock;
  57 class JVMCIRuntime;
  58 
  59 class JvmtiDeferredUpdates;
  60 class JvmtiSampledObjectAllocEventCollector;
  61 class JvmtiThreadState;
  62 
  63 class Metadata;
  64 class ObjectMonitor;
  65 class OopHandleList;
  66 class OopStorage;
  67 class OSThread;
  68 
  69 class ThreadsList;
  70 class ThreadSafepointState;
  71 class ThreadStatistics;
  72 
  73 class vframeArray;
  74 class vframe;
  75 class javaVFrame;
  76 
  77 class JavaThread;
  78 typedef void (*ThreadFunction)(JavaThread*, TRAPS);
  79 
  80 class JavaThread: public Thread {
  81   friend class VMStructs;
  82   friend class JVMCIVMStructs;
  83   friend class WhiteBox;
  84   friend class ThreadsSMRSupport; // to access _threadObj for exiting_threads_oops_do

1147 
1148 private:
1149   InstanceKlass* _class_to_be_initialized;
1150 
1151   // java.lang.Thread.sleep support
1152   ParkEvent * _SleepEvent;
1153 public:
1154   bool sleep(jlong millis);
1155   bool sleep_nanos(jlong nanos);
1156 
1157   // java.lang.Thread interruption support
1158   void interrupt();
1159   bool is_interrupted(bool clear_interrupted);
1160 
1161   // This is only for use by JVMTI RawMonitorWait. It emulates the actions of
1162   // the Java code in Object::wait which are not present in RawMonitorWait.
1163   bool get_and_clear_interrupted();
1164 
1165 private:
1166   LockStack _lock_stack;
1167   OMCache _om_cache;
1168 
1169 public:
1170   LockStack& lock_stack() { return _lock_stack; }
1171 
1172   static ByteSize lock_stack_offset()      { return byte_offset_of(JavaThread, _lock_stack); }
1173   // Those offsets are used in code generators to access the LockStack that is embedded in this
1174   // JavaThread structure. Those accesses are relative to the current thread, which
1175   // is typically in a dedicated register.
1176   static ByteSize lock_stack_top_offset()  { return lock_stack_offset() + LockStack::top_offset(); }
1177   static ByteSize lock_stack_base_offset() { return lock_stack_offset() + LockStack::base_offset(); }
1178 
1179 
1180   static ByteSize om_cache_offset()        { return byte_offset_of(JavaThread, _om_cache); }
1181   static ByteSize om_cache_oops_offset()   { return om_cache_offset() + OMCache::entries_offset(); }
1182 
1183   void om_set_monitor_cache(ObjectMonitor* monitor);
1184   void om_clear_monitor_cache();
1185   ObjectMonitor* om_get_from_monitor_cache(oop obj);
1186 
1187   static OopStorage* thread_oop_storage();
1188 
1189   static void verify_cross_modify_fence_failure(JavaThread *thread) PRODUCT_RETURN;
1190 
1191   // Helper function to create the java.lang.Thread object for a
1192   // VM-internal thread. The thread will have the given name and be
1193   // part of the System ThreadGroup.
1194   static Handle create_system_thread_object(const char* name, TRAPS);
1195 
1196   // Helper function to start a VM-internal daemon thread.
1197   // E.g. ServiceThread, NotificationThread, CompilerThread etc.
1198   static void start_internal_daemon(JavaThread* current, JavaThread* target,
1199                                     Handle thread_oop, ThreadPriority prio);
1200 
1201   // Helper function to do vm_exit_on_initialization for osthread
1202   // resource allocation failure.
1203   static void vm_exit_on_osthread_failure(JavaThread* thread);
1204 
1205   // Deferred OopHandle release support
1206  private:
< prev index next >