equal
deleted
inserted
replaced
24 |
24 |
25 #ifndef SHARE_VM_RUNTIME_THREAD_HPP |
25 #ifndef SHARE_VM_RUNTIME_THREAD_HPP |
26 #define SHARE_VM_RUNTIME_THREAD_HPP |
26 #define SHARE_VM_RUNTIME_THREAD_HPP |
27 |
27 |
28 #include "jni.h" |
28 #include "jni.h" |
|
29 #include "code/compiledMethod.hpp" |
29 #include "gc/shared/gcThreadLocalData.hpp" |
30 #include "gc/shared/gcThreadLocalData.hpp" |
30 #include "gc/shared/threadLocalAllocBuffer.hpp" |
31 #include "gc/shared/threadLocalAllocBuffer.hpp" |
31 #include "memory/allocation.hpp" |
32 #include "memory/allocation.hpp" |
32 #include "oops/oop.hpp" |
33 #include "oops/oop.hpp" |
33 #include "prims/jvmtiExport.hpp" |
34 #include "prims/jvmtiExport.hpp" |
38 #include "runtime/jniHandles.hpp" |
39 #include "runtime/jniHandles.hpp" |
39 #include "runtime/mutexLocker.hpp" |
40 #include "runtime/mutexLocker.hpp" |
40 #include "runtime/os.hpp" |
41 #include "runtime/os.hpp" |
41 #include "runtime/osThread.hpp" |
42 #include "runtime/osThread.hpp" |
42 #include "runtime/park.hpp" |
43 #include "runtime/park.hpp" |
43 #include "runtime/safepoint.hpp" |
|
44 #include "runtime/stubRoutines.hpp" |
44 #include "runtime/stubRoutines.hpp" |
45 #include "runtime/threadHeapSampler.hpp" |
45 #include "runtime/threadHeapSampler.hpp" |
46 #include "runtime/threadLocalStorage.hpp" |
46 #include "runtime/threadLocalStorage.hpp" |
47 #include "runtime/threadStatisticalInfo.hpp" |
47 #include "runtime/threadStatisticalInfo.hpp" |
48 #include "runtime/unhandledOops.hpp" |
48 #include "runtime/unhandledOops.hpp" |
992 |
992 |
993 // Safepoint support |
993 // Safepoint support |
994 public: // Expose _thread_state for SafeFetchInt() |
994 public: // Expose _thread_state for SafeFetchInt() |
995 volatile JavaThreadState _thread_state; |
995 volatile JavaThreadState _thread_state; |
996 private: |
996 private: |
997 ThreadSafepointState *_safepoint_state; // Holds information about a thread during a safepoint |
997 ThreadSafepointState* _safepoint_state; // Holds information about a thread during a safepoint |
998 address _saved_exception_pc; // Saved pc of instruction where last implicit exception happened |
998 address _saved_exception_pc; // Saved pc of instruction where last implicit exception happened |
999 |
999 |
1000 // JavaThread termination support |
1000 // JavaThread termination support |
1001 enum TerminatedTypes { |
1001 enum TerminatedTypes { |
1002 _not_terminated = 0xDEAD - 2, |
1002 _not_terminated = 0xDEAD - 2, |
1224 // Use membars when accessing volatile _thread_state. See |
1224 // Use membars when accessing volatile _thread_state. See |
1225 // Threads::create_vm() for size checks. |
1225 // Threads::create_vm() for size checks. |
1226 inline JavaThreadState thread_state() const; |
1226 inline JavaThreadState thread_state() const; |
1227 inline void set_thread_state(JavaThreadState s); |
1227 inline void set_thread_state(JavaThreadState s); |
1228 #endif |
1228 #endif |
1229 ThreadSafepointState *safepoint_state() const { return _safepoint_state; } |
1229 inline ThreadSafepointState* safepoint_state() const; |
1230 void set_safepoint_state(ThreadSafepointState *state) { _safepoint_state = state; } |
1230 inline void set_safepoint_state(ThreadSafepointState* state); |
1231 bool is_at_poll_safepoint() { return _safepoint_state->is_at_poll_safepoint(); } |
1231 inline bool is_at_poll_safepoint(); |
1232 |
1232 |
1233 // JavaThread termination and lifecycle support: |
1233 // JavaThread termination and lifecycle support: |
1234 void smr_delete(); |
1234 void smr_delete(); |
1235 bool on_thread_list() const { return _on_thread_list; } |
1235 bool on_thread_list() const { return _on_thread_list; } |
1236 void set_on_thread_list() { _on_thread_list = true; } |
1236 void set_on_thread_list() { _on_thread_list = true; } |
1749 } |
1749 } |
1750 |
1750 |
1751 // JNI critical regions. These can nest. |
1751 // JNI critical regions. These can nest. |
1752 bool in_critical() { return _jni_active_critical > 0; } |
1752 bool in_critical() { return _jni_active_critical > 0; } |
1753 bool in_last_critical() { return _jni_active_critical == 1; } |
1753 bool in_last_critical() { return _jni_active_critical == 1; } |
1754 void enter_critical() { |
1754 inline void enter_critical(); |
1755 assert(Thread::current() == this || |
|
1756 (Thread::current()->is_VM_thread() && |
|
1757 SafepointSynchronize::is_synchronizing()), |
|
1758 "this must be current thread or synchronizing"); |
|
1759 _jni_active_critical++; |
|
1760 } |
|
1761 void exit_critical() { |
1755 void exit_critical() { |
1762 assert(Thread::current() == this, "this must be current thread"); |
1756 assert(Thread::current() == this, "this must be current thread"); |
1763 _jni_active_critical--; |
1757 _jni_active_critical--; |
1764 assert(_jni_active_critical >= 0, "JNI critical nesting problem?"); |
1758 assert(_jni_active_critical >= 0, "JNI critical nesting problem?"); |
1765 } |
1759 } |