< prev index next >

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

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

*** 25,49 **** #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 #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return --- 25,36 ----
*** 275,286 **** printf("MethodExit event: methodExitEventCount=%d\n", methodExitEventCount); if (method == midRun || method == midCheckPoint) { return; } if (method == midCountDownString) { ! ret_str = JNI_ENV_PTR(env)->GetStringUTFChars(JNI_ENV_ARG(env, ret_val), 0); ! exp_str = JNI_ENV_PTR(env)->GetStringUTFChars(JNI_ENV_ARG(env, str_exp), 0); printf("Expected string: \"%s\"\n", exp_str); printf("Returned string: \"%s\"\n", ret_str); if (was_popped_by_exception) { printf("Method was_popped_by_exception unexpectedly\n"); errCode = STATUS_FAILED; --- 262,273 ---- printf("MethodExit event: methodExitEventCount=%d\n", methodExitEventCount); if (method == midRun || method == midCheckPoint) { return; } if (method == midCountDownString) { ! ret_str = env->GetStringUTFChars(ret_val, 0); ! exp_str = env->GetStringUTFChars(str_exp, 0); printf("Expected string: \"%s\"\n", exp_str); printf("Returned string: \"%s\"\n", ret_str); if (was_popped_by_exception) { printf("Method was_popped_by_exception unexpectedly\n"); errCode = STATUS_FAILED;
*** 308,319 **** 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); if (res != JNI_OK || jvmti == NULL) { printf("Wrong error code of a valid call to GetEnv!\n"); return JNI_ERR; } --- 295,305 ---- printf("Printdump is turned on!\n"); printdump = JNI_TRUE; } ! res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); if (res != JNI_OK || jvmti == NULL) { printf("Wrong error code of a valid call to GetEnv!\n"); return JNI_ERR; }
*** 377,402 **** !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"); 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"); if (midCheckPoint == NULL) { printf("Cannot find Method ID for method checkPoint\n"); RETURN_FAILED; } ! midCountDownString = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls), ! "countDownString", sig_exp); if (midCountDownString == NULL) { printf("Cannot find Method ID for method countDownString\n"); RETURN_FAILED; } --- 363,385 ---- !caps.can_generate_method_exit_events || !caps.can_generate_single_step_events) { return; } ! midRun = env->GetMethodID(cls, "run", "()V"); if (midRun == NULL) { printf("Cannot find Method ID for method run\n"); RETURN_FAILED; } ! midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); if (midCheckPoint == NULL) { printf("Cannot find Method ID for method checkPoint\n"); RETURN_FAILED; } ! midCountDownString = env->GetMethodID(cls, "countDownString", sig_exp); if (midCountDownString == NULL) { printf("Cannot find Method ID for method countDownString\n"); RETURN_FAILED; }
*** 412,422 **** if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); RETURN_FAILED; } else { ! str_exp = (jstring) JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, expected_str)); framesExpected = depth; } } JNIEXPORT jint JNICALL --- 395,405 ---- if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); RETURN_FAILED; } else { ! str_exp = (jstring) env->NewGlobalRef(expected_str); framesExpected = depth; } } JNIEXPORT jint JNICALL
*** 428,435 **** } fflush(0); return errCode; } - #ifdef __cplusplus } - #endif --- 411,416 ----
< prev index next >