Skip to content

Commit 2beb7e7

Browse files
Dmitry ChuykoAlexander Scherbatiy
authored andcommitted
8218145: block_if_requested is not proper inlined due to size
Backport-of: f1fbd69
1 parent 02c0cf6 commit 2beb7e7

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

src/hotspot/share/runtime/safepointMechanism.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -83,6 +83,16 @@ void SafepointMechanism::default_initialize() {
8383
}
8484
}
8585

86+
void SafepointMechanism::block_if_requested_slow(JavaThread *thread) {
87+
// local poll already checked, if used.
88+
if (global_poll()) {
89+
SafepointSynchronize::block(thread);
90+
}
91+
if (uses_thread_local_poll() && thread->has_handshake()) {
92+
thread->handshake_process_by_self();
93+
}
94+
}
95+
8696
void SafepointMechanism::initialize_header(JavaThread* thread) {
8797
disarm_local_poll(thread);
8898
}

src/hotspot/share/runtime/safepointMechanism.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class SafepointMechanism : public AllStatic {
4949
static inline bool local_poll(Thread* thread);
5050
static inline bool global_poll();
5151

52-
static inline void block_if_requested_local_poll(JavaThread *thread);
52+
static void block_if_requested_slow(JavaThread *thread);
5353

5454
static void default_initialize();
5555
static void initialize_serialize_page();

src/hotspot/share/runtime/safepointMechanism.inline.hpp

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,28 +55,11 @@ bool SafepointMechanism::poll(Thread* thread) {
5555
}
5656
}
5757

58-
void SafepointMechanism::block_if_requested_local_poll(JavaThread *thread) {
59-
bool armed = local_poll_armed(thread); // load acquire, polling page -> op / global state
60-
if(armed) {
61-
// We could be armed for either a handshake operation or a safepoint
62-
if (global_poll()) {
63-
SafepointSynchronize::block(thread);
64-
}
65-
if (thread->has_handshake()) {
66-
thread->handshake_process_by_self();
67-
}
68-
}
69-
}
70-
7158
void SafepointMechanism::block_if_requested(JavaThread *thread) {
72-
if (uses_thread_local_poll()) {
73-
block_if_requested_local_poll(thread);
74-
} else {
75-
// If we don't have per thread poll this could a handshake or a safepoint
76-
if (global_poll()) {
77-
SafepointSynchronize::block(thread);
78-
}
59+
if (uses_thread_local_poll() && !SafepointMechanism::local_poll_armed(thread)) {
60+
return;
7961
}
62+
block_if_requested_slow(thread);
8063
}
8164

8265
void SafepointMechanism::arm_local_poll(JavaThread* thread) {

0 commit comments

Comments
 (0)