< prev index next >

src/hotspot/share/runtime/thread.hpp

Print this page




 772   static ByteSize active_handles_offset()        { return byte_offset_of(Thread, _active_handles); }
 773 
 774   static ByteSize stack_base_offset()            { return byte_offset_of(Thread, _stack_base); }
 775   static ByteSize stack_size_offset()            { return byte_offset_of(Thread, _stack_size); }
 776 
 777   static ByteSize polling_page_offset()          { return byte_offset_of(Thread, _polling_page); }
 778 
 779   static ByteSize tlab_start_offset()            { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::start_offset(); }
 780   static ByteSize tlab_end_offset()              { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::end_offset(); }
 781   static ByteSize tlab_top_offset()              { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::top_offset(); }
 782   static ByteSize tlab_pf_top_offset()           { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::pf_top_offset(); }
 783 
 784   static ByteSize allocated_bytes_offset()       { return byte_offset_of(Thread, _allocated_bytes); }
 785 
 786   JFR_ONLY(DEFINE_THREAD_LOCAL_OFFSET_JFR;)
 787 
 788  public:
 789   volatile intptr_t _Stalled;
 790   volatile int _TypeTag;
 791   ParkEvent * _ParkEvent;                     // for synchronized()
 792   ParkEvent * _SleepEvent;                    // for Thread.sleep
 793   ParkEvent * _MuxEvent;                      // for low-level muxAcquire-muxRelease
 794   int NativeSyncRecursion;                    // diagnostic
 795 
 796   volatile int _OnTrap;                       // Resume-at IP delta
 797   jint _hashStateW;                           // Marsaglia Shift-XOR thread-local RNG
 798   jint _hashStateX;                           // thread-specific hashCode generator state
 799   jint _hashStateY;
 800   jint _hashStateZ;
 801 
 802   // Low-level leaf-lock primitives used to implement synchronization
 803   // and native monitor-mutex infrastructure.
 804   // Not for general synchronization use.
 805   static void SpinAcquire(volatile int * Lock, const char * Name);
 806   static void SpinRelease(volatile int * Lock);
 807   static void muxAcquire(volatile intptr_t * Lock, const char * Name);
 808   static void muxAcquireW(volatile intptr_t * Lock, ParkEvent * ev);
 809   static void muxRelease(volatile intptr_t * Lock);
 810 };
 811 
 812 // Inline implementation of Thread::current()


2038  private:
2039   GrowableArray<MonitorInfo*>* _cached_monitor_info;
2040  public:
2041   GrowableArray<MonitorInfo*>* cached_monitor_info() { return _cached_monitor_info; }
2042   void set_cached_monitor_info(GrowableArray<MonitorInfo*>* info) { _cached_monitor_info = info; }
2043 
2044   // clearing/querying jni attach status
2045   bool is_attaching_via_jni() const { return _jni_attach_state == _attaching_via_jni; }
2046   bool has_attached_via_jni() const { return is_attaching_via_jni() || _jni_attach_state == _attached_via_jni; }
2047   inline void set_done_attaching_via_jni();
2048 
2049   // Stack dump assistance:
2050   // Track the class we want to initialize but for which we have to wait
2051   // on its init_lock() because it is already being initialized.
2052   void set_class_to_be_initialized(InstanceKlass* k);
2053   InstanceKlass* class_to_be_initialized() const;
2054 
2055 private:
2056   InstanceKlass* _class_to_be_initialized;
2057 




2058 };
2059 
2060 // Inline implementation of JavaThread::current
2061 inline JavaThread* JavaThread::current() {
2062   Thread* thread = Thread::current();
2063   assert(thread->is_Java_thread(), "just checking");
2064   return (JavaThread*)thread;
2065 }
2066 
2067 inline CompilerThread* JavaThread::as_CompilerThread() {
2068   assert(is_Compiler_thread(), "just checking");
2069   return (CompilerThread*)this;
2070 }
2071 
2072 // Dedicated thread to sweep the code cache
2073 class CodeCacheSweeperThread : public JavaThread {
2074   CompiledMethod*       _scanned_compiled_method; // nmethod being scanned by the sweeper
2075  public:
2076   CodeCacheSweeperThread();
2077   // Track the nmethod currently being scanned by the sweeper




 772   static ByteSize active_handles_offset()        { return byte_offset_of(Thread, _active_handles); }
 773 
 774   static ByteSize stack_base_offset()            { return byte_offset_of(Thread, _stack_base); }
 775   static ByteSize stack_size_offset()            { return byte_offset_of(Thread, _stack_size); }
 776 
 777   static ByteSize polling_page_offset()          { return byte_offset_of(Thread, _polling_page); }
 778 
 779   static ByteSize tlab_start_offset()            { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::start_offset(); }
 780   static ByteSize tlab_end_offset()              { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::end_offset(); }
 781   static ByteSize tlab_top_offset()              { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::top_offset(); }
 782   static ByteSize tlab_pf_top_offset()           { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::pf_top_offset(); }
 783 
 784   static ByteSize allocated_bytes_offset()       { return byte_offset_of(Thread, _allocated_bytes); }
 785 
 786   JFR_ONLY(DEFINE_THREAD_LOCAL_OFFSET_JFR;)
 787 
 788  public:
 789   volatile intptr_t _Stalled;
 790   volatile int _TypeTag;
 791   ParkEvent * _ParkEvent;                     // for synchronized()

 792   ParkEvent * _MuxEvent;                      // for low-level muxAcquire-muxRelease
 793   int NativeSyncRecursion;                    // diagnostic
 794 
 795   volatile int _OnTrap;                       // Resume-at IP delta
 796   jint _hashStateW;                           // Marsaglia Shift-XOR thread-local RNG
 797   jint _hashStateX;                           // thread-specific hashCode generator state
 798   jint _hashStateY;
 799   jint _hashStateZ;
 800 
 801   // Low-level leaf-lock primitives used to implement synchronization
 802   // and native monitor-mutex infrastructure.
 803   // Not for general synchronization use.
 804   static void SpinAcquire(volatile int * Lock, const char * Name);
 805   static void SpinRelease(volatile int * Lock);
 806   static void muxAcquire(volatile intptr_t * Lock, const char * Name);
 807   static void muxAcquireW(volatile intptr_t * Lock, ParkEvent * ev);
 808   static void muxRelease(volatile intptr_t * Lock);
 809 };
 810 
 811 // Inline implementation of Thread::current()


2037  private:
2038   GrowableArray<MonitorInfo*>* _cached_monitor_info;
2039  public:
2040   GrowableArray<MonitorInfo*>* cached_monitor_info() { return _cached_monitor_info; }
2041   void set_cached_monitor_info(GrowableArray<MonitorInfo*>* info) { _cached_monitor_info = info; }
2042 
2043   // clearing/querying jni attach status
2044   bool is_attaching_via_jni() const { return _jni_attach_state == _attaching_via_jni; }
2045   bool has_attached_via_jni() const { return is_attaching_via_jni() || _jni_attach_state == _attached_via_jni; }
2046   inline void set_done_attaching_via_jni();
2047 
2048   // Stack dump assistance:
2049   // Track the class we want to initialize but for which we have to wait
2050   // on its init_lock() because it is already being initialized.
2051   void set_class_to_be_initialized(InstanceKlass* k);
2052   InstanceKlass* class_to_be_initialized() const;
2053 
2054 private:
2055   InstanceKlass* _class_to_be_initialized;
2056 
2057   // java.lang.Thread.sleep support
2058 public:
2059   ParkEvent * _SleepEvent;
2060   bool sleep(jlong millis);
2061 };
2062 
2063 // Inline implementation of JavaThread::current
2064 inline JavaThread* JavaThread::current() {
2065   Thread* thread = Thread::current();
2066   assert(thread->is_Java_thread(), "just checking");
2067   return (JavaThread*)thread;
2068 }
2069 
2070 inline CompilerThread* JavaThread::as_CompilerThread() {
2071   assert(is_Compiler_thread(), "just checking");
2072   return (CompilerThread*)this;
2073 }
2074 
2075 // Dedicated thread to sweep the code cache
2076 class CodeCacheSweeperThread : public JavaThread {
2077   CompiledMethod*       _scanned_compiled_method; // nmethod being scanned by the sweeper
2078  public:
2079   CodeCacheSweeperThread();
2080   // Track the nmethod currently being scanned by the sweeper


< prev index next >