< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp

Print this page
rev 52050 : [mq]: refactor

@@ -43,27 +43,25 @@
                                         jthread thread,
                                         jclass klass) {
     char * className;
     className=NULL;
 
-    if (!NSK_JVMTI_VERIFY (NSK_CPP_STUB4(GetClassSignature,
-                    jvmti_env, klass, &className, NULL) ) ) {
+    if (!NSK_JVMTI_VERIFY (jvmti_env->GetClassSignature(klass, &className, NULL) ) ) {
         NSK_COMPLAIN0("#error Agent :: while getting classname.\n");
         nsk_jvmti_agentFailed();
     } else {
         if (strcmp(className, CLASS_NAME) == 0) {
             if (nsk_jvmti_enableNotification(jvmti_env, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL) == NSK_TRUE ) {
                 NSK_DISPLAY0(" Agent :: notification enabled for COMPILED_METHOD_LOAD.\n");
-                if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(GenerateEvents, jvmti_env,
-                                JVMTI_EVENT_COMPILED_METHOD_LOAD ) )) {
+                if ( ! NSK_JVMTI_VERIFY (jvmti_env->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD) )) {
                     NSK_COMPLAIN0("#error Agent :: occured while enabling compiled method events.\n");
                     nsk_jvmti_agentFailed();
                 }
             }
         }
 
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)className))) {
+        if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)className))) {
             NSK_COMPLAIN1("#error Agent :: failed to Deallocate className = %s.", className);
             nsk_jvmti_agentFailed();
         }
     }
 }

@@ -76,30 +74,27 @@
         jint map_length,
         const jvmtiAddrLocationMap* map,
         const void* compile_info) {
     jclass threadClass;
     if (redefineNumber == 0) {
-        if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB3(GetMethodDeclaringClass,
-                        jvmti_env, method, &threadClass) ) ) {
+        if ( ! NSK_JVMTI_VERIFY (jvmti_env->GetMethodDeclaringClass(method, &threadClass) ) ) {
             NSK_COMPLAIN0("#error Agent :: while geting the declaring class.\n");
             nsk_jvmti_agentFailed();
         } else {
             char *className;
             char *methodName;
 
             className = NULL;
             methodName = NULL;
 
-            if ( ! NSK_JVMTI_VERIFY (NSK_CPP_STUB4(GetClassSignature,
-                            jvmti_env, threadClass, &className, NULL) ) ) {
+            if ( ! NSK_JVMTI_VERIFY (jvmti_env->GetClassSignature(threadClass, &className, NULL) ) ) {
                 NSK_COMPLAIN0("#error Agent :: while getting classname.\n");
                 nsk_jvmti_agentFailed();
                 return;
             }
 
-            if ( ! NSK_JVMTI_VERIFY (NSK_CPP_STUB5(GetMethodName,
-                            jvmti_env, method, &methodName, NULL, NULL) ) ) {
+            if ( ! NSK_JVMTI_VERIFY (jvmti_env->GetMethodName(method, &methodName, NULL, NULL) ) ) {
                 NSK_COMPLAIN0("#error Agent :: while getting methodname.\n");
                 nsk_jvmti_agentFailed();
                 return;
             }
 

@@ -119,17 +114,17 @@
                     nsk_jvmti_agentFailed();
                 }
             }
 
             if ( className != NULL ) {
-                if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)className))) {
+                if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)className))) {
                     NSK_COMPLAIN1("#error Agent :: failed to Deallocate className = %s.", className);
                     nsk_jvmti_agentFailed();
                 }
             }
             if ( methodName != NULL ) {
-                if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)methodName))) {
+                if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)methodName))) {
                     NSK_COMPLAIN1("#error Agent :: failed to Deallocate methodName = %s.", methodName);
                     nsk_jvmti_agentFailed();
                 }
             }
         }

@@ -147,12 +142,11 @@
     return JNI_VERSION_1_8;
 }
 #endif
 jint  Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
     redefineNumber=0;
