< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp

Print this page
rev 52100 : 8212082: Remove the NSK_CPP_STUB macros for remaining vmTestbase/jvmti/[sS]*
Summary:
Reviewed-by:

*** 98,109 **** /* testcase #1: suspend and check threads on THREAD_START event */ { eventsStart = 0; if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE, ! JVMTI_EVENT_THREAD_START, NULL))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY0("Let threads to start\n"); --- 98,108 ---- /* testcase #1: suspend and check threads on THREAD_START event */ { eventsStart = 0; if (!NSK_JVMTI_VERIFY( ! jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY0("Let threads to start\n");
*** 120,131 **** nsk_jvmti_sleep(TIMEOUT_DELTA); } } if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE, ! JVMTI_EVENT_THREAD_START, NULL))) { nsk_jvmti_setFailStatus(); } /* check if all threads suspended on THREAD_START events */ if (eventsStart != THREADS_COUNT) { --- 119,129 ---- nsk_jvmti_sleep(TIMEOUT_DELTA); } } if (!NSK_JVMTI_VERIFY( ! jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, NULL))) { nsk_jvmti_setFailStatus(); } /* check if all threads suspended on THREAD_START events */ if (eventsStart != THREADS_COUNT) {
*** 150,161 **** /* testcase #2: suspend and check threads on THREAD_END event */ { eventsEnd = 0; if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE, ! JVMTI_EVENT_THREAD_END, NULL))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY0("Let threads to finish\n"); --- 148,158 ---- /* testcase #2: suspend and check threads on THREAD_END event */ { eventsEnd = 0; if (!NSK_JVMTI_VERIFY( ! jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY0("Let threads to finish\n");
*** 172,183 **** nsk_jvmti_sleep(TIMEOUT_DELTA); } } if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE, ! JVMTI_EVENT_THREAD_END, NULL))) { nsk_jvmti_setFailStatus(); } /* check ia all threads suspended on THREAD_END event */ if (eventsEnd != THREADS_COUNT) { --- 169,179 ---- nsk_jvmti_sleep(TIMEOUT_DELTA); } } if (!NSK_JVMTI_VERIFY( ! jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, NULL))) { nsk_jvmti_setFailStatus(); } /* check ia all threads suspended on THREAD_END event */ if (eventsEnd != THREADS_COUNT) {
*** 219,230 **** */ static int resumeThreads(const char* kind) { int i; for (i = 0; i < THREADS_COUNT; i++) { ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB2(ResumeThread, jvmti, threadsList[i]))) { nsk_jvmti_setFailStatus(); } } return NSK_TRUE; } --- 215,225 ---- */ static int resumeThreads(const char* kind) { int i; for (i = 0; i < THREADS_COUNT; i++) { ! if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(threadsList[i]))) { nsk_jvmti_setFailStatus(); } } return NSK_TRUE; }
*** 241,281 **** jobjectArray threadsArray = NULL; jsize threadsArrayLength = 0; jsize i; /* find debugee class */ ! if (!NSK_JNI_VERIFY(jni, (debugeeClass = ! NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) return NSK_FALSE; /* find static field with threads array */ if (!NSK_JNI_VERIFY(jni, (threadsFieldID = ! NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass, ! THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != NULL)) return NSK_FALSE; /* get threads array from static field */ if (!NSK_JNI_VERIFY(jni, (threadsArray = (jobjectArray) ! NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass, threadsFieldID)) != NULL)) return NSK_FALSE; /* check array length */ if (!NSK_JNI_VERIFY(jni, (threadsArrayLength = ! NSK_CPP_STUB2(GetArrayLength, jni, threadsArray)) == THREADS_COUNT)) return NSK_FALSE; /* get each thread from array */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread) ! NSK_CPP_STUB3(GetObjectArrayElement, jni, threadsArray, i)) != NULL)) return NSK_FALSE; } /* make global references to threads */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread) ! NSK_CPP_STUB2(NewGlobalRef, jni, threadsList[i])) != NULL)) return NSK_FALSE; } return NSK_TRUE; } --- 236,274 ---- jobjectArray threadsArray = NULL; jsize threadsArrayLength = 0; jsize i; /* find debugee class */ ! if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) return NSK_FALSE; /* find static field with threads array */ if (!NSK_JNI_VERIFY(jni, (threadsFieldID = ! jni->GetStaticFieldID(debugeeClass, THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != NULL)) return NSK_FALSE; /* get threads array from static field */ if (!NSK_JNI_VERIFY(jni, (threadsArray = (jobjectArray) ! jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != NULL)) return NSK_FALSE; /* check array length */ if (!NSK_JNI_VERIFY(jni, (threadsArrayLength = ! jni->GetArrayLength(threadsArray)) == THREADS_COUNT)) return NSK_FALSE; /* get each thread from array */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread) ! jni->GetObjectArrayElement(threadsArray, i)) != NULL)) return NSK_FALSE; } /* make global references to threads */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread) ! jni->NewGlobalRef(threadsList[i])) != NULL)) return NSK_FALSE; } return NSK_TRUE; }
*** 291,311 **** jvmtiFrameInfo stackFrames[MAX_STACK_DEPTH]; NSK_DISPLAY3(" thread #%d (%s): %p\n", i, threadsName[i], (void*)thread); /* get frames count */ ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB3(GetFrameCount, jvmti, thread, &framesCount))) { nsk_jvmti_setFailStatus(); return NSK_TRUE; } NSK_DISPLAY1(" frames count: %d\n", (int)framesCount); /* get stack frames */ if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB6(GetStackTrace, jvmti, thread, 0, MAX_STACK_DEPTH, ! stackFrames, &stackDepth))) { nsk_jvmti_setFailStatus(); return NSK_TRUE; } NSK_DISPLAY1(" stack depth: %d\n", (int)stackDepth); --- 284,302 ---- jvmtiFrameInfo stackFrames[MAX_STACK_DEPTH]; NSK_DISPLAY3(" thread #%d (%s): %p\n", i, threadsName[i], (void*)thread); /* get frames count */ ! if (!NSK_JVMTI_VERIFY(jvmti->GetFrameCount(thread, &framesCount))) { nsk_jvmti_setFailStatus(); return NSK_TRUE; } NSK_DISPLAY1(" frames count: %d\n", (int)framesCount); /* get stack frames */ if (!NSK_JVMTI_VERIFY( ! jvmti->GetStackTrace(thread, 0, MAX_STACK_DEPTH, stackFrames, &stackDepth))) { nsk_jvmti_setFailStatus(); return NSK_TRUE; } NSK_DISPLAY1(" stack depth: %d\n", (int)stackDepth);
*** 353,363 **** static int clean() { int i; /* dispose global references to threads */ for (i = 0; i < THREADS_COUNT; i++) { ! NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsList[i])); } return NSK_TRUE; } --- 344,354 ---- static int clean() { int i; /* dispose global references to threads */ for (i = 0; i < THREADS_COUNT; i++) { ! NSK_TRACE(jni->DeleteGlobalRef(threadsList[i])); } return NSK_TRUE; }
*** 377,395 **** return; } /* check if event is for tested thread */ for (i = 0; i < THREADS_COUNT; i++) { ! if (NSK_CPP_STUB3(IsSameObject, jni, threadsList[i], thread)) { NSK_DISPLAY0("SUCCESS: expected THREAD_START event\n"); /* suspend thread */ NSK_DISPLAY3(" suspend starting thread #%d (%s): %p\n", i, threadsName[i], (void*)thread); ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB2(SuspendThread, jvmti, thread))) { nsk_jvmti_setFailStatus(); return; } eventsStart++; --- 368,385 ---- return; } /* check if event is for tested thread */ for (i = 0; i < THREADS_COUNT; i++) { ! if (jni->IsSameObject(threadsList[i], thread)) { NSK_DISPLAY0("SUCCESS: expected THREAD_START event\n"); /* suspend thread */ NSK_DISPLAY3(" suspend starting thread #%d (%s): %p\n", i, threadsName[i], (void*)thread); ! if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread))) { nsk_jvmti_setFailStatus(); return; } eventsStart++;
*** 412,430 **** return; } /* check if event is for tested thread */ for (i = 0; i < THREADS_COUNT; i++) { ! if (NSK_CPP_STUB3(IsSameObject, jni, threadsList[i], thread)) { NSK_DISPLAY0("SUCCESS: expected THREAD_END event\n"); /* suspend thread */ NSK_DISPLAY3(" suspend finishing thread #%d (%s): %p\n", i, threadsName[i], (void*)thread); ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB2(SuspendThread, jvmti, thread))) { nsk_jvmti_setFailStatus(); return; } eventsEnd++; --- 402,419 ---- return; } /* check if event is for tested thread */ for (i = 0; i < THREADS_COUNT; i++) { ! if (jni->IsSameObject(threadsList[i], thread)) { NSK_DISPLAY0("SUCCESS: expected THREAD_END event\n"); /* suspend thread */ NSK_DISPLAY3(" suspend finishing thread #%d (%s): %p\n", i, threadsName[i], (void*)thread); ! if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread))) { nsk_jvmti_setFailStatus(); return; } eventsEnd++;
*** 502,525 **** /* add capabilities for suspending thread */ { jvmtiCapabilities suspendCaps; memset(&suspendCaps, 0, sizeof(suspendCaps)); suspendCaps.can_suspend = 1; ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps))) return JNI_ERR; } /* set events callbacks */ { jvmtiEventCallbacks eventCallbacks; memset(&eventCallbacks, 0, sizeof(eventCallbacks)); eventCallbacks.ThreadStart = callbackThreadStart; eventCallbacks.ThreadEnd = callbackThreadEnd; ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB3(SetEventCallbacks, jvmti, ! &eventCallbacks, sizeof(eventCallbacks)))) return JNI_ERR; } /* register agent proc and arg */ if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) --- 491,511 ---- /* add capabilities for suspending thread */ { jvmtiCapabilities suspendCaps; memset(&suspendCaps, 0, sizeof(suspendCaps)); suspendCaps.can_suspend = 1; ! if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps))) return JNI_ERR; } /* set events callbacks */ { jvmtiEventCallbacks eventCallbacks; memset(&eventCallbacks, 0, sizeof(eventCallbacks)); eventCallbacks.ThreadStart = callbackThreadStart; eventCallbacks.ThreadEnd = callbackThreadEnd; ! if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) return JNI_ERR; } /* register agent proc and arg */ if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
< prev index next >