29 #include "gc/shared/threadLocalAllocBuffer.hpp" |
29 #include "gc/shared/threadLocalAllocBuffer.hpp" |
30 #include "memory/allocation.hpp" |
30 #include "memory/allocation.hpp" |
31 #include "oops/oop.hpp" |
31 #include "oops/oop.hpp" |
32 #include "prims/jvmtiExport.hpp" |
32 #include "prims/jvmtiExport.hpp" |
33 #include "runtime/frame.hpp" |
33 #include "runtime/frame.hpp" |
|
34 #include "runtime/handshake.hpp" |
34 #include "runtime/javaFrameAnchor.hpp" |
35 #include "runtime/javaFrameAnchor.hpp" |
35 #include "runtime/jniHandles.hpp" |
36 #include "runtime/jniHandles.hpp" |
36 #include "runtime/mutexLocker.hpp" |
37 #include "runtime/mutexLocker.hpp" |
37 #include "runtime/os.hpp" |
38 #include "runtime/os.hpp" |
38 #include "runtime/osThread.hpp" |
39 #include "runtime/osThread.hpp" |
269 friend class NoAllocVerifier; |
270 friend class NoAllocVerifier; |
270 friend class NoSafepointVerifier; |
271 friend class NoSafepointVerifier; |
271 friend class PauseNoSafepointVerifier; |
272 friend class PauseNoSafepointVerifier; |
272 friend class GCLocker; |
273 friend class GCLocker; |
273 |
274 |
|
275 volatile void* _polling_page; // Thread local polling page |
|
276 |
274 ThreadLocalAllocBuffer _tlab; // Thread-local eden |
277 ThreadLocalAllocBuffer _tlab; // Thread-local eden |
275 jlong _allocated_bytes; // Cumulative number of bytes allocated on |
278 jlong _allocated_bytes; // Cumulative number of bytes allocated on |
276 // the Java heap |
279 // the Java heap |
277 |
280 |
278 mutable TRACE_DATA _trace_data; // Thread-local data for tracing |
281 mutable TRACE_DATA _trace_data; // Thread-local data for tracing |
547 address _stack_base; |
550 address _stack_base; |
548 size_t _stack_size; |
551 size_t _stack_size; |
549 uintptr_t _self_raw_id; // used by get_thread (mutable) |
552 uintptr_t _self_raw_id; // used by get_thread (mutable) |
550 int _lgrp_id; |
553 int _lgrp_id; |
551 |
554 |
|
555 volatile void** polling_page_addr() { return &_polling_page; } |
|
556 |
552 public: |
557 public: |
553 // Stack overflow support |
558 // Stack overflow support |
554 address stack_base() const { assert(_stack_base != NULL,"Sanity check"); return _stack_base; } |
559 address stack_base() const { assert(_stack_base != NULL,"Sanity check"); return _stack_base; } |
555 void set_stack_base(address base) { _stack_base = base; } |
560 void set_stack_base(address base) { _stack_base = base; } |
556 size_t stack_size() const { return _stack_size; } |
561 size_t stack_size() const { return _stack_size; } |
614 static ByteSize exception_line_offset() { return byte_offset_of(Thread, _exception_line); } |
619 static ByteSize exception_line_offset() { return byte_offset_of(Thread, _exception_line); } |
615 static ByteSize active_handles_offset() { return byte_offset_of(Thread, _active_handles); } |
620 static ByteSize active_handles_offset() { return byte_offset_of(Thread, _active_handles); } |
616 |
621 |
617 static ByteSize stack_base_offset() { return byte_offset_of(Thread, _stack_base); } |
622 static ByteSize stack_base_offset() { return byte_offset_of(Thread, _stack_base); } |
618 static ByteSize stack_size_offset() { return byte_offset_of(Thread, _stack_size); } |
623 static ByteSize stack_size_offset() { return byte_offset_of(Thread, _stack_size); } |
|
624 |
|
625 static ByteSize polling_page_offset() { return byte_offset_of(Thread, _polling_page); } |
619 |
626 |
620 #define TLAB_FIELD_OFFSET(name) \ |
627 #define TLAB_FIELD_OFFSET(name) \ |
621 static ByteSize tlab_##name##_offset() { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::name##_offset(); } |
628 static ByteSize tlab_##name##_offset() { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::name##_offset(); } |
622 |
629 |
623 TLAB_FIELD_OFFSET(start) |
630 TLAB_FIELD_OFFSET(start) |
1132 bool doing_unsafe_access() { return _doing_unsafe_access; } |
1139 bool doing_unsafe_access() { return _doing_unsafe_access; } |
1133 void set_doing_unsafe_access(bool val) { _doing_unsafe_access = val; } |
1140 void set_doing_unsafe_access(bool val) { _doing_unsafe_access = val; } |
1134 |
1141 |
1135 bool do_not_unlock_if_synchronized() { return _do_not_unlock_if_synchronized; } |
1142 bool do_not_unlock_if_synchronized() { return _do_not_unlock_if_synchronized; } |
1136 void set_do_not_unlock_if_synchronized(bool val) { _do_not_unlock_if_synchronized = val; } |
1143 void set_do_not_unlock_if_synchronized(bool val) { _do_not_unlock_if_synchronized = val; } |
|
1144 |
|
1145 inline void set_polling_page(void* poll_value); |
|
1146 inline volatile void* get_polling_page(); |
|
1147 |
|
1148 private: |
|
1149 // Support for thread handshake operations |
|
1150 HandshakeState _handshake; |
|
1151 public: |
|
1152 void set_handshake_operation(HandshakeOperation* op) { |
|
1153 _handshake.set_operation(this, op); |
|
1154 } |
|
1155 |
|
1156 bool has_handshake() const { |
|
1157 return _handshake.has_operation(); |
|
1158 } |
|
1159 |
|
1160 void cancel_handshake() { |
|
1161 _handshake.cancel(this); |
|
1162 } |
|
1163 |
|
1164 void handshake_process_by_self() { |
|
1165 _handshake.process_by_self(this); |
|
1166 } |
|
1167 |
|
1168 void handshake_process_by_vmthread() { |
|
1169 _handshake.process_by_vmthread(this); |
|
1170 } |
1137 |
1171 |
1138 // Suspend/resume support for JavaThread |
1172 // Suspend/resume support for JavaThread |
1139 private: |
1173 private: |
1140 inline void set_ext_suspended(); |
1174 inline void set_ext_suspended(); |
1141 inline void clear_ext_suspended(); |
1175 inline void clear_ext_suspended(); |