--- old/src/hotspot/share/runtime/handshake.cpp Tue Nov 21 15:20:32 2017 +++ new/src/hotspot/share/runtime/handshake.cpp Tue Nov 21 15:20:31 2017 @@ -137,22 +137,23 @@ } // We need to re-think this with SMR ThreadsList. - // There is assumption in code that Threads_lock should be lock - // during certain phases. + // There is an assumption in the code that the Threads_lock should be + // locked during certain phases. MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag); ThreadsListHandle tlh; - if (tlh.includes(_target)) { - // Warning threads address might be re-used. - // handshake_process_by_vmthread will check the semaphore for us again - // Since we can't have more then one handshake in flight a reuse of thread address - // should be okey since the new thread will not have an operation. + if (tlh.includes(_target)) { + // Warning _target's address might be re-used. + // handshake_process_by_vmthread will check the semaphore for us again. + // Since we can't have more then one handshake in flight a reuse of + // _target's address should be okay since the new thread will not have + // an operation. _target->handshake_process_by_vmthread(); } else { - // We can't warn here is since the thread do cancel_handshake after it have been removed - // from ThreadsList. So we should just keep looping here until while below return negative - // If we have a bug, then we deadlock here, which is good for debugging. + // We can't warn here since the thread does cancel_handshake after + // it has been removed from the ThreadsList. So we should just keep + // looping here until while below returns false. If we have a bug, + // then we hang here, which is good for debugging. } - } while (!poll_for_completed_thread()); } @@ -197,12 +198,12 @@ // by semaphores and we optimistically begin by working on the blocked threads { // We need to re-think this with SMR ThreadsList. - // There is assumption in code that Threads_lock should be lock - // during certain phases. + // There is an assumption in the code that the Threads_lock should + // be locked during certain phases. MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag); for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thr = jtiwh.next(); ) { - // A new thread on the ThreadsList will not have an operation. - // Hence is skipped in handshake_process_by_vmthread. + // A new thread on the ThreadsList will not have an operation, + // hence it is skipped in handshake_process_by_vmthread. thr->handshake_process_by_vmthread(); } }