mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-20 04:43:32 +00:00
8234613: JavaThread can escape back to Java from an ongoing handshake
Check again if we have a pending/in-progress handshake operation after executing ~ThreadInVMForHandshake() Reviewed-by: coleenp, dcubed, dholmes, rehn
This commit is contained in:
parent
476973c47b
commit
71ec3b6947
@ -289,20 +289,24 @@ void HandshakeState::clear_handshake(JavaThread* target) {
|
||||
void HandshakeState::process_self_inner(JavaThread* thread) {
|
||||
assert(Thread::current() == thread, "should call from thread");
|
||||
assert(!thread->is_terminated(), "should not be a terminated thread");
|
||||
assert(thread->thread_state() != _thread_blocked, "should not be in a blocked state");
|
||||
assert(thread->thread_state() != _thread_in_native, "should not be in native");
|
||||
|
||||
ThreadInVMForHandshake tivm(thread);
|
||||
if (!_semaphore.trywait()) {
|
||||
_semaphore.wait_with_safepoint_check(thread);
|
||||
}
|
||||
HandshakeOperation* op = Atomic::load_acquire(&_operation);
|
||||
if (op != NULL) {
|
||||
HandleMark hm(thread);
|
||||
CautiouslyPreserveExceptionMark pem(thread);
|
||||
// Disarm before execute the operation
|
||||
clear_handshake(thread);
|
||||
op->do_handshake(thread);
|
||||
}
|
||||
_semaphore.signal();
|
||||
do {
|
||||
ThreadInVMForHandshake tivm(thread);
|
||||
if (!_semaphore.trywait()) {
|
||||
_semaphore.wait_with_safepoint_check(thread);
|
||||
}
|
||||
HandshakeOperation* op = Atomic::load_acquire(&_operation);
|
||||
if (op != NULL) {
|
||||
HandleMark hm(thread);
|
||||
CautiouslyPreserveExceptionMark pem(thread);
|
||||
// Disarm before execute the operation
|
||||
clear_handshake(thread);
|
||||
op->do_handshake(thread);
|
||||
}
|
||||
_semaphore.signal();
|
||||
} while (has_operation());
|
||||
}
|
||||
|
||||
bool HandshakeState::vmthread_can_process_handshake(JavaThread* target) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user