Lines Matching refs:node

35 #define HANDLING_EVENT(node) ((node)->current_ei != 0)
165 setThreadLocalStorage(jthread thread, ThreadNode *node)
170 (gdata->jvmti, thread, (void*)node);
185 ThreadNode *node;
187 node = NULL;
189 (gdata->jvmti, thread, (void**)&node);
197 return node;
210 ThreadNode *node;
212 for (node = list->first; node != NULL; node = node->next) {
213 if (isSameObject(env, node->thread, thread)) {
217 return node;
228 ThreadNode *node;
230 /* Get thread local storage for quick thread -> node access */
231 node = getThreadLocalStorage(thread);
236 if ( node == NULL ) {
241 node = nonTlsSearch(env, list, thread);
243 node = nonTlsSearch(env, &runningThreads, thread);
244 if ( node == NULL ) {
245 node = nonTlsSearch(env, &otherThreads, thread);
248 if ( node != NULL ) {
250 setThreadLocalStorage(thread, (void*)node);
255 if ( node != NULL && list != NULL && node->list != list ) {
258 return node;
263 removeNode(ThreadList *list, ThreadNode *node)
268 prev = node->prev;
269 next = node->next;
279 node->next = NULL;
280 node->prev = NULL;
281 node->list = NULL;
286 addNode(ThreadList *list, ThreadNode *node)
288 node->next = NULL;
289 node->prev = NULL;
290 node->list = NULL;
292 list->first = node;
294 list->first->prev = node;
295 node->next = list->first;
296 list->first = node;
298 node->list = list;
304 ThreadNode *node;
307 node = findThread(list, thread);
308 if (node == NULL) {
309 node = jvmtiAllocate(sizeof(*node));
310 if (node == NULL) {
314 (void)memset(node, 0, sizeof(*node));
317 jvmtiDeallocate(node);
326 saveGlobalRef(env, thread, &(node->thread));
327 if (node->thread == NULL) {
328 jvmtiDeallocate(node);
336 if (threadControl_isDebugThread(node->thread)) {
337 node->isDebugThread = JNI_TRUE;
344 node->suspendCount = suspendAllCount;
345 node->suspendOnStart = JNI_TRUE;
347 node->current_ei = 0;
348 node->instructionStepMode = JVMTI_DISABLE;
349 node->eventBag = eventBag;
350 addNode(list, node);
352 /* Set thread local storage for quick thread -> node access.
356 setThreadLocalStorage(node->thread, (void*)node);
359 return node;
363 clearThread(JNIEnv *env, ThreadNode *node)
365 if (node->pendingStop != NULL) {
366 tossGlobalRef(env, &(node->pendingStop));
368 stepControl_clearRequest(node->thread, &node->currentStep);
369 if (node->isDebugThread) {
370 (void)threadControl_removeDebugThread(node->thread);
373 setThreadLocalStorage(node->thread, NULL);
374 tossGlobalRef(env, &(node->thread));
375 bagDestroyBag(node->eventBag);
376 jvmtiDeallocate(node);
382 ThreadNode *node;
384 node = findThread(list, thread);
385 if (node != NULL) {
386 removeNode(list, node);
387 clearThread(env, node);
394 ThreadNode *node;
396 node = list->first;
397 while (node != NULL) {
398 ThreadNode *temp = node->next;
399 if (node->suspendCount == 0) {
400 removeThread(env, list, node->thread);
402 node = temp;
407 moveNode(ThreadList *source, ThreadList *dest, ThreadNode *node)
409 removeNode(source, node);
410 JDI_ASSERT(findThread(dest, node->thread) == NULL);
411 addNode(dest, node);
420 ThreadNode *node;
423 for (node = list->first; node != NULL; node = node->next) {
424 error = (*function)(env, node, arg);
492 threadSetEventNotificationMode(ThreadNode *node,
499 node->instructionStepMode = mode;
507 processDeferredEventModes(JNIEnv *env, jthread thread, ThreadNode *node)
518 error = threadSetEventNotificationMode(node,
609 ThreadNode *node;
612 node = list->first;
613 while (node != NULL) {
614 if (node->resumeFrameDepth > 0) {
621 error = threadState(node->thread, &state);
630 node = node->next;
656 ThreadNode *node;
663 node = findThread(&runningThreads, thread);
664 if (node != NULL) {
665 if (node->resumeFrameDepth > 0) {
670 if (compareDepth < node->resumeFrameDepth) {
671 node->resumeFrameDepth = 0;
683 ThreadNode *node;
685 node = findThread(NULL, thread);
686 if (node != NULL) {
687 while (node && node->suspendCount > 0) {
689 node = findThread(NULL, thread);
699 ThreadNode *node;
702 node = findThread(&runningThreads, thread);
703 if (node != NULL) {
704 JDI_ASSERT(node->resumeFrameDepth == 0);
729 node->resumeFrameDepth = frameDepth;
824 ThreadNode *node;
826 node = insertThread(env, &runningThreads, thread);
837 node->isStarted = JNI_TRUE;
847 commonSuspendByNode(ThreadNode *node)
851 LOG_MISC(("thread=%p suspended", node->thread));
853 (gdata->jvmti, node->thread);
859 node->toBeResumed = JNI_TRUE;
882 deferredSuspendThreadByNode(ThreadNode *node)
887 if (node->isDebugThread) {
896 if (node->suspendCount > 0) {
897 error = commonSuspendByNode(node);
905 node->suspendCount--;
909 node->suspendOnStart = JNI_FALSE;
917 suspendThreadByNode(ThreadNode *node)
920 if (node->isDebugThread) {
929 if (node->suspendOnStart) {
930 node->suspendCount++;
934 if (node->suspendCount == 0) {
935 error = commonSuspendByNode(node);
945 node->suspendOnStart = JNI_TRUE;
951 node->suspendCount++;
960 resumeThreadByNode(ThreadNode *node)
964 if (node->isDebugThread) {
968 if (node->suspendCount > 0) {
969 node->suspendCount--;
971 if ((node->suspendCount == 0) && node->toBeResumed &&
972 !node->suspendOnStart) {
973 LOG_MISC(("thread=%p resumed", node->thread));
975 (gdata->jvmti, node->thread);
976 node->frameGeneration++; /* Increment on each resume */
977 node->toBeResumed = JNI_FALSE;
978 if (error == JVMTI_ERROR_THREAD_NOT_ALIVE && !node->isStarted) {
1050 ThreadNode *node;
1057 node = findThread(&runningThreads, thread);
1058 if (node == NULL) {
1059 node = insertThread(env, &otherThreads, thread);
1063 return deferredSuspendThreadByNode(node);
1065 return suspendThreadByNode(node);
1071 resumeCopyHelper(JNIEnv *env, ThreadNode *node, void *arg)
1073 if (node->isDebugThread) {
1078 if (node->suspendCount > 1) {
1079 node->suspendCount--;
1099 if (node->suspendCount == 1 && (!node->toBeResumed || node->suspendOnStart)) {
1100 node->suspendCount--;
1115 if (node->suspendCount == 1 && node->toBeResumed && !node->suspendOnStart) {
1118 **listPtr = node->thread;
1126 resumeCountHelper(JNIEnv *env, ThreadNode *node, void *arg)
1128 if (node->isDebugThread) {
1139 if (node->suspendCount == 1 && node->toBeResumed && !node->suspendOnStart) {
1228 ThreadNode *node;
1230 node = findThread(&runningThreads, reqList[i]);
1231 if (node == NULL) {
1234 LOG_MISC(("thread=%p resumed as part of list", node->thread));
1241 node->suspendCount--;
1242 node->toBeResumed = JNI_FALSE;
1243 node->frameGeneration++; /* Increment on each resume */
1276 ThreadNode *node;
1283 node = findThread(&runningThreads, initList[i]);
1284 if (node == NULL) {
1285 node = insertThread(env, &otherThreads, initList[i]);
1288 if (node->isDebugThread) {
1297 if (node->suspendOnStart || node->suspendCount > 0) {
1298 node->suspendCount++;
1302 if (node->suspendCount == 0) {
1321 ThreadNode *node;
1323 node = findThread(NULL, reqList[i]);
1324 if (node == NULL) {
1327 LOG_MISC(("thread=%p suspended as part of list", node->thread));
1331 node->toBeResumed = JNI_TRUE;
1347 node->suspendOnStart = JNI_TRUE;
1353 node->suspendCount++;
1370 ThreadNode *node;
1376 node = findThread(NULL, thread);
1379 * If the node is in neither list, the debugger never suspended
1383 if (node != NULL) {
1384 error = resumeThreadByNode(node);
1436 ThreadNode *node;
1440 node = findThread(&runningThreads, thread);
1441 if (node == NULL) {
1442 node = findThread(&otherThreads, thread);
1446 if (node != NULL) {
1447 *count = node->suspendCount;
1450 * If the node is in neither list, the debugger never suspended
1481 suspendAllHelper(JNIEnv *env, ThreadNode *node, void *arg)
1487 if (!contains(env, list, count, node->thread)) {
1488 error = commonSuspend(env, node->thread, JNI_FALSE);
1562 resumeHelper(JNIEnv *env, ThreadNode *node, void *ignored)
1566 * don't need to recheck to see if the node is still on one
1569 return resumeThreadByNode(node);
1587 * such threads must have a node in one of the thread lists, so there's
1619 ThreadNode *node;
1626 node = findThread(&runningThreads, thread);
1627 if (node != NULL) {
1628 step = &node->currentStep;
1639 ThreadNode *node;
1646 node = findThread(&runningThreads, thread);
1647 if (node != NULL) {
1648 request = &node->currentInvoke;
1746 ThreadNode *node;
1748 node = findThread(NULL, thread);
1749 if (node == NULL) {
1752 popFrameThread = node->popFrameThread;
1765 ThreadNode *node;
1767 node = findThread(NULL, thread);
1768 if (node == NULL) {
1771 node->popFrameThread = value;
1784 ThreadNode *node;
1786 node = findThread(NULL, thread);
1787 if (node == NULL) {
1791 popFrameEvent = node->popFrameEvent;
1804 ThreadNode *node;
1806 node = findThread(NULL, thread);
1807 if (node == NULL) {
1810 node->popFrameEvent = value;
1811 node->frameGeneration++; /* Increment on each resume */
1824 ThreadNode *node;
1826 node = findThread(NULL, thread);
1827 if (node == NULL) {
1831 popFrameProceed = node->popFrameProceed;
1844 ThreadNode *node;
1846 node = findThread(NULL, thread);
1847 if (node == NULL) {
1850 node->popFrameProceed = value;
2036 ThreadNode *node;
2068 node = findThread(&otherThreads, thread);
2069 if (node != NULL) {
2070 moveNode(&otherThreads, &runningThreads, node);
2073 * Get a thread node for the reporting thread. For thread start
2075 * the thread node may need to be created.
2080 node = insertThread(env, &runningThreads, thread);
2084 node->isStarted = JNI_TRUE;
2085 processDeferredEventModes(env, thread, node);
2088 node->current_ei = ei;
2089 eventBag = node->eventBag;
2090 if (node->suspendOnStart) {
2091 threadToSuspend = node->thread;
2108 doPendingTasks(JNIEnv *env, ThreadNode *node)
2114 if (node->pendingInterrupt) {
2116 (gdata->jvmti, node->thread);
2120 node->pendingInterrupt = JNI_FALSE;
2123 if (node->pendingStop != NULL) {
2125 (gdata->jvmti, node->thread, node->pendingStop);
2129 tossGlobalRef(env, &(node->pendingStop));
2137 ThreadNode *node;
2146 node = findThread(&runningThreads, thread);
2147 if (node == NULL) {
2154 jboolean inResume = (node->resumeFrameDepth > 0);
2156 node = NULL; /* has been freed */
2167 doPendingTasks(env, node);
2168 node->eventBag = eventBag;
2169 node->current_ei = 0;
2184 ThreadNode *node;
2197 node = findThread(&runningThreads, thread);
2198 if ((node != NULL) && HANDLING_EVENT(node)) {
2219 ThreadNode *node;
2228 node = findThread(&runningThreads, thread);
2229 if ((node == NULL) || !HANDLING_EVENT(node)) {
2236 node->pendingInterrupt = JNI_TRUE;
2247 ThreadNode *node;
2251 node = findThread(&runningThreads, thread);
2252 if (node != NULL) {
2253 node->cleInfo.ei = 0;
2254 if (node->cleInfo.clazz != NULL) {
2255 tossGlobalRef(env, &(node->cleInfo.clazz));
2266 ThreadNode *node;
2273 node = findThread(&runningThreads, thread);
2274 if (node != NULL && node->cleInfo.ei != 0 &&
2275 node->cleInfo.method == method &&
2276 node->cleInfo.location == location &&
2277 (isSameObject(env, node->cleInfo.clazz, clazz))) {
2290 ThreadNode *node;
2294 node = findThread(&runningThreads, thread);
2295 if (node != NULL) {
2296 node->cleInfo.ei = ei;
2299 saveGlobalRef(env, clazz, &(node->cleInfo.clazz));
2301 node->cleInfo.method = method;
2302 node->cleInfo.location = location;
2311 ThreadNode *node;
2315 node = findThread(&runningThreads, thread);
2316 if (node != NULL) {
2317 node->pendingInterrupt = JNI_TRUE;
2326 ThreadNode *node;
2335 node = findThread(&runningThreads, thread);
2336 if ((node == NULL) || !HANDLING_EVENT(node)) {
2346 saveGlobalRef(env, throwable, &(node->pendingStop));
2355 detachHelper(JNIEnv *env, ThreadNode *node, void *arg)
2357 invoker_detach(&node->currentInvoke);
2375 resetHelper(JNIEnv *env, ThreadNode *node, void *arg)
2377 if (node->toBeResumed) {
2378 LOG_MISC(("thread=%p resumed", node->thread));
2379 (void)JVMTI_FUNC_PTR(gdata->jvmti,ResumeThread)(gdata->jvmti, node->thread);
2380 node->frameGeneration++; /* Increment on each resume */
2382 stepControl_clearRequest(node->thread, &node->currentStep);
2383 node->toBeResumed = JNI_FALSE;
2384 node->suspendCount = 0;
2385 node->suspendOnStart = JNI_FALSE;
2417 ThreadNode *node;
2423 node = findThread(&runningThreads, thread);
2424 if (node != NULL) {
2425 mode = node->instructionStepMode;
2442 ThreadNode *node;
2446 node = findThread(&runningThreads, thread);
2447 if ((node == NULL) || (!node->isStarted)) {
2453 error = threadSetEventNotificationMode(node,
2473 ThreadNode *node;
2475 node = findThread(&runningThreads, NULL);
2476 thread = (node == NULL) ? NULL : node->thread;
2490 ThreadNode *node;
2492 node = findThread(NULL, thread);
2494 if (node != NULL) {
2495 frameGeneration = node->frameGeneration;