< prev index next >
test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp
Print this page
rev 52100 : 8212082: Remove the NSK_CPP_STUB macros for remaining vmTestbase/jvmti/[sS]*
Summary:
Reviewed-by:
*** 141,153 ****
*/
static int enableEvents(jvmtiEventMode enable) {
int i;
for (i = 0; i < EVENTS_COUNT; i++) {
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB4(SetEventNotificationMode, jvmti, enable,
! eventsList[i], NULL))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
}
return NSK_TRUE;
--- 141,151 ----
*/
static int enableEvents(jvmtiEventMode enable) {
int i;
for (i = 0; i < EVENTS_COUNT; i++) {
! if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, eventsList[i], NULL))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
}
return NSK_TRUE;
*** 166,206 ****
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 enableEvents(JVMTI_ENABLE);
}
--- 164,202 ----
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 enableEvents(JVMTI_ENABLE);
}
*** 216,236 ****
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);
--- 212,230 ----
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);
*** 267,277 ****
/* disable events */
enableEvents(JVMTI_DISABLE);
/* dispose global references to threads */
for (i = 0; i < THREADS_COUNT; i++) {
! NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsList[i]));
}
return NSK_TRUE;
}
--- 261,271 ----
/* disable events */
enableEvents(JVMTI_DISABLE);
/* dispose global references to threads */
for (i = 0; i < THREADS_COUNT; i++) {
! NSK_TRACE(jni->DeleteGlobalRef(threadsList[i]));
}
return NSK_TRUE;
}
*** 291,301 ****
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");
eventsStart++;
/* check thread on event */
checkThread(thread, i, "starting");
--- 285,295 ----
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");
eventsStart++;
/* check thread on event */
checkThread(thread, i, "starting");
*** 318,328 ****
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");
eventsEnd++;
/* check thread on event */
checkThread(thread, i, "finishing");
--- 312,322 ----
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");
eventsEnd++;
/* check thread on event */
checkThread(thread, i, "finishing");
*** 401,413 ****
{
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)))
--- 395,405 ----
{
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 >