911 stack_guard_enabled // enabled |
911 stack_guard_enabled // enabled |
912 }; |
912 }; |
913 |
913 |
914 private: |
914 private: |
915 |
915 |
916 StackGuardState _stack_guard_state; |
916 StackGuardState _stack_guard_state; |
|
917 |
|
918 // Precompute the limit of the stack as used in stack overflow checks. |
|
919 // We load it from here to simplify the stack overflow check in assembly. |
|
920 address _stack_overflow_limit; |
917 |
921 |
918 // Compiler exception handling (NOTE: The _exception_oop is *NOT* the same as _pending_exception. It is |
922 // Compiler exception handling (NOTE: The _exception_oop is *NOT* the same as _pending_exception. It is |
919 // used to temp. parsing values into and out of the runtime system during exception handling for compiled |
923 // used to temp. parsing values into and out of the runtime system during exception handling for compiled |
920 // code) |
924 // code) |
921 volatile oop _exception_oop; // Exception thrown in compiled code |
925 volatile oop _exception_oop; // Exception thrown in compiled code |
1027 // Allocates a new Java level thread object for this thread. thread_name may be NULL. |
1031 // Allocates a new Java level thread object for this thread. thread_name may be NULL. |
1028 void allocate_threadObj(Handle thread_group, char* thread_name, bool daemon, TRAPS); |
1032 void allocate_threadObj(Handle thread_group, char* thread_name, bool daemon, TRAPS); |
1029 |
1033 |
1030 // Last frame anchor routines |
1034 // Last frame anchor routines |
1031 |
1035 |
1032 JavaFrameAnchor* frame_anchor(void) { return &_anchor; } |
1036 JavaFrameAnchor* frame_anchor(void) { return &_anchor; } |
1033 |
1037 |
1034 // last_Java_sp |
1038 // last_Java_sp |
1035 bool has_last_Java_frame() const { return _anchor.has_last_Java_frame(); } |
1039 bool has_last_Java_frame() const { return _anchor.has_last_Java_frame(); } |
1036 intptr_t* last_Java_sp() const { return _anchor.last_Java_sp(); } |
1040 intptr_t* last_Java_sp() const { return _anchor.last_Java_sp(); } |
1037 |
1041 |
1038 // last_Java_pc |
1042 // last_Java_pc |
1039 |
1043 |
1040 address last_Java_pc(void) { return _anchor.last_Java_pc(); } |
1044 address last_Java_pc(void) { return _anchor.last_Java_pc(); } |
1041 |
1045 |
1042 // Safepoint support |
1046 // Safepoint support |
|
1047 #ifndef PPC64 |
1043 JavaThreadState thread_state() const { return _thread_state; } |
1048 JavaThreadState thread_state() const { return _thread_state; } |
1044 void set_thread_state(JavaThreadState s) { _thread_state=s; } |
1049 void set_thread_state(JavaThreadState s) { _thread_state = s; } |
1045 ThreadSafepointState *safepoint_state() const { return _safepoint_state; } |
1050 #else |
|
1051 // Use membars when accessing volatile _thread_state. See |
|
1052 // Threads::create_vm() for size checks. |
|
1053 JavaThreadState thread_state() const { |
|
1054 return (JavaThreadState) OrderAccess::load_acquire((volatile jint*)&_thread_state); |
|
1055 } |
|
1056 void set_thread_state(JavaThreadState s) { |
|
1057 OrderAccess::release_store((volatile jint*)&_thread_state, (jint)s); |
|
1058 } |
|
1059 #endif |
|
1060 ThreadSafepointState *safepoint_state() const { return _safepoint_state; } |
1046 void set_safepoint_state(ThreadSafepointState *state) { _safepoint_state = state; } |
1061 void set_safepoint_state(ThreadSafepointState *state) { _safepoint_state = state; } |
1047 bool is_at_poll_safepoint() { return _safepoint_state->is_at_poll_safepoint(); } |
1062 bool is_at_poll_safepoint() { return _safepoint_state->is_at_poll_safepoint(); } |
1048 |
1063 |
1049 // thread has called JavaThread::exit() or is terminated |
1064 // thread has called JavaThread::exit() or is terminated |
1050 bool is_exiting() { return _terminated == _thread_exiting || is_terminated(); } |
1065 bool is_exiting() { return _terminated == _thread_exiting || is_terminated(); } |
1317 bool reguard_stack(address cur_sp); |
1332 bool reguard_stack(address cur_sp); |
1318 // Similar to above but see if current stackpoint is out of the guard area |
1333 // Similar to above but see if current stackpoint is out of the guard area |
1319 // and reguard if possible. |
1334 // and reguard if possible. |
1320 bool reguard_stack(void); |
1335 bool reguard_stack(void); |
1321 |
1336 |
|
1337 address stack_overflow_limit() { return _stack_overflow_limit; } |
|
1338 void set_stack_overflow_limit() { |
|
1339 _stack_overflow_limit = _stack_base - _stack_size + |
|
1340 ((StackShadowPages + |
|
1341 StackYellowPages + |
|
1342 StackRedPages) * os::vm_page_size()); |
|
1343 } |
|
1344 |
1322 // Misc. accessors/mutators |
1345 // Misc. accessors/mutators |
1323 void set_do_not_unlock(void) { _do_not_unlock_if_synchronized = true; } |
1346 void set_do_not_unlock(void) { _do_not_unlock_if_synchronized = true; } |
1324 void clr_do_not_unlock(void) { _do_not_unlock_if_synchronized = false; } |
1347 void clr_do_not_unlock(void) { _do_not_unlock_if_synchronized = false; } |
1325 bool do_not_unlock(void) { return _do_not_unlock_if_synchronized; } |
1348 bool do_not_unlock(void) { return _do_not_unlock_if_synchronized; } |
1326 |
1349 |
1351 static ByteSize saved_exception_pc_offset() { return byte_offset_of(JavaThread, _saved_exception_pc ); } |
1374 static ByteSize saved_exception_pc_offset() { return byte_offset_of(JavaThread, _saved_exception_pc ); } |
1352 static ByteSize osthread_offset() { return byte_offset_of(JavaThread, _osthread ); } |
1375 static ByteSize osthread_offset() { return byte_offset_of(JavaThread, _osthread ); } |
1353 static ByteSize exception_oop_offset() { return byte_offset_of(JavaThread, _exception_oop ); } |
1376 static ByteSize exception_oop_offset() { return byte_offset_of(JavaThread, _exception_oop ); } |
1354 static ByteSize exception_pc_offset() { return byte_offset_of(JavaThread, _exception_pc ); } |
1377 static ByteSize exception_pc_offset() { return byte_offset_of(JavaThread, _exception_pc ); } |
1355 static ByteSize exception_handler_pc_offset() { return byte_offset_of(JavaThread, _exception_handler_pc); } |
1378 static ByteSize exception_handler_pc_offset() { return byte_offset_of(JavaThread, _exception_handler_pc); } |
|
1379 static ByteSize stack_overflow_limit_offset() { return byte_offset_of(JavaThread, _stack_overflow_limit); } |
1356 static ByteSize is_method_handle_return_offset() { return byte_offset_of(JavaThread, _is_method_handle_return); } |
1380 static ByteSize is_method_handle_return_offset() { return byte_offset_of(JavaThread, _is_method_handle_return); } |
1357 static ByteSize stack_guard_state_offset() { return byte_offset_of(JavaThread, _stack_guard_state ); } |
1381 static ByteSize stack_guard_state_offset() { return byte_offset_of(JavaThread, _stack_guard_state ); } |
1358 static ByteSize suspend_flags_offset() { return byte_offset_of(JavaThread, _suspend_flags ); } |
1382 static ByteSize suspend_flags_offset() { return byte_offset_of(JavaThread, _suspend_flags ); } |
1359 |
1383 |
1360 static ByteSize do_not_unlock_if_synchronized_offset() { return byte_offset_of(JavaThread, _do_not_unlock_if_synchronized); } |
1384 static ByteSize do_not_unlock_if_synchronized_offset() { return byte_offset_of(JavaThread, _do_not_unlock_if_synchronized); } |
1714 # include "thread_linux_arm.hpp" |
1738 # include "thread_linux_arm.hpp" |
1715 #endif |
1739 #endif |
1716 #ifdef TARGET_OS_ARCH_linux_ppc |
1740 #ifdef TARGET_OS_ARCH_linux_ppc |
1717 # include "thread_linux_ppc.hpp" |
1741 # include "thread_linux_ppc.hpp" |
1718 #endif |
1742 #endif |
|
1743 #ifdef TARGET_OS_ARCH_aix_ppc |
|
1744 # include "thread_aix_ppc.hpp" |
|
1745 #endif |
1719 #ifdef TARGET_OS_ARCH_bsd_x86 |
1746 #ifdef TARGET_OS_ARCH_bsd_x86 |
1720 # include "thread_bsd_x86.hpp" |
1747 # include "thread_bsd_x86.hpp" |
1721 #endif |
1748 #endif |
1722 #ifdef TARGET_OS_ARCH_bsd_zero |
1749 #ifdef TARGET_OS_ARCH_bsd_zero |
1723 # include "thread_bsd_zero.hpp" |
1750 # include "thread_bsd_zero.hpp" |