--- a/src/hotspot/share/runtime/handshake.cpp Fri Feb 15 07:53:03 2019 -0500
+++ b/src/hotspot/share/runtime/handshake.cpp Fri Feb 15 14:15:10 2019 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, 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
@@ -303,13 +303,9 @@
}
bool HandshakeState::vmthread_can_process_handshake(JavaThread* target) {
- // SafepointSynchronize::safepoint_safe() does not consider an externally
- // suspended thread to be safe. However, this function must be called with
- // the Threads_lock held so an externally suspended thread cannot be
- // resumed thus it is safe.
- assert(Threads_lock->owned_by_self(), "Not holding Threads_lock.");
- return SafepointSynchronize::safepoint_safe(target, target->thread_state()) ||
- target->is_ext_suspended() || target->is_terminated();
+ // handshake_safe may only be called with polls armed.
+ // VM thread controls this by first claiming the handshake via claim_handshake_for_vmthread.
+ return SafepointSynchronize::handshake_safe(target);
}
static bool possibly_vmthread_can_process_handshake(JavaThread* target) {