Skip to content

Commit

Permalink
Update JVMTI monitor functions
Browse files Browse the repository at this point in the history
Support for virtual threads added in the following JVMTI functions:
- GetOwnedMonitorInfo
- GetOwnedMonitorStackDepthInfo
- GetCurrentContendedMonitor

Related changes: eclipse-openj9#15857

GetThreadState and GetThreadInfo allow a NULL input thread. In such
a case, they should look at the current thread's object. Because using
the NULL input thread causes a seg fault. This has been fixed.

Related issue: eclipse-openj9#15759

Co-authored-by: Gengchen Tuo <gengchen.tuo@ibm.com>
Co-authored-by: Jack Lu <Jack.S.Lu@ibm.com>
Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
  • Loading branch information
3 people committed Sep 21, 2022
1 parent f6383e2 commit 11a4de7
Show file tree
Hide file tree
Showing 3 changed files with 211 additions and 107 deletions.
21 changes: 21 additions & 0 deletions runtime/jvmti/jvmtiHelpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1929,3 +1929,24 @@ genericWalkStackFramesHelper(J9VMThread *currentThread, J9VMThread *targetThread

return rc;
}

#if JAVA_SPEC_VERSION >= 19
J9VMContinuation *
getJ9VMContinuationToWalk(J9VMThread *currentThread, J9VMThread *targetThread, j9object_t threadObject)
{
J9VMContinuation *continuation = NULL;
if (IS_VIRTUAL_THREAD(currentThread, threadObject)) {
if (NULL == targetThread) {
/* An unmounted virtual thread will have a valid J9VMContinuation. */
j9object_t contObject = (j9object_t)J9VMJAVALANGVIRTUALTHREAD_CONT(currentThread, threadObject);
continuation = J9VMJDKINTERNALVMCONTINUATION_VMREF(currentThread, contObject);
}
} else {
/* J9VMThread->currentContinuation is set to NULL if a virtual thread is not mounted.
* If a virtual thread is mounted, currentContinuation stores the carrier thread details.
*/
continuation = targetThread->currentContinuation;
}
return continuation;
}
#endif /* JAVA_SPEC_VERSION >= 19 */
Loading

0 comments on commit 11a4de7

Please sign in to comment.