< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLineNumberTable/linetab004/linetab004.cpp

Print this page
rev 51722 : 8210700: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti/unit tests
Summary:
Reviewed-by:

@@ -28,25 +28,12 @@
 #include <string.h>
 #include "jvmti.h"
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
 
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
 
 static jvmtiEnv *jvmti = NULL;

@@ -71,12 +58,11 @@
 
     if (options != NULL && strcmp(options, "printdump") == 0) {
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
     }
 

@@ -156,106 +142,96 @@
     }
 
     if (printdump == JNI_TRUE) {
         printf("\n Check methods of interface:\n");
     }
-    interf = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/unit/GetLineNumberTable/Interface004"));
+    interf = env->FindClass("nsk/jvmti/unit/GetLineNumberTable/Interface004");
     if (interf == NULL) {
         printf("Cannot get Interface class!\n");
         return STATUS_FAILED;
     }
 
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "instanceMeth0", "()I");
+    mid = env->GetMethodID(cls, "instanceMeth0", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
     }
     checkGetLineNumberTable(mid, "instanceMeth0", 1,
         JVMTI_ERROR_ABSENT_INFORMATION);
 
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "instanceMeth1", "()I");
+    mid = env->GetMethodID(cls, "instanceMeth1", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
     }
     checkGetLineNumberTable(mid, "instanceMeth1", 1,
         JVMTI_ERROR_ABSENT_INFORMATION);
 
     if (printdump == JNI_TRUE) {
         printf("\n Check methods of abstract class:\n");
     }
-    abstr = JNI_ENV_PTR(env)->GetSuperclass(JNI_ENV_ARG(env, cls));
+    abstr = env->GetSuperclass(cls);
     if (abstr == NULL) {
         printf("Cannot get super class!\n");
         return STATUS_FAILED;
     }
 
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, abstr),
-        "instanceMeth0", "()I");
+    mid = env->GetMethodID(abstr, "instanceMeth0", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
     }
     checkGetLineNumberTable(mid, "instanceMeth0", 1,
         JVMTI_ERROR_ABSENT_INFORMATION);
 
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, abstr),
-        "instanceMeth1", "()I");
+    mid = env->GetMethodID(abstr, "instanceMeth1", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
     }
     checkGetLineNumberTable(mid, "instanceMeth1", 0,
         JVMTI_ERROR_ABSENT_INFORMATION);
 
     if (printdump == JNI_TRUE) {
         printf("\n Check methods of regular class:\n");
     }
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "instanceMeth0", "()I");
+    mid = env->GetMethodID(cls, "instanceMeth0", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
     }
     checkGetLineNumberTable(mid, "instanceMeth0", 0,
         JVMTI_ERROR_ABSENT_INFORMATION);
 
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "instanceMeth1", "()I");
+    mid = env->GetMethodID(cls, "instanceMeth1", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
     }
     checkGetLineNumberTable(mid, "instanceMeth1", 0,
         JVMTI_ERROR_ABSENT_INFORMATION);
 
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "instanceMeth2", "()I");
+    mid = env->GetMethodID(cls, "instanceMeth2", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
     }
     checkGetLineNumberTable(mid, "instanceMeth2", 0,
         JVMTI_ERROR_ABSENT_INFORMATION);
 
     if (printdump == JNI_TRUE) {
         printf("\n Check native methods of regular class:\n");
     }
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "instanceNativeMeth", "()I");
+    mid = env->GetMethodID(cls, "instanceNativeMeth", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
     }
     checkGetLineNumberTable(mid, "instanceNativeMeth", 1,
         JVMTI_ERROR_NATIVE_METHOD);
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-        "staticNativeMeth", "()I");
+    mid = env->GetStaticMethodID(cls, "staticNativeMeth", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
     }
     checkGetLineNumberTable(mid, "staticNativeMeth", 1,

@@ -266,8 +242,6 @@
     }
 
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
< prev index next >