Skip to content

Commit 57ed162

Browse files
authored
Merge pull request #21498 from fengxue-IS/051-jep491-reset-notified
(v0.51.0) Reset the virtual thread's notified field before releasing Object monitor
2 parents f10a50f + 9a93194 commit 57ed162

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

runtime/vm/BytecodeInterpreter.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5205,14 +5205,15 @@ class INTERPRETER_CLASS
52055205
if ((millis > 0) || (nanos > 0)) {
52065206
newState = JAVA_LANG_VIRTUALTHREAD_TIMED_WAITING;
52075207
}
5208+
/* Reset the virtual thread's notified field before releasing Object monitor. */
5209+
J9VMJAVALANGVIRTUALTHREAD_SET_NOTIFIED(_currentThread, _currentThread->threadObject, JNI_FALSE);
52085210
/* Try to yield the virtual thread if it will be blocked. */
52095211
UDATA result = preparePinnedVirtualThreadForUnmount(_currentThread, object, true);
52105212
VMStructHasBeenUpdated(REGISTER_ARGS);
52115213
if (J9_OBJECT_MONITOR_OOM != result) {
52125214
restoreInternalNativeStackFrame(REGISTER_ARGS);
5213-
/* Handle the virtual thread Object.wait call. */
5214-
J9VMJAVALANGVIRTUALTHREAD_SET_NOTIFIED(_currentThread, _currentThread->threadObject, JNI_FALSE);
5215-
/* VirtualThread.timeout is a private field used by both VM and JCL to temporarily hold
5215+
/* Handle the virtual thread Object.wait call.
5216+
* VirtualThread.timeout is a private field used by both VM and JCL to temporarily hold
52165217
* the value of expected wait/park time before a wake up task is scheduled using the value.
52175218
*/
52185219
J9VMJAVALANGVIRTUALTHREAD_SET_TIMEOUT(_currentThread, _currentThread->threadObject, millis + (nanos / 1000000));

0 commit comments

Comments
 (0)