< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp

Print this page
rev 52050 : [mq]: refactor

*** 58,88 **** jmethodID methodID; jclass classObject; jstring jclassName; const char *className; ! if (!NSK_JNI_VERIFY(jni_env, (classObject = ! NSK_CPP_STUB2(GetObjectClass, jni_env, klass)) != NULL)) { nsk_jvmti_setFailStatus(); return; } if (!NSK_JNI_VERIFY(jni_env, (methodID = ! NSK_CPP_STUB4(GetMethodID, jni_env, classObject, ! "getName", "()Ljava/lang/String;")) != NULL)) { nsk_jvmti_setFailStatus(); return; } ! jclassName = (jstring) (jstring) (jstring) (jstring) (jstring) (jstring) (jstring) (jstring) (jstring) NSK_CPP_STUB3(CallObjectMethod, jni_env, klass, ! methodID); ! className = NSK_CPP_STUB3(GetStringUTFChars, jni_env, jclassName, 0); if ( className != NULL && (strcmp(className, EXPECTED_CLASS_NAME)==0) ) { ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock))) nsk_jvmti_setFailStatus(); switch (event) { case JVMTI_EVENT_CLASS_LOAD: classloadEventCount++; break; --- 58,85 ---- jmethodID methodID; jclass classObject; jstring jclassName; const char *className; ! if (!NSK_JNI_VERIFY(jni_env, (classObject = jni_env->GetObjectClass(klass)) != NULL)) { nsk_jvmti_setFailStatus(); return; } if (!NSK_JNI_VERIFY(jni_env, (methodID = ! jni_env->GetMethodID(classObject, "getName", "()Ljava/lang/String;")) != NULL)) { nsk_jvmti_setFailStatus(); return; } ! jclassName = (jstring) (jstring) (jstring) (jstring) (jstring) (jstring) (jstring) (jstring) (jstring) jni_env->CallObjectMethod(klass, methodID); ! className = jni_env->GetStringUTFChars(jclassName, 0); if ( className != NULL && (strcmp(className, EXPECTED_CLASS_NAME)==0) ) { ! if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock))) nsk_jvmti_setFailStatus(); switch (event) { case JVMTI_EVENT_CLASS_LOAD: classloadEventCount++; break;
*** 91,106 **** default: NSK_COMPLAIN1("Unexpected event %s", TranslateEvent(event)); nsk_jvmti_setFailStatus(); } ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock))) nsk_jvmti_setFailStatus(); } ! NSK_CPP_STUB3(ReleaseStringUTFChars, jni_env, jclassName, className); } JNIEXPORT void JNICALL cbClassLoad(jvmtiEnv* jvmti, JNIEnv* jni_env, jthread thread, jclass klass) { --- 88,103 ---- default: NSK_COMPLAIN1("Unexpected event %s", TranslateEvent(event)); nsk_jvmti_setFailStatus(); } ! if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock))) nsk_jvmti_setFailStatus(); } ! jni_env->ReleaseStringUTFChars(jclassName, className); } JNIEXPORT void JNICALL cbClassLoad(jvmtiEnv* jvmti, JNIEnv* jni_env, jthread thread, jclass klass) {
*** 115,127 **** /* ============================================================================= */ static int enableEvent(jvmtiEventMode enable, jvmtiEvent event) { ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB4(SetEventNotificationMode, jvmti, enable, ! event, NULL))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } return NSK_TRUE; --- 112,122 ---- /* ============================================================================= */ static int enableEvent(jvmtiEventMode enable, jvmtiEvent event) { ! if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } return NSK_TRUE;
*** 170,183 **** memset(&eventCallbacks, 0, sizeof(eventCallbacks)); eventCallbacks.ClassLoad = cbClassLoad; eventCallbacks.ClassPrepare = cbClassPrepare; ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB3(SetEventCallbacks, jvmti, ! &eventCallbacks, ! sizeof(eventCallbacks)))) return NSK_FALSE; return NSK_TRUE; } --- 165,175 ---- memset(&eventCallbacks, 0, sizeof(eventCallbacks)); eventCallbacks.ClassLoad = cbClassLoad; eventCallbacks.ClassPrepare = cbClassPrepare; ! if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) return NSK_FALSE; return NSK_TRUE; }
*** 185,196 **** /** Agent algorithm. */ static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) { nsk_jvmti_setFailStatus(); return; } jni = agentJNI; --- 177,187 ---- /** Agent algorithm. */ static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { ! if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { nsk_jvmti_setFailStatus(); return; } jni = agentJNI;
*** 229,240 **** NSK_DISPLAY0("Let debuggee to finish\n"); if (!nsk_jvmti_resumeSync()) return; ! if (!NSK_JVMTI_VERIFY( ! NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock))) nsk_jvmti_setFailStatus(); } /* ============================================================================= */ --- 220,230 ---- NSK_DISPLAY0("Let debuggee to finish\n"); if (!nsk_jvmti_resumeSync()) return; ! if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) nsk_jvmti_setFailStatus(); } /* ============================================================================= */
< prev index next >