8218145: block_if_requested is not proper inlined due to size
authorrehn
Mon, 04 Feb 2019 21:42:47 +0100
changeset 53631 a5321bcfa2de
parent 53630 53c72d9d962b
child 53632 d620a4a1d5ed
8218145: block_if_requested is not proper inlined due to size Reviewed-by: kbarrett, coleenp, gziemski
src/hotspot/share/runtime/safepointMechanism.cpp
src/hotspot/share/runtime/safepointMechanism.hpp
src/hotspot/share/runtime/safepointMechanism.inline.hpp
--- a/src/hotspot/share/runtime/safepointMechanism.cpp	Mon Feb 04 14:10:53 2019 -0500
+++ b/src/hotspot/share/runtime/safepointMechanism.cpp	Mon Feb 04 21:42:47 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,6 +83,16 @@
   }
 }
 
+void SafepointMechanism::block_if_requested_slow(JavaThread *thread) {
+  // local poll already checked, if used.
+  if (global_poll()) {
+    SafepointSynchronize::block(thread);
+  }
+  if (uses_thread_local_poll() && thread->has_handshake()) {
+      thread->handshake_process_by_self();
+  }
+}
+
 void SafepointMechanism::initialize_header(JavaThread* thread) {
   disarm_local_poll(thread);
 }
--- a/src/hotspot/share/runtime/safepointMechanism.hpp	Mon Feb 04 14:10:53 2019 -0500
+++ b/src/hotspot/share/runtime/safepointMechanism.hpp	Mon Feb 04 21:42:47 2019 +0100
@@ -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();
 
--- a/src/hotspot/share/runtime/safepointMechanism.inline.hpp	Mon Feb 04 14:10:53 2019 -0500
+++ b/src/hotspot/share/runtime/safepointMechanism.inline.hpp	Mon Feb 04 21:42:47 2019 +0100
@@ -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) {