Skip to content

Commit e29c3f6

Browse files
committed
8252661: Change SafepointMechanism terminology to talk less about "blocking"
Reviewed-by: rehn, shade, dholmes
1 parent e0c8d44 commit e29c3f6

File tree

12 files changed

+33
-33
lines changed

12 files changed

+33
-33
lines changed

src/hotspot/cpu/zero/zeroInterpreter_zero.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ int ZeroInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
419419

420420
// Handle safepoint operations, pending suspend requests,
421421
// and pending asynchronous exceptions.
422-
if (SafepointMechanism::should_block(thread) ||
422+
if (SafepointMechanism::should_process(thread) ||
423423
thread->has_special_condition_for_native_trans()) {
424424
JavaThread::check_special_condition_for_native_trans(thread);
425425
CHECK_UNHANDLED_OOPS_ONLY(thread->clear_unhandled_oops());
@@ -551,7 +551,7 @@ int ZeroInterpreter::accessor_entry(Method* method, intptr_t UNUSED, TRAPS) {
551551
intptr_t *locals = stack->sp();
552552

553553
// Drop into the slow path if we need a safepoint check
554-
if (SafepointMechanism::should_block(THREAD)) {
554+
if (SafepointMechanism::should_process(THREAD)) {
555555
return normal_entry(method, 0, THREAD);
556556
}
557557

@@ -683,7 +683,7 @@ int ZeroInterpreter::empty_entry(Method* method, intptr_t UNUSED, TRAPS) {
683683
ZeroStack *stack = thread->zero_stack();
684684

685685
// Drop into the slow path if we need a safepoint check
686-
if (SafepointMechanism::should_block(THREAD)) {
686+
if (SafepointMechanism::should_process(THREAD)) {
687687
return normal_entry(method, 0, THREAD);
688688
}
689689

src/hotspot/share/jvmci/jvmciCodeInstaller.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ JVMCI::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer, bo
919919
last_pc_offset = pc_offset;
920920

921921
JavaThread* thread = JavaThread::current();
922-
if (SafepointMechanism::should_block(thread)) {
922+
if (SafepointMechanism::should_process(thread)) {
923923
// this is a hacky way to force a safepoint check but nothing else was jumping out at me.
924924
ThreadToNativeFromVM ttnfv(thread);
925925
}

src/hotspot/share/runtime/handshake.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ bool Handshake::execute_direct(HandshakeClosure* thread_cl, JavaThread* target)
361361
hsy.add_result(pr);
362362
// Check for pending handshakes to avoid possible deadlocks where our
363363
// target is trying to handshake us.
364-
if (SafepointMechanism::should_block(self)) {
364+
if (SafepointMechanism::should_process(self)) {
365365
ThreadBlockInVM tbivm(self);
366366
}
367367
hsy.process();

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class ThreadStateTransition : public StackObj {
9393
// Change to transition state and ensure it is seen by the VM thread.
9494
thread->set_thread_state_fence((JavaThreadState)(from + 1));
9595

96-
SafepointMechanism::block_if_requested(thread);
96+
SafepointMechanism::process_if_requested(thread);
9797
thread->set_thread_state(to);
9898
}
9999

@@ -114,7 +114,7 @@ class ThreadStateTransition : public StackObj {
114114
// We never install asynchronous exceptions when coming (back) in
115115
// to the runtime from native code because the runtime is not set
116116
// up to handle exceptions floating around at arbitrary points.
117-
if (SafepointMechanism::should_block(thread) || thread->is_suspend_after_native()) {
117+
if (SafepointMechanism::should_process(thread) || thread->is_suspend_after_native()) {
118118
JavaThread::check_safepoint_and_suspend_for_native_trans(thread);
119119
}
120120

@@ -135,7 +135,7 @@ class ThreadInVMForHandshake : public ThreadStateTransition {
135135
// Change to transition state and ensure it is seen by the VM thread.
136136
_thread->set_thread_state_fence(_thread_in_vm_trans);
137137

138-
SafepointMechanism::block_if_requested(_thread);
138+
SafepointMechanism::process_if_requested(_thread);
139139

140140
_thread->set_thread_state(_original_state);
141141

@@ -290,9 +290,9 @@ class ThreadBlockInVMWithDeadlockCheck : public ThreadStateTransition {
290290
// Change to transition state and ensure it is seen by the VM thread.
291291
_thread->set_thread_state_fence((JavaThreadState)(_thread_blocked_trans));
292292

293-
if (SafepointMechanism::should_block(_thread)) {
293+
if (SafepointMechanism::should_process(_thread)) {
294294
release_mutex();
295-
SafepointMechanism::block_if_requested(_thread);
295+
SafepointMechanism::process_if_requested(_thread);
296296
}
297297

298298
_thread->set_thread_state(_thread_in_vm);

src/hotspot/share/runtime/objectMonitor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1783,7 +1783,7 @@ int ObjectMonitor::TrySpin(Thread * Self) {
17831783
// This is in keeping with the "no loitering in runtime" rule.
17841784
// We periodically check to see if there's a safepoint pending.
17851785
if ((ctr & 0xFF) == 0) {
1786-
if (SafepointMechanism::should_block(Self)) {
1786+
if (SafepointMechanism::should_process(Self)) {
17871787
goto Abort; // abrupt spin egress
17881788
}
17891789
SpinPause();

src/hotspot/share/runtime/safepoint.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ void SafepointSynchronize::block(JavaThread *thread) {
774774
!thread->is_at_poll_safepoint() && (state != _thread_in_native_trans));
775775
}
776776

777-
// cross_modify_fence is done by SafepointMechanism::block_if_requested_slow
777+
// cross_modify_fence is done by SafepointMechanism::process_operation_if_requested_slow
778778
// which is the only caller here.
779779
}
780780

@@ -924,7 +924,7 @@ void ThreadSafepointState::print_on(outputStream *st) const {
924924

925925
// ---------------------------------------------------------------------------------------------------------------------
926926

927-
// Block the thread at poll or poll return for safepoint/handshake.
927+
// Process pending operation.
928928
void ThreadSafepointState::handle_polling_page_exception() {
929929

930930
// Step 1: Find the nmethod from the return address
@@ -963,8 +963,8 @@ void ThreadSafepointState::handle_polling_page_exception() {
963963
assert(Universe::heap()->is_in_or_null(result), "must be heap pointer");
964964
}
965965

966-
// Block the thread
967-
SafepointMechanism::block_if_requested(thread());
966+
// Process pending operation
967+
SafepointMechanism::process_if_requested(thread());
968968

969969
// restore oop result, if any
970970
if (return_oop) {
@@ -979,8 +979,8 @@ void ThreadSafepointState::handle_polling_page_exception() {
979979
// verify the blob built the "return address" correctly
980980
assert(real_return_addr == caller_fr.pc(), "must match");
981981

982-
// Block the thread
983-
SafepointMechanism::block_if_requested(thread());
982+
// Process pending operation
983+
SafepointMechanism::process_if_requested(thread());
984984
set_at_poll_safepoint(false);
985985

986986
// If we have a pending async exception deoptimize the frame

src/hotspot/share/runtime/safepointMechanism.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void SafepointMechanism::default_initialize() {
7171
_poll_disarmed_value = reinterpret_cast<void*>(poll_disarmed_value);
7272
}
7373

74-
void SafepointMechanism::block_or_handshake(JavaThread *thread) {
74+
void SafepointMechanism::process(JavaThread *thread) {
7575
if (global_poll()) {
7676
// Any load in ::block must not pass the global poll load.
7777
// Otherwise we might load an old safepoint counter (for example).
@@ -83,12 +83,12 @@ void SafepointMechanism::block_or_handshake(JavaThread *thread) {
8383
}
8484
}
8585

86-
void SafepointMechanism::block_if_requested_slow(JavaThread *thread) {
86+
void SafepointMechanism::process_if_requested_slow(JavaThread *thread) {
8787
// Read global poll and has_handshake after local poll
8888
OrderAccess::loadload();
8989

9090
// local poll already checked, if used.
91-
block_or_handshake(thread);
91+
process(thread);
9292

9393
OrderAccess::loadload();
9494

src/hotspot/share/runtime/safepointMechanism.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class SafepointMechanism : public AllStatic {
4747
static inline bool local_poll(Thread* thread);
4848
static inline bool global_poll();
4949

50-
static void block_or_handshake(JavaThread *thread);
51-
static void block_if_requested_slow(JavaThread *thread);
50+
static void process(JavaThread *thread);
51+
static void process_if_requested_slow(JavaThread *thread);
5252

5353
static void default_initialize();
5454

@@ -64,10 +64,10 @@ class SafepointMechanism : public AllStatic {
6464
static bool is_poll_address(address addr) { return addr >= _polling_page && addr < (_polling_page + os::vm_page_size()); }
6565

6666
// Call this method to see if this thread should block for a safepoint or process handshake.
67-
static inline bool should_block(Thread* thread);
67+
static inline bool should_process(Thread* thread);
6868

69-
// Blocks a thread until safepoint/handshake is completed.
70-
static inline void block_if_requested(JavaThread* thread);
69+
// Processes a pending requested operation.
70+
static inline void process_if_requested(JavaThread* thread);
7171

7272
// Caller is responsible for using a memory barrier if needed.
7373
static inline void arm_local_poll(JavaThread* thread);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ bool SafepointMechanism::local_poll(Thread* thread) {
4747
}
4848
}
4949

50-
bool SafepointMechanism::should_block(Thread* thread) {
50+
bool SafepointMechanism::should_process(Thread* thread) {
5151
return local_poll(thread);
5252
}
5353

54-
void SafepointMechanism::block_if_requested(JavaThread *thread) {
54+
void SafepointMechanism::process_if_requested(JavaThread *thread) {
5555
if (!local_poll_armed(thread)) {
5656
return;
5757
}
58-
block_if_requested_slow(thread);
58+
process_if_requested_slow(thread);
5959
}
6060

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

src/hotspot/share/runtime/sweeper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ void NMethodSweeper::force_sweep() {
267267
*/
268268
void NMethodSweeper::handle_safepoint_request() {
269269
JavaThread* thread = JavaThread::current();
270-
if (SafepointMechanism::should_block(thread)) {
270+
if (SafepointMechanism::should_process(thread)) {
271271
if (PrintMethodFlushing && Verbose) {
272272
tty->print_cr("### Sweep at %d out of %d, yielding to safepoint", _seen, CodeCache::nmethod_count());
273273
}

0 commit comments

Comments
 (0)