< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretobj/earlyretobj.cpp

Print this page
rev 51722 : 8210700: Clean up JNI_ENV_ARG and factorize the macros for vmTestbase/jvmti/unit tests
Summary:
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
 
 #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return

@@ -275,11 +262,11 @@
     printf("MethodExit event: methodExitEventCount=%d\n", methodExitEventCount);
     if (method == midRun || method == midCheckPoint) {
         return;
     }
     if (method == midCountDownObject) {
-        if (!JNI_ENV_PTR(env)->IsSameObject(JNI_ENV_ARG(env, ret_val), val_exp)) {
+        if (!env->IsSameObject(ret_val, val_exp)) {
             printf("Wrong ForceEarlyReturnObject return value: 0x%p\n", ret_val);
             printf("expected: 0x%p\n", val_exp);
             errCode = STATUS_FAILED;
         }
         if (was_popped_by_exception) {

@@ -309,12 +296,11 @@
         printf("Printdump is turned on!\n");
 
         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 error code from a valid call to GetEnv!\n");
         return JNI_ERR;
     }
 

@@ -378,26 +364,23 @@
         !caps.can_generate_method_exit_events ||
         !caps.can_generate_single_step_events) {
         return;
     }
 
-    midRun = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "run", "()V");
+    midRun = env->GetMethodID(cls, "run", "()V");
     if (midRun == NULL) {
         printf("Cannot find Method ID for method run\n");
         RETURN_FAILED;
     }
 
-    midCheckPoint = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "checkPoint", "()V");
+    midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V");
     if (midCheckPoint == NULL) {
         printf("Cannot find Method ID for method checkPoint\n");
         RETURN_FAILED;
     }
 
-    midCountDownObject = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "countDownObject", sig_exp);
+    midCountDownObject = env->GetMethodID(cls, "countDownObject", sig_exp);
     if (midCountDownObject == NULL) {
         printf("Cannot find Method ID for method countDownObject\n");
         RETURN_FAILED;
     }
 

@@ -413,11 +396,11 @@
     if (err != JVMTI_ERROR_NONE) {
         printf("Failed to enable BREAKPOINT event: %s (%d)\n",
                TranslateError(err), err);
         RETURN_FAILED;
     } else {
-        val_exp = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, ret_obj));
+        val_exp = env->NewGlobalRef(ret_obj);
         framesExpected = depth;
     }
 }
 
 JNIEXPORT jint JNICALL

@@ -438,8 +421,6 @@
     printf("\nReturned jobject: %#" PRIxPTR "\n", (uintptr_t)obj);
     fflush(0);
     return;
 }
 
-#ifdef __cplusplus
 }
-#endif
< prev index next >