# HG changeset patch # User rehn # Date 1548965715 -3600 # Thu Jan 31 21:15:15 2019 +0100 # Node ID 300ffdd86b8521e29c92d5620a160204596bd676 # Parent bf4c38b9afaf1821549a326b93bf5bb1270d4d5c 8218145: block_if_requested is not proper inlined due to size Reviewed-by: diff --git a/src/hotspot/share/runtime/safepointMechanism.cpp b/src/hotspot/share/runtime/safepointMechanism.cpp --- a/src/hotspot/share/runtime/safepointMechanism.cpp +++ b/src/hotspot/share/runtime/safepointMechanism.cpp @@ -83,6 +83,23 @@ } } +void SafepointMechanism::block_if_requested_slow(JavaThread *thread) { + if (uses_thread_local_poll()) { + // local poll already checked + if (global_poll()) { + SafepointSynchronize::block(thread); + } + if (thread->has_handshake()) { + thread->handshake_process_by_self(); + } + } else { + // If we don't have per thread poll this could a handshake or a safepoint + if (global_poll()) { + SafepointSynchronize::block(thread); + } + } +} + void SafepointMechanism::initialize_header(JavaThread* thread) { disarm_local_poll(thread); } diff --git a/src/hotspot/share/runtime/safepointMechanism.hpp b/src/hotspot/share/runtime/safepointMechanism.hpp --- a/src/hotspot/share/runtime/safepointMechanism.hpp +++ b/src/hotspot/share/runtime/safepointMechanism.hpp @@ -49,7 +49,7 @@ static inline bool local_poll(Thread* thread); static inline bool global_poll(); - static inline void block_if_requested_local_poll(JavaThread *thread); + static void block_if_requested_slow(JavaThread *thread); static void default_initialize(); diff --git a/src/hotspot/share/runtime/safepointMechanism.inline.hpp b/src/hotspot/share/runtime/safepointMechanism.inline.hpp --- a/src/hotspot/share/runtime/safepointMechanism.inline.hpp +++ b/src/hotspot/share/runtime/safepointMechanism.inline.hpp @@ -55,28 +55,11 @@ } } -void SafepointMechanism::block_if_requested_local_poll(JavaThread *thread) { - bool armed = local_poll_armed(thread); // load acquire, polling page -> op / global state - if(armed) { - // We could be armed for either a handshake operation or a safepoint - if (global_poll()) { - SafepointSynchronize::block(thread); - } - if (thread->has_handshake()) { - thread->handshake_process_by_self(); - } +void SafepointMechanism::block_if_requested(JavaThread *thread) { + if (uses_thread_local_poll() && !SafepointMechanism::local_poll_armed(thread)) { + return; } -} - -void SafepointMechanism::block_if_requested(JavaThread *thread) { - if (uses_thread_local_poll()) { - block_if_requested_local_poll(thread); - } else { - // If we don't have per thread poll this could a handshake or a safepoint - if (global_poll()) { - SafepointSynchronize::block(thread); - } - } + block_if_requested_slow(thread); } void SafepointMechanism::arm_local_poll(JavaThread* thread) {