< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.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 STATUS_FAILED 2 #define PASSED 0 static jvmtiEnv *jvmti = NULL; --- 25,36 ----
*** 121,132 **** if (options != NULL && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } ! if ((res = JNI_ENV_PTR(vm)->GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti), ! JVMTI_VERSION_1_1)) != JNI_OK) { printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res); return JNI_ERR; } err = jvmti->GetPotentialCapabilities(&caps); --- 108,118 ---- if (options != NULL && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } ! if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) { printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res); return JNI_ERR; } err = jvmti->GetPotentialCapabilities(&caps);
*** 195,209 **** return PASSED; } /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; ! classDef.class_byte_count = ! JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes)); ! classDef.class_bytes = (unsigned char *) ! JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes), ! NULL); if (fl == 2) { printf(">>>>>>>> Invoke RedefineClasses():\n"); printf("\tnew class byte count=%d\n", classDef.class_byte_count); } --- 181,192 ---- return PASSED; } /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; ! classDef.class_byte_count = env->GetArrayLength(classBytes); ! classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); if (fl == 2) { printf(">>>>>>>> Invoke RedefineClasses():\n"); printf("\tnew class byte count=%d\n", classDef.class_byte_count); }
*** 224,231 **** JNIEXPORT jint JNICALL Java_nsk_jvmti_unit_events_redefineCFLH_JvmtiTest_GetResult(JNIEnv *env, jclass cls) { return result; } - #ifdef __cplusplus } - #endif --- 207,212 ----
< prev index next >