< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.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:

@@ -25,25 +25,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;

@@ -268,12 +255,11 @@
 #endif
 jint  Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
     jint res;
     jvmtiError err;
 
-    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;
     }
 

@@ -328,27 +314,22 @@
     }
 
     if (!caps.can_access_local_variables ||
         !caps.can_generate_breakpoint_events) return;
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-         "checkPoint", "()V");
-    mid1 = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "meth01", "()D");
-    mid2 = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "meth02", "(I)V");
-    mid3 = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-        "meth03", "()V");
-    mid4 = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-        "meth04", "(IJSDCFBZ)V");
+    mid = env->GetStaticMethodID(cls, "checkPoint", "()V");
+    mid1 = env->GetMethodID(cls, "meth01", "()D");
+    mid2 = env->GetMethodID(cls, "meth02", "(I)V");
+    mid3 = env->GetStaticMethodID(cls, "meth03", "()V");
+    mid4 = env->GetStaticMethodID(cls, "meth04", "(IJSDCFBZ)V");
     if (mid == 0 || mid1 == 0 || mid2 == 0 || mid3 == 0 || mid4 == 0) {
         printf("Cannot find Method ID for a method\n");
     }
     floatVal = f;
     doubleVal = d;
-    objVal = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, o));
-    arrVal = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, a));
+    objVal = env->NewGlobalRef(o);
+    arrVal = env->NewGlobalRef(a);
 
     err = jvmti->SetBreakpoint(mid, 0);
     if (err != JVMTI_ERROR_NONE) {
         printf("Failed to SetBreakpoint: %s (%d)\n", TranslateError(err), err);
         result = STATUS_FAILED;

@@ -367,8 +348,6 @@
 JNIEXPORT jint JNICALL
 Java_nsk_jvmti_SetLocalVariable_setlocal001_getRes(JNIEnv *env, jclass cls) {
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
< prev index next >