< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp

Print this page
rev 51942 : [mq]: refactor

*** 49,132 **** static void rawMonitorFunc(jvmtiEnv *jvmti_env, const char *msg) { jrawMonitorID _lock; NSK_DISPLAY1("%s: creating a raw monitor ...\n", msg); ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, ! jvmti_env, "_lock", &_lock))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to create a raw monitor\n\n", msg); return; } NSK_DISPLAY1("CHECK PASSED: %s: raw monitor created\n", msg); NSK_DISPLAY1("%s: entering the raw monitor ...\n", msg); ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, ! jvmti_env, _lock))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to enter the raw monitor\n\n", msg); } else { NSK_DISPLAY1("CHECK PASSED: %s: the raw monitor entered\n", msg); NSK_DISPLAY1("%s: waiting the raw monitor ...\n", msg); ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RawMonitorWait, ! jvmti_env, _lock, (jlong)10))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to wait the raw monitor\n\n", msg); } NSK_DISPLAY1("CHECK PASSED: %s: the raw monitor waited\n", msg); NSK_DISPLAY1("%s: notifying a single thread waiting on the raw monitor ...\n", msg); ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorNotify, ! jvmti_env, _lock))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to notify single thread\n\n", msg); } NSK_DISPLAY1("CHECK PASSED: %s: single thread notified\n", msg); NSK_DISPLAY1("%s: notifying all threads waiting on the raw monitor ...\n", msg); ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorNotifyAll, ! jvmti_env, _lock))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to notify all threads\n\n", msg); } NSK_DISPLAY1("CHECK PASSED: %s: all threads notified\n", msg); NSK_DISPLAY1("%s: exiting the raw monitor ...\n", msg); ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, ! jvmti_env, _lock))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to exit the raw monitor\n\n", msg); } NSK_DISPLAY1("CHECK PASSED: %s: the raw monitor exited\n", msg); } NSK_DISPLAY1("%s: destroying the raw monitor ...\n", msg); ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(DestroyRawMonitor, ! jvmti_env, _lock))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to destroy a raw monitor\n", msg); return; } --- 49,125 ---- static void rawMonitorFunc(jvmtiEnv *jvmti_env, const char *msg) { jrawMonitorID _lock; NSK_DISPLAY1("%s: creating a raw monitor ...\n", msg); ! if (!NSK_JVMTI_VERIFY(jvmti_env->CreateRawMonitor("_lock", &_lock))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to create a raw monitor\n\n", msg); return; } NSK_DISPLAY1("CHECK PASSED: %s: raw monitor created\n", msg); NSK_DISPLAY1("%s: entering the raw monitor ...\n", msg); ! if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(_lock))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to enter the raw monitor\n\n", msg); } else { NSK_DISPLAY1("CHECK PASSED: %s: the raw monitor entered\n", msg); NSK_DISPLAY1("%s: waiting the raw monitor ...\n", msg); ! if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorWait(_lock, (jlong)10))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to wait the raw monitor\n\n", msg); } NSK_DISPLAY1("CHECK PASSED: %s: the raw monitor waited\n", msg); NSK_DISPLAY1("%s: notifying a single thread waiting on the raw monitor ...\n", msg); ! if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorNotify(_lock))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to notify single thread\n\n", msg); } NSK_DISPLAY1("CHECK PASSED: %s: single thread notified\n", msg); NSK_DISPLAY1("%s: notifying all threads waiting on the raw monitor ...\n", msg); ! if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorNotifyAll(_lock))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to notify all threads\n\n", msg); } NSK_DISPLAY1("CHECK PASSED: %s: all threads notified\n", msg); NSK_DISPLAY1("%s: exiting the raw monitor ...\n", msg); ! if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(_lock))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to exit the raw monitor\n\n", msg); } NSK_DISPLAY1("CHECK PASSED: %s: the raw monitor exited\n", msg); } NSK_DISPLAY1("%s: destroying the raw monitor ...\n", msg); ! if (!NSK_JVMTI_VERIFY(jvmti_env->DestroyRawMonitor(_lock))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to destroy a raw monitor\n", msg); return; }
*** 135,146 **** } static void memoryFunc(jvmtiEnv *jvmti_env, const char *msg) { NSK_DISPLAY1("%s: allocating memory ...\n", msg); ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate, ! jvmti_env, MEM_SIZE, &mem))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to allocate memory\n\n", msg); return; } --- 128,138 ---- } static void memoryFunc(jvmtiEnv *jvmti_env, const char *msg) { NSK_DISPLAY1("%s: allocating memory ...\n", msg); ! if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(MEM_SIZE, &mem))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to allocate memory\n\n", msg); return; }
*** 148,159 **** NSK_DISPLAY1("CHECK PASSED: %s: memory has been allocated successfully\n", msg); NSK_DISPLAY1("%s: deallocating memory ...\n", msg); ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, ! jvmti_env, mem))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to deallocate memory\n\n", msg); } else --- 140,150 ---- NSK_DISPLAY1("CHECK PASSED: %s: memory has been allocated successfully\n", msg); NSK_DISPLAY1("%s: deallocating memory ...\n", msg); ! if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate(mem))) { result = STATUS_FAILED; NSK_COMPLAIN1("TEST FAILED: %s: unable to deallocate memory\n\n", msg); } else
*** 207,242 **** return JNI_ERR; /* add capability to generate compiled method events */ memset(&caps, 0, sizeof(jvmtiCapabilities)); caps.can_generate_garbage_collection_events = 1; ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, ! jvmti, &caps))) return JNI_ERR; ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, ! jvmti, &caps))) return JNI_ERR; if (!caps.can_generate_garbage_collection_events) NSK_DISPLAY0("Warning: generation of garbage collection events is not implemented\n"); /* set event callback */ NSK_DISPLAY0("setting event callbacks ...\n"); (void) memset(&callbacks, 0, sizeof(callbacks)); callbacks.VMDeath = &VMDeath; callbacks.GarbageCollectionFinish = &GarbageCollectionFinish; ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, ! jvmti, &callbacks, sizeof(callbacks)))) return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, ! jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) return JNI_ERR; ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, ! jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); return JNI_OK; } --- 198,228 ---- return JNI_ERR; /* add capability to generate compiled method events */ memset(&caps, 0, sizeof(jvmtiCapabilities)); caps.can_generate_garbage_collection_events = 1; ! if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; ! if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) return JNI_ERR; if (!caps.can_generate_garbage_collection_events) NSK_DISPLAY0("Warning: generation of garbage collection events is not implemented\n"); /* set event callback */ NSK_DISPLAY0("setting event callbacks ...\n"); (void) memset(&callbacks, 0, sizeof(callbacks)); callbacks.VMDeath = &VMDeath; callbacks.GarbageCollectionFinish = &GarbageCollectionFinish; ! if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)))) return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); ! if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) return JNI_ERR; ! if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); return JNI_OK; }
< prev index next >