< prev index next >
test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp
Print this page
rev 52100 : 8212082: Remove the NSK_CPP_STUB macros for remaining vmTestbase/jvmti/[sS]*
Summary:
Reviewed-by:
*** 133,144 ****
/**
* Generate missed events (COMPILED_METHOD_LOAD only).
*/
static int generateEvents() {
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB2(GenerateEvents, jvmti, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
return NSK_TRUE;
}
--- 133,143 ----
/**
* Generate missed events (COMPILED_METHOD_LOAD only).
*/
static int generateEvents() {
! if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
return NSK_TRUE;
}
*** 166,177 ****
threadsDesc[i].method = (jmethodID)NULL;
threadsDesc[i].methodCompiled = NSK_FALSE;
}
/* get all live threads */
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(GetAllThreads, jvmti, &allThreadsCount, &allThreadsList)))
return NSK_FALSE;
if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL))
return NSK_FALSE;
--- 165,175 ----
threadsDesc[i].method = (jmethodID)NULL;
threadsDesc[i].methodCompiled = NSK_FALSE;
}
/* get all live threads */
! if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList)))
return NSK_FALSE;
if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL))
return NSK_FALSE;
*** 180,191 ****
jvmtiThreadInfo threadInfo;
if (!NSK_VERIFY(allThreadsList[i] != NULL))
return NSK_FALSE;
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(GetThreadInfo, jvmti, allThreadsList[i], &threadInfo)))
return NSK_FALSE;
if (threadInfo.name != NULL) {
int j;
--- 178,188 ----
jvmtiThreadInfo threadInfo;
if (!NSK_VERIFY(allThreadsList[i] != NULL))
return NSK_FALSE;
! if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo)))
return NSK_FALSE;
if (threadInfo.name != NULL) {
int j;
*** 198,209 ****
}
}
}
/* deallocate all threads list */
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)allThreadsList)))
return NSK_FALSE;
/* check if all tested threads found */
found = 0;
for (i = 0; i < THREADS_COUNT; i++) {
--- 195,205 ----
}
}
}
/* deallocate all threads list */
! if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)allThreadsList)))
return NSK_FALSE;
/* check if all tested threads found */
found = 0;
for (i = 0; i < THREADS_COUNT; i++) {
*** 220,235 ****
/* get threads class and frame method */
NSK_DISPLAY0("Find tested methods:\n");
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls =
! NSK_CPP_STUB2(GetObjectClass, jni, threadsDesc[i].thread)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method =
! NSK_CPP_STUB4(GetMethodID, jni, threadsDesc[i].cls,
! threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL))
return NSK_FALSE;
NSK_DISPLAY4(" thread #%d (%s): 0x%p (%s)\n",
i, threadsDesc[i].threadName,
(void*)threadsDesc[i].method,
--- 216,230 ----
/* get threads class and frame method */
NSK_DISPLAY0("Find tested methods:\n");
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls =
! jni->GetObjectClass(threadsDesc[i].thread)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method =
! jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL))
return NSK_FALSE;
NSK_DISPLAY4(" thread #%d (%s): 0x%p (%s)\n",
i, threadsDesc[i].threadName,
(void*)threadsDesc[i].method,
*** 237,250 ****
}
/* make global refs */
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread)
! NSK_CPP_STUB2(NewGlobalRef, jni, threadsDesc[i].thread)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass)
! NSK_CPP_STUB2(NewGlobalRef, jni, threadsDesc[i].cls)) != NULL))
return NSK_FALSE;
}
NSK_DISPLAY0("Enable tested events\n");
if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL))
--- 232,245 ----
}
/* make global refs */
for (i = 0; i < THREADS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread)
! jni->NewGlobalRef(threadsDesc[i].thread)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass)
! jni->NewGlobalRef(threadsDesc[i].cls)) != NULL))
return NSK_FALSE;
}
NSK_DISPLAY0("Enable tested events\n");
if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL))
*** 260,276 ****
int i;
for (i = 0; i < THREADS_COUNT; i++) {
if (suspend) {
NSK_DISPLAY2(" suspend thread #%d (%s)\n", i, threadsDesc[i].threadName);
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB2(SuspendThread, jvmti, threadsDesc[i].thread)))
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY2(" resume thread #%d (%s)\n", i, threadsDesc[i].threadName);
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB2(ResumeThread, jvmti, threadsDesc[i].thread)))
nsk_jvmti_setFailStatus();
}
}
return NSK_TRUE;
}
--- 255,269 ----
int i;
for (i = 0; i < THREADS_COUNT; i++) {
if (suspend) {
NSK_DISPLAY2(" suspend thread #%d (%s)\n", i, threadsDesc[i].threadName);
! if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(threadsDesc[i].thread)))
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY2(" resume thread #%d (%s)\n", i, threadsDesc[i].threadName);
! if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(threadsDesc[i].thread)))
nsk_jvmti_setFailStatus();
}
}
return NSK_TRUE;
}
*** 298,320 ****
/* make proper kind */
strcpy(kind, threadsDesc[i].methodCompiled ? "compiled " : "not compiled ");
NSK_DISPLAY2(" thread #%d (%s):\n", i, threadsDesc[i].threadName);
/* get frame count */
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(GetFrameCount, jvmti,
! threadsDesc[i].thread, &frameCount))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
NSK_DISPLAY1(" frameCount: %d\n", (int)frameCount);
/* get stack trace */
if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB6(GetStackTrace, jvmti, threadsDesc[i].thread,
! 0, MAX_STACK_SIZE, frameStack, &frameStackSize))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
NSK_DISPLAY1(" stack depth: %d\n", (int)frameStackSize);
--- 291,310 ----
/* make proper kind */
strcpy(kind, threadsDesc[i].methodCompiled ? "compiled " : "not compiled ");
NSK_DISPLAY2(" thread #%d (%s):\n", i, threadsDesc[i].threadName);
/* get frame count */
! if (!NSK_JVMTI_VERIFY(jvmti->GetFrameCount(threadsDesc[i].thread, &frameCount))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
NSK_DISPLAY1(" frameCount: %d\n", (int)frameCount);
/* get stack trace */
if (!NSK_JVMTI_VERIFY(
! jvmti->GetStackTrace(threadsDesc[i].thread, 0, MAX_STACK_SIZE, frameStack, &frameStackSize))) {
nsk_jvmti_setFailStatus();
return NSK_TRUE;
}
NSK_DISPLAY1(" stack depth: %d\n", (int)frameStackSize);
*** 356,367 ****
if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL))
return NSK_FALSE;
NSK_DISPLAY0("Dispose global references to threads\n");
for (i = 0; i < THREADS_COUNT; i++) {
! NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsDesc[i].thread));
! NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsDesc[i].cls));
}
return NSK_TRUE;
}
--- 346,357 ----
if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL))
return NSK_FALSE;
NSK_DISPLAY0("Dispose global references to threads\n");
for (i = 0; i < THREADS_COUNT; i++) {
! NSK_TRACE(jni->DeleteGlobalRef(threadsDesc[i].thread));
! NSK_TRACE(jni->DeleteGlobalRef(threadsDesc[i].cls));
}
return NSK_TRUE;
}
*** 490,512 ****
{
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
caps.can_suspend = 1;
caps.can_generate_compiled_method_load_events = 1;
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
return JNI_ERR;
}
{
jvmtiEventCallbacks eventCallbacks;
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.CompiledMethodLoad = callbackCompiledMethodLoad;
eventCallbacks.CompiledMethodUnload = callbackCompiledMethodUnload;
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(SetEventCallbacks, jvmti,
! &eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
return JNI_ERR;
--- 480,499 ----
{
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
caps.can_suspend = 1;
caps.can_generate_compiled_method_load_events = 1;
! if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
{
jvmtiEventCallbacks eventCallbacks;
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.CompiledMethodLoad = callbackCompiledMethodLoad;
eventCallbacks.CompiledMethodUnload = callbackCompiledMethodUnload;
! if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
return JNI_ERR;
< prev index next >