< prev index next >
test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetConstantPool/getcpool001/getcpool001.cpp
Print this page
rev 51730 : 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
static jvmtiCapabilities caps;
--- 25,36 ----
*** 112,123 ****
#endif
jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jvmtiError err;
jint res;
! res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (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;
}
--- 99,109 ----
#endif
jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jvmtiError err;
jint res;
! 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;
}
*** 174,185 ****
!caps.can_generate_breakpoint_events ||
!caps.can_generate_single_step_events) {
return;
}
! 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;
}
--- 160,170 ----
!caps.can_generate_breakpoint_events ||
!caps.can_generate_single_step_events) {
return;
}
! midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V");
if (midCheckPoint == NULL) {
printf("Cannot find Method ID for method checkPoint\n");
RETURN_FAILED;
}
*** 188,199 ****
printf("(SetBreakpoint) unexpected error: %s (%d)\n",
TranslateError(err), err);
RETURN_FAILED;
}
! err = jvmti->SetEventNotificationMode(JVMTI_ENABLE,
! JVMTI_EVENT_BREAKPOINT, NULL);
if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable BREAKPOINT event: %s (%d)\n",
TranslateError(err), err);
RETURN_FAILED;
}
--- 173,183 ----
printf("(SetBreakpoint) unexpected error: %s (%d)\n",
TranslateError(err), err);
RETURN_FAILED;
}
! err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL);
if (err != JVMTI_ERROR_NONE) {
printf("Failed to enable BREAKPOINT event: %s (%d)\n",
TranslateError(err), err);
RETURN_FAILED;
}
*** 203,210 ****
JNIEXPORT jint JNICALL
Java_nsk_jvmti_unit_GetConstantPool_getcpool001_check(JNIEnv *env, jclass cls) {
return errCode;
}
- #ifdef __cplusplus
}
- #endif
--- 187,192 ----
< prev index next >