40 #include "runtime/safepoint.hpp" |
40 #include "runtime/safepoint.hpp" |
41 #include "runtime/stubRoutines.hpp" |
41 #include "runtime/stubRoutines.hpp" |
42 #include "runtime/threadLocalStorage.hpp" |
42 #include "runtime/threadLocalStorage.hpp" |
43 #include "runtime/unhandledOops.hpp" |
43 #include "runtime/unhandledOops.hpp" |
44 #include "utilities/macros.hpp" |
44 #include "utilities/macros.hpp" |
45 |
|
46 #if INCLUDE_NMT |
|
47 #include "services/memRecorder.hpp" |
|
48 #endif // INCLUDE_NMT |
|
49 |
45 |
50 #include "trace/traceBackend.hpp" |
46 #include "trace/traceBackend.hpp" |
51 #include "trace/traceMacros.hpp" |
47 #include "trace/traceMacros.hpp" |
52 #include "utilities/exceptions.hpp" |
48 #include "utilities/exceptions.hpp" |
53 #include "utilities/top.hpp" |
49 #include "utilities/top.hpp" |
1057 void set_doing_unsafe_access(bool val) { _doing_unsafe_access = val; } |
1053 void set_doing_unsafe_access(bool val) { _doing_unsafe_access = val; } |
1058 |
1054 |
1059 bool do_not_unlock_if_synchronized() { return _do_not_unlock_if_synchronized; } |
1055 bool do_not_unlock_if_synchronized() { return _do_not_unlock_if_synchronized; } |
1060 void set_do_not_unlock_if_synchronized(bool val) { _do_not_unlock_if_synchronized = val; } |
1056 void set_do_not_unlock_if_synchronized(bool val) { _do_not_unlock_if_synchronized = val; } |
1061 |
1057 |
1062 #if INCLUDE_NMT |
|
1063 // native memory tracking |
|
1064 inline MemRecorder* get_recorder() const { return (MemRecorder*)_recorder; } |
|
1065 inline void set_recorder(MemRecorder* rc) { _recorder = rc; } |
|
1066 |
|
1067 private: |
|
1068 // per-thread memory recorder |
|
1069 MemRecorder* volatile _recorder; |
|
1070 #endif // INCLUDE_NMT |
|
1071 |
|
1072 // Suspend/resume support for JavaThread |
1058 // Suspend/resume support for JavaThread |
1073 private: |
1059 private: |
1074 void set_ext_suspended() { set_suspend_flag (_ext_suspended); } |
1060 void set_ext_suspended() { set_suspend_flag (_ext_suspended); } |
1075 void clear_ext_suspended() { clear_suspend_flag(_ext_suspended); } |
1061 void clear_ext_suspended() { clear_suspend_flag(_ext_suspended); } |
1076 |
1062 |
1509 ThreadProfiler* result = _thread_profiler; |
1495 ThreadProfiler* result = _thread_profiler; |
1510 _thread_profiler = tp; |
1496 _thread_profiler = tp; |
1511 return result; |
1497 return result; |
1512 } |
1498 } |
1513 |
1499 |
1514 // NMT (Native memory tracking) support. |
|
1515 // This flag helps NMT to determine if this JavaThread will be blocked |
|
1516 // at safepoint. If not, ThreadCritical is needed for writing memory records. |
|
1517 // JavaThread is only safepoint visible when it is in Threads' thread list, |
|
1518 // it is not visible until it is added to the list and becomes invisible |
|
1519 // once it is removed from the list. |
|
1520 public: |
|
1521 bool is_safepoint_visible() const { return _safepoint_visible; } |
|
1522 void set_safepoint_visible(bool visible) { _safepoint_visible = visible; } |
|
1523 private: |
|
1524 bool _safepoint_visible; |
|
1525 |
|
1526 // Static operations |
|
1527 public: |
1500 public: |
1528 // Returns the running thread as a JavaThread |
1501 // Returns the running thread as a JavaThread |
1529 static inline JavaThread* current(); |
1502 static inline JavaThread* current(); |
1530 |
1503 |
1531 // Returns the active Java thread. Do not use this if you know you are calling |
1504 // Returns the active Java thread. Do not use this if you know you are calling |