< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp

Print this page
rev 51942 : [mq]: refactor

*** 66,97 **** if (!nsk_jvmti_aod_getThreadName(jvmti, thread, threadName)) { nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, 0, jvmti, jni); return; } ! if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2( ! RawMonitorEnter, jvmti, eventsCounterMonitor))) { eventsCounter++; NSK_DISPLAY4("%s: VMObjectAlloc received in thread '%s' for instance of '%s' (eventsCounter: %d)\n", agentName, threadName, className, eventsCounter); if ((eventsCounter % 10) == 0) { NSK_DISPLAY1("%s: force garbage collection\n", agentName); ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB1(ForceGarbageCollection, jvmti))) success = 0; } if (eventsCounter == EXPECTED_EVENTS_NUMBER) { NSK_DISPLAY2("%s: all expected events were received (eventsCounter: %d)\n", agentName, eventsCounter); nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, success, jvmti, jni); } ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, eventsCounterMonitor))) { success = 0; } } else { success = 0; } --- 66,96 ---- if (!nsk_jvmti_aod_getThreadName(jvmti, thread, threadName)) { nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, 0, jvmti, jni); return; } ! if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventsCounterMonitor))) { eventsCounter++; NSK_DISPLAY4("%s: VMObjectAlloc received in thread '%s' for instance of '%s' (eventsCounter: %d)\n", agentName, threadName, className, eventsCounter); if ((eventsCounter % 10) == 0) { NSK_DISPLAY1("%s: force garbage collection\n", agentName); ! if (!NSK_JVMTI_VERIFY(jvmti->ForceGarbageCollection())) success = 0; } if (eventsCounter == EXPECTED_EVENTS_NUMBER) { NSK_DISPLAY2("%s: all expected events were received (eventsCounter: %d)\n", agentName, eventsCounter); nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, success, jvmti, jni); } ! if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventsCounterMonitor))) { success = 0; } } else { success = 0; }
*** 128,150 **** return JNI_ERR; if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL)) return JNI_ERR; ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "attach045-agent03-eventsCounterMonitor", &eventsCounterMonitor))) { return JNI_ERR; } memset(&caps, 0, sizeof(caps)); caps.can_generate_vm_object_alloc_events = 1; ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) { return JNI_ERR; } memset(&eventCallbacks,0, sizeof(eventCallbacks)); eventCallbacks.VMObjectAlloc = VMObjectAllocHandler; ! if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) { return JNI_ERR; } if (!(nsk_jvmti_aod_enableEvents(jvmti, testEvents, testEventsNumber))) { return JNI_ERR; --- 127,149 ---- return JNI_ERR; if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL)) return JNI_ERR; ! if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent03-eventsCounterMonitor", &eventsCounterMonitor))) { return JNI_ERR; } memset(&caps, 0, sizeof(caps)); caps.can_generate_vm_object_alloc_events = 1; ! if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) { return JNI_ERR; } memset(&eventCallbacks,0, sizeof(eventCallbacks)); eventCallbacks.VMObjectAlloc = VMObjectAllocHandler; ! if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) { return JNI_ERR; } if (!(nsk_jvmti_aod_enableEvents(jvmti, testEvents, testEventsNumber))) { return JNI_ERR;
< prev index next >