-    if ( ! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv, vm,
-                    (void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
+    if ( ! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
         NSK_DISPLAY0("#error Agent :: Could not load JVMTI interface.\n");
         return JNI_ERR;
         } else {
         jvmtiCapabilities caps;
         jvmtiEventCallbacks eventCallbacks;

@@ -164,20 +158,18 @@
         caps.can_redefine_classes = 1;
         caps.can_suspend = 1;
         caps.can_pop_frame = 1;
         caps.can_generate_all_class_hook_events = 1;
         caps.can_generate_compiled_method_load_events = 1;
-        if (! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(AddCapabilities, jvmti, &caps) )) {
+        if (! NSK_JVMTI_VERIFY (jvmti->AddCapabilities(&caps) )) {
             NSK_DISPLAY0("#error Agent :: occured while adding capabilities.\n");
             return JNI_ERR;
         }
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.ClassPrepare =callbackClassPrepare;
         eventCallbacks.CompiledMethodLoad=callbackCompiledMethodLoad;
-        if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                        &eventCallbacks, sizeof(eventCallbacks)))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             NSK_COMPLAIN0("#error Agent :: occured while setting event callback.\n");
             return JNI_ERR;
         }
         if ( nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, NULL) == NSK_TRUE) {
             NSK_DISPLAY0(" Agent :: Notifications are enabled.\n");

@@ -192,11 +184,11 @@
 JNIEXPORT void JNICALL
 Java_nsk_jvmti_scenarios_hotswap_HS203_hs203t004_hs203t004_suspendThread(JNIEnv * jni,
         jobject clas,
         jthread thread) {
     NSK_DISPLAY0(" Agent :: Suspending Thread.\n");
-    if (  NSK_JVMTI_VERIFY( NSK_CPP_STUB2(SuspendThread, jvmti, thread) ) ) {
+    if (  NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread) ) ) {
         NSK_DISPLAY0(" Agent :: Succeded in suspending.\n");
     } else {
         NSK_COMPLAIN0("#error Agent :: occured while suspending thread.\n");
         nsk_jvmti_agentFailed();
     }

@@ -209,22 +201,22 @@
     jboolean retvalue;
     jint state;
 
     NSK_DISPLAY0(" Agent :: nsk.jvmti.scenarios.hotswap.HS203.hs203t004.popThreadFrame(... ).\n");
     retvalue = JNI_FALSE;
-    if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB3(GetThreadState, jvmti,
-                    thread, &state) ) ) {
+    if ( ! NSK_JVMTI_VERIFY (jvmti->GetThreadState(thread, &state) ) ) {
         NSK_COMPLAIN0("#error Agent :: while getting thread's state.\n");
         nsk_jvmti_agentFailed();
     } else {
         if ( state & JVMTI_THREAD_STATE_SUSPENDED) {
-            if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB2(PopFrame, jvmti, thread) ) ){
+            if ( ! NSK_JVMTI_VERIFY(jvmti->PopFrame(thread) ) ){
                 NSK_DISPLAY0("#error Agent :: occured while poping thread's frame.\n");
                 nsk_jvmti_agentFailed();
             } else {
-                if ( NSK_JVMTI_VERIFY( NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
-                                JVMTI_DISABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL) ) ) {
+                if ( NSK_JVMTI_VERIFY(
+                        jvmti->SetEventNotificationMode(JVMTI_DISABLE,
+                                                        JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL) ) ) {
                     NSK_DISPLAY0(" Agent :: Disabled JVMTI_EVENT_COMPILED_METHOD_LOAD.\n");
                     retvalue = JNI_TRUE;
                 } else {
                     NSK_COMPLAIN0("#error Agent :: Failed to disable JVMTI_EVENT_COMPILED_METHOD_LOAD.\n");
                     nsk_jvmti_agentFailed();

@@ -243,11 +235,11 @@
         jclass clas,
         jthread thread) {
     jboolean retvalue;
 
     retvalue = JNI_FALSE;
-    if ( NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(ResumeThread, jvmti, thread))) {
+    if ( NSK_JVMTI_VERIFY (jvmti->ResumeThread(thread))) {
         NSK_DISPLAY0(" Agent :: Thread resumed.\n");
         retvalue= JNI_TRUE;
     } else {
         NSK_COMPLAIN0("#error Agent :: Failed to resume the thread.\n");
         nsk_jvmti_agentFailed();
< prev index next >