Skip to content

Commit 247815b

Browse files
committed
8325937: runtime/handshake/HandshakeDirectTest.java causes "monitor end should be strictly below the frame pointer" assertion failure on AArch64
Reviewed-by: aph, rrich Backport-of: 83e9e482b181e76ca9f645e8cc83cfa9337df498
1 parent 10ea45e commit 247815b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/hotspot/share/runtime/handshake.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2024, 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
@@ -245,6 +245,10 @@ class VM_HandshakeAllThreads: public VM_Operation {
245245
number_of_threads_issued++;
246246
}
247247

248+
// Separate the arming of the poll in add_operation() above from
249+
// the read of JavaThread state in the try_process() call below.
250+
OrderAccess::fence();
251+
248252
if (number_of_threads_issued < 1) {
249253
log_handshake_info(start_time_ns, _op->name(), 0, 0, "no threads alive");
250254
return;
@@ -357,6 +361,10 @@ void Handshake::execute(HandshakeClosure* hs_cl, JavaThread* target) {
357361
return;
358362
}
359363

364+
// Separate the arming of the poll in add_operation() above from
365+
// the read of JavaThread state in the try_process() call below.
366+
OrderAccess::fence();
367+
360368
// Keeps count on how many of own emitted handshakes
361369
// this thread execute.
362370
int emitted_handshakes_executed = 0;
@@ -481,6 +489,10 @@ bool HandshakeState::process_by_self(bool allow_suspend) {
481489
// It by-passes the NSV by manually doing the transition.
482490
NoSafepointVerifier nsv;
483491

492+
// Separate all the writes above for other threads reading state
493+
// set by this thread in case the operation is ThreadSuspendHandshake.
494+
OrderAccess::fence();
495+
484496
while (has_operation()) {
485497
MutexLocker ml(&_lock, Mutex::_no_safepoint_check_flag);
486498

0 commit comments

Comments
 (0)