125 // - this->pre_run() // virtual per-thread-type initialization
126 // - this->run() // virtual per-thread-type "main" logic
127 // - shared common tear-down
128 // - this->post_run() // virtual per-thread-type tear-down
129 // - // 'this' no longer referenceable
130 // - OS-level tear-down (minimal)
131 // - final logging
132 //
133 // For JavaThread:
134 // - this->run() // virtual but not normally overridden
135 // - this->thread_main_inner() // extra call level to ensure correct stack calculations
136 // - this->entry_point() // set differently for each kind of JavaThread
137
138 class Thread: public ThreadShadow {
139 friend class VMStructs;
140 friend class JVMCIVMStructs;
141 private:
142
143 #ifndef USE_LIBRARY_BASED_TLS_ONLY
144 // Current thread is maintained as a thread-local variable
145 static THREAD_LOCAL_DECL Thread* _thr_current;
146 #endif
147
148 // Thread local data area available to the GC. The internal
149 // structure and contents of this data area is GC-specific.
150 // Only GC and GC barrier code should access this data area.
151 GCThreadLocalData _gc_data;
152
153 public:
154 static ByteSize gc_data_offset() {
155 return byte_offset_of(Thread, _gc_data);
156 }
157
158 template <typename T> T* gc_data() {
159 STATIC_ASSERT(sizeof(T) <= sizeof(_gc_data));
160 return reinterpret_cast<T*>(&_gc_data);
161 }
162
163 // Exception handling
164 // (Note: _pending_exception and friends are in ThreadShadow)
165 //oop _pending_exception; // pending exception for current thread
|
125 // - this->pre_run() // virtual per-thread-type initialization
126 // - this->run() // virtual per-thread-type "main" logic
127 // - shared common tear-down
128 // - this->post_run() // virtual per-thread-type tear-down
129 // - // 'this' no longer referenceable
130 // - OS-level tear-down (minimal)
131 // - final logging
132 //
133 // For JavaThread:
134 // - this->run() // virtual but not normally overridden
135 // - this->thread_main_inner() // extra call level to ensure correct stack calculations
136 // - this->entry_point() // set differently for each kind of JavaThread
137
138 class Thread: public ThreadShadow {
139 friend class VMStructs;
140 friend class JVMCIVMStructs;
141 private:
142
143 #ifndef USE_LIBRARY_BASED_TLS_ONLY
144 // Current thread is maintained as a thread-local variable
145 static THREAD_LOCAL Thread* _thr_current;
146 #endif
147
148 // Thread local data area available to the GC. The internal
149 // structure and contents of this data area is GC-specific.
150 // Only GC and GC barrier code should access this data area.
151 GCThreadLocalData _gc_data;
152
153 public:
154 static ByteSize gc_data_offset() {
155 return byte_offset_of(Thread, _gc_data);
156 }
157
158 template <typename T> T* gc_data() {
159 STATIC_ASSERT(sizeof(T) <= sizeof(_gc_data));
160 return reinterpret_cast<T*>(&_gc_data);
161 }
162
163 // Exception handling
164 // (Note: _pending_exception and friends are in ThreadShadow)
165 //oop _pending_exception; // pending exception for current thread
|