< 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,12 +98,11 @@
 
         /* 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))) {
+                    jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
 
             NSK_DISPLAY0("Let threads to start\n");

@@ -120,12 +119,11 @@
                     nsk_jvmti_sleep(TIMEOUT_DELTA);
                 }
             }
 
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
-                                            JVMTI_EVENT_THREAD_START, NULL))) {
+                    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,12 +148,11 @@
 
         /* 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))) {
+                    jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
 
             NSK_DISPLAY0("Let threads to finish\n");

@@ -172,12 +169,11 @@
                     nsk_jvmti_sleep(TIMEOUT_DELTA);
                 }
             }
 
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
-                                            JVMTI_EVENT_THREAD_END, NULL))) {
+                    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,12 +215,11 @@
  */
 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]))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(threadsList[i]))) {
             nsk_jvmti_setFailStatus();
         }
     }
     return NSK_TRUE;
 }

@@ -241,41 +236,39 @@
     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))
+    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 =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                                    THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != NULL))
+            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)
-            NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass, threadsFieldID)) != NULL))
+            jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != NULL))
         return NSK_FALSE;
 
     /* check array length */
     if (!NSK_JNI_VERIFY(jni, (threadsArrayLength =
-            NSK_CPP_STUB2(GetArrayLength, jni, threadsArray)) == THREADS_COUNT))
+            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)
-                NSK_CPP_STUB3(GetObjectArrayElement, jni, threadsArray, i)) != NULL))
+                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)
-                NSK_CPP_STUB2(NewGlobalRef, jni, threadsList[i])) != NULL))
+                jni->NewGlobalRef(threadsList[i])) != NULL))
             return NSK_FALSE;
     }
 
     return NSK_TRUE;
 }

@@ -291,21 +284,19 @@
     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))) {
+    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(
-            NSK_CPP_STUB6(GetStackTrace, jvmti, thread, 0, MAX_STACK_DEPTH,
-                                                    stackFrames, &stackDepth))) {
+            jvmti->GetStackTrace(thread, 0, MAX_STACK_DEPTH, stackFrames, &stackDepth))) {
         nsk_jvmti_setFailStatus();
         return NSK_TRUE;
     }
     NSK_DISPLAY1("    stack depth:  %d\n", (int)stackDepth);
 

@@ -353,11 +344,11 @@
 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]));
+        NSK_TRACE(jni->DeleteGlobalRef(threadsList[i]));
     }
 
     return NSK_TRUE;
 }
 

@@ -377,19 +368,18 @@
         return;
     }
 
     /* check if event is for tested thread */
     for (i = 0; i < THREADS_COUNT; i++) {
-        if (NSK_CPP_STUB3(IsSameObject, jni, threadsList[i], thread)) {
+        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(
-                    NSK_CPP_STUB2(SuspendThread, jvmti, thread))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
             eventsStart++;
 

@@ -412,19 +402,18 @@
         return;
     }
 
     /* check if event is for tested thread */
     for (i = 0; i < THREADS_COUNT; i++) {
-        if (NSK_CPP_STUB3(IsSameObject, jni, threadsList[i], thread)) {
+        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(
-                    NSK_CPP_STUB2(SuspendThread, jvmti, thread))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
             eventsEnd++;
 

@@ -502,24 +491,21 @@
     /* 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)))
+        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(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks))))
+        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 >