< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001/classload001.cpp

Print this page
rev 51942 : [mq]: refactor

*** 96,128 **** return -1; /* the signature not found */ } static void lock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) { ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, ! jvmti_env, countLock))) ! NSK_CPP_STUB2(FatalError, jni_env, ! "failed to enter a raw monitor\n"); } static void unlock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) { ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, ! jvmti_env, countLock))) ! NSK_CPP_STUB2(FatalError, jni_env, ! "failed to exit a raw monitor\n"); } /** callback functions **/ void JNICALL ClassLoad(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jclass klass) { int i = 0; char *sig, *generic; lock(jvmti_env, env); ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, ! jvmti_env, klass, &sig, &generic))) { result = STATUS_FAILED; NSK_COMPLAIN0("TEST FAILURE: unable to obtain a class signature\n"); } if ((i = findSig(sig, 1)) != -1) { --- 96,123 ---- return -1; /* the signature not found */ } static void lock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) { ! if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(countLock))) ! jni_env->FatalError("failed to enter a raw monitor\n"); } static void unlock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) { ! if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(countLock))) ! jni_env->FatalError("failed to exit a raw monitor\n"); } /** callback functions **/ void JNICALL ClassLoad(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jclass klass) { int i = 0; char *sig, *generic; lock(jvmti_env, env); ! if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &sig, &generic))) { result = STATUS_FAILED; NSK_COMPLAIN0("TEST FAILURE: unable to obtain a class signature\n"); } if ((i = findSig(sig, 1)) != -1) {
*** 183,206 **** nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) return JNI_ERR; initCounters(); ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, ! jvmti, "_counter_lock", &countLock))) return JNI_ERR; NSK_DISPLAY0("setting event callbacks ...\n"); (void) memset(&callbacks, 0, sizeof(callbacks)); callbacks.ClassLoad = &ClassLoad; ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, ! jvmti, &callbacks, sizeof(callbacks)))) return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling ClassLoad event ...\n"); ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, ! jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL))) return JNI_ERR; NSK_DISPLAY0("the event enabled\n"); return JNI_OK; } --- 178,198 ---- nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) return JNI_ERR; initCounters(); ! if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_counter_lock", &countLock))) return JNI_ERR; NSK_DISPLAY0("setting event callbacks ...\n"); (void) memset(&callbacks, 0, sizeof(callbacks)); callbacks.ClassLoad = &ClassLoad; ! if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)))) return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling ClassLoad event ...\n"); ! if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL))) return JNI_ERR; NSK_DISPLAY0("the event enabled\n"); return JNI_OK; }
< prev index next >