< prev index next >
src/hotspot/share/runtime/thread.hpp
Print this page
rev 56464 : 8231707: Improve Mutex inlining
Contributed-by: robbin.ehn@oracle.com, claes.redestad@oracle.com
*** 1359,1376 ****
// transition into thread_in_Java mode so that it can potentially
// block.
static void check_special_condition_for_native_trans_and_transition(JavaThread *thread);
bool is_ext_suspend_completed(bool called_by_wait, int delay, uint32_t *bits);
! bool is_ext_suspend_completed_with_lock(uint32_t *bits) {
! MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
! // Warning: is_ext_suspend_completed() may temporarily drop the
! // SR_lock to allow the thread to reach a stable thread state if
! // it is currently in a transient thread state.
! return is_ext_suspend_completed(false /* !called_by_wait */,
! SuspendRetryDelay, bits);
! }
// We cannot allow wait_for_ext_suspend_completion() to run forever or
// we could hang. SuspendRetryCount and SuspendRetryDelay are normally
// passed as the count and delay parameters. Experiments with specific
// calls to wait_for_ext_suspend_completion() can be done by passing
--- 1359,1369 ----
// transition into thread_in_Java mode so that it can potentially
// block.
static void check_special_condition_for_native_trans_and_transition(JavaThread *thread);
bool is_ext_suspend_completed(bool called_by_wait, int delay, uint32_t *bits);
! bool is_ext_suspend_completed_with_lock(uint32_t *bits);
// We cannot allow wait_for_ext_suspend_completion() to run forever or
// we could hang. SuspendRetryCount and SuspendRetryDelay are normally
// passed as the count and delay parameters. Experiments with specific
// calls to wait_for_ext_suspend_completion() can be done by passing
*** 1396,1435 ****
// external suspend request is completed
bool is_ext_suspended() const {
return (_suspend_flags & _ext_suspended) != 0;
}
! bool is_external_suspend_with_lock() const {
! MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
! return is_external_suspend();
! }
// Special method to handle a pending external suspend request
// when a suspend equivalent condition lifts.
! bool handle_special_suspend_equivalent_condition() {
! assert(is_suspend_equivalent(),
! "should only be called in a suspend equivalence condition");
! MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
! bool ret = is_external_suspend();
! if (!ret) {
! // not about to self-suspend so clear suspend equivalence
! clear_suspend_equivalent();
! }
! // implied else:
! // We have a pending external suspend request so we leave the
! // suspend_equivalent flag set until java_suspend_self() sets
! // the ext_suspended flag and clears the suspend_equivalent
! // flag. This insures that wait_for_ext_suspend_completion()
! // will return consistent values.
! return ret;
! }
// utility methods to see if we are doing some kind of suspension
! bool is_being_ext_suspended() const {
! MutexLocker ml(SR_lock(), Mutex::_no_safepoint_check_flag);
! return is_ext_suspended() || is_external_suspend();
! }
bool is_suspend_equivalent() const { return _suspend_equivalent; }
void set_suspend_equivalent() { _suspend_equivalent = true; }
void clear_suspend_equivalent() { _suspend_equivalent = false; }
--- 1389,1406 ----
// external suspend request is completed
bool is_ext_suspended() const {
return (_suspend_flags & _ext_suspended) != 0;
}
! bool is_external_suspend_with_lock() const;
// Special method to handle a pending external suspend request
// when a suspend equivalent condition lifts.
! bool handle_special_suspend_equivalent_condition();
// utility methods to see if we are doing some kind of suspension
! bool is_being_ext_suspended() const;
bool is_suspend_equivalent() const { return _suspend_equivalent; }
void set_suspend_equivalent() { _suspend_equivalent = true; }
void clear_suspend_equivalent() { _suspend_equivalent = false; }
< prev index next >