8325937: runtime/handshake/HandshakeDirectTest.java causes "monitor end should be strictly below the frame pointer" assertion failure on AArch64

Reviewed-by: rehn, eosterlund, pchilanomate, aph, fbredberg
This commit is contained in:
Coleen Phillimore 2024-10-17 18:06:42 +00:00
parent 236c71cad9
commit 83e9e482b1

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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
@ -251,8 +251,13 @@ class VM_HandshakeAllThreads: public VM_Operation {
thr->handshake_state()->add_operation(_op);
number_of_threads_issued++;
}
// Separate the arming of the poll in add_operation() above from
// the read of JavaThread state in the try_process() call below.
if (UseSystemMemoryBarrier) {
SystemMemoryBarrier::emit();
} else {
OrderAccess::fence();
}
if (number_of_threads_issued < 1) {
@ -380,6 +385,8 @@ void Handshake::execute(HandshakeClosure* hs_cl, ThreadsListHandle* tlh, JavaThr
// the read of JavaThread state in the try_process() call below.
if (UseSystemMemoryBarrier) {
SystemMemoryBarrier::emit();
} else {
OrderAccess::fence();
}
// Keeps count on how many of own emitted handshakes
@ -559,6 +566,10 @@ bool HandshakeState::process_by_self(bool allow_suspend, bool check_async_except
// Threads shouldn't block if they are in the middle of printing, but...
ttyLocker::break_tty_lock_for_safepoint(os::current_thread_id());
// Separate all the writes above for other threads reading state
// set by this thread in case the operation is ThreadSuspendHandshake.
OrderAccess::fence();
while (has_operation()) {
// Handshakes cannot safely safepoint. The exceptions to this rule are
// the asynchronous suspension and unsafe access error handshakes.