8295810: cleanup debug agent removeThread() api

Reviewed-by: kevinw, sspitsyn, amenkov
This commit is contained in:
Chris Plummer 2022-10-25 16:28:57 +00:00
parent 5c4d99a051
commit 6289600fe8

View File

@ -319,6 +319,7 @@ removeNode(ThreadList *list, ThreadNode *node)
ThreadNode *prev;
ThreadNode *next;
JDI_ASSERT(list == node->list);
prev = node->prev;
next = node->next;
if ( prev != NULL ) {
@ -487,15 +488,11 @@ clearThread(JNIEnv *env, ThreadNode *node)
}
static void
removeThread(JNIEnv *env, ThreadList *list, jthread thread)
removeThread(JNIEnv *env, ThreadNode *node)
{
ThreadNode *node;
node = findThread(list, thread);
if (node != NULL) {
removeNode(list, node);
clearThread(env, node);
}
JDI_ASSERT(node != NULL);
removeNode(node->list, node);
clearThread(env, node);
}
static void
@ -507,7 +504,7 @@ removeResumed(JNIEnv *env, ThreadList *list)
while (node != NULL) {
ThreadNode *temp = node->next;
if (node->suspendCount == 0) {
removeThread(env, list, node->thread);
removeThread(env, node);
}
node = temp;
}
@ -2476,11 +2473,7 @@ threadControl_onEventHandlerExit(EventIndex ei, jthread thread,
env = getEnv();
if (ei == EI_THREAD_END) {
jboolean inResume = (node->resumeFrameDepth > 0);
if (isVThread(thread)) {
removeThread(env, &runningVThreads, thread);
} else {
removeThread(env, &runningThreads, thread);
}
removeThread(env, node);
node = NULL; /* has been freed */
/*
@ -2930,7 +2923,7 @@ dumpThread(ThreadNode *node) {
#ifdef DEBUG_THREADNAME
tty_message("\tname: %s", node->name);
#endif
// More fields can be printed here when needed. The amount of output is intentionlly
// More fields can be printed here when needed. The amount of output is intentionally
// kept small so it doesn't generate too much output.
tty_message("\tsuspendCount: %d", node->suspendCount);
}