Skip to content

Commit eac2531

Browse files
authored
Merge pull request #21342 from babsingh/main12
Virtual Threads: Bug fixes for JEP491
2 parents 4e1c9d2 + a85b6bb commit eac2531

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

runtime/vm/BytecodeInterpreter.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2943,7 +2943,7 @@ class INTERPRETER_CLASS
29432943
if ((NULL != objectMonitor) && (NULL != objectMonitor->waitingContinuations)) {
29442944
omrthread_monitor_enter(_vm->blockedVirtualThreadsMutex);
29452945
J9VMContinuation *head = objectMonitor->waitingContinuations;
2946-
if (NULL != head) {
2946+
if ((NULL != head) && (NULL != head->vthread)) {
29472947
if (omrthread_monitor_notify == notifyFunction) {
29482948
objectMonitor->waitingContinuations = head->nextWaitingContinuation;
29492949
head->nextWaitingContinuation = _vm->blockedContinuations;

runtime/vm/ContinuationHelpers.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,8 @@ preparePinnedVirtualThreadForUnmount(J9VMThread *currentThread, j9object_t syncO
845845
result = J9_OBJECT_MONITOR_OOM;
846846
goto done;
847847
}
848+
} else {
849+
objectMonitor = J9_INFLLOCK_OBJECT_MONITOR(lock);
848850
}
849851

850852
detachMonitorInfo(currentThread, objectMonitor);
@@ -877,6 +879,8 @@ preparePinnedVirtualThreadForUnmount(J9VMThread *currentThread, j9object_t syncO
877879
result = J9_OBJECT_MONITOR_OOM;
878880
goto done;
879881
}
882+
} else {
883+
objectMonitor = J9_INFLLOCK_OBJECT_MONITOR(lock);
880884
}
881885

882886
detachMonitorInfo(currentThread, objectMonitor);

0 commit comments

Comments
 (0)