< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp

Print this page
rev 51716 : 8210665: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti[R-U] tests
Summary: Remove JNI_ENV macros from the tests
Reviewed-by:

@@ -26,25 +26,12 @@
 #include <inttypes.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
 
 typedef struct {

@@ -118,12 +105,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;
     }
 

@@ -182,17 +168,15 @@
     if (printdump == JNI_TRUE) {
         printf(">>> setting field modification watches ...\n");
     }
     for (i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
         if (watches[i].is_static == JNI_TRUE) {
-            watches[i].fid =
-                JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls),
-                    watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetStaticFieldID(
+                cls, watches[i].f_name, watches[i].f_sig);
         } else {
-            watches[i].fid =
-                JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls),
-                    watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetFieldID(
+                cls, watches[i].f_name, watches[i].f_sig);
         }
         err = jvmti->SetFieldModificationWatch(cls, watches[i].fid);
         if (err == JVMTI_ERROR_NONE) {
             watches[i].expected = n;
         } else {

@@ -238,8 +222,6 @@
         result = STATUS_FAILED;
     }
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
< prev index next >