< prev index next >
test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp
Print this page
rev 52100 : 8212082: Remove the NSK_CPP_STUB macros for remaining vmTestbase/jvmti/[sS]*
Summary:
Reviewed-by:
*** 156,178 ****
/* allocate and clean threads list */
for (i = 0; i < THREADS_KINDS; i++) {
threadsCounts[i] = 0;
threadsList[i] = NULL;
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(Allocate, jvmti, (threadsCount * sizeof(jthread)),
(unsigned char**)&threadsList[i])))
return NSK_FALSE;
for (j = 0; j < threadsCount; j++) {
threadsList[i][j] = NULL;
}
}
/* 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;
--- 156,176 ----
/* allocate and clean threads list */
for (i = 0; i < THREADS_KINDS; i++) {
threadsCounts[i] = 0;
threadsList[i] = NULL;
! if (!NSK_JVMTI_VERIFY(jvmti->Allocate(threadsCount * sizeof(jthread),
(unsigned char**)&threadsList[i])))
return NSK_FALSE;
for (j = 0; j < threadsCount; j++) {
threadsList[i][j] = NULL;
}
}
/* 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;
*** 182,193 ****
if (!NSK_VERIFY(allThreadsList[i] != NULL))
return NSK_FALSE;
/* get thread name (info) */
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(GetThreadInfo, jvmti, allThreadsList[i], &threadInfo)))
return NSK_FALSE;
/* find by name */
if (threadInfo.name != NULL) {
for (j = 0; j < THREADS_KINDS; j++) {
--- 180,190 ----
if (!NSK_VERIFY(allThreadsList[i] != NULL))
return NSK_FALSE;
/* get thread name (info) */
! if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo)))
return NSK_FALSE;
/* find by name */
if (threadInfo.name != NULL) {
for (j = 0; j < THREADS_KINDS; j++) {
*** 200,211 ****
}
}
}
/* 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 */
notfound = 0;
for (i = 0; i < THREADS_KINDS; i++) {
--- 197,207 ----
}
}
}
/* deallocate all threads list */
! if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)allThreadsList)))
return NSK_FALSE;
/* check if all tested threads found */
notfound = 0;
for (i = 0; i < THREADS_KINDS; i++) {
*** 224,234 ****
/* make global refs */
for (i = 0; i < THREADS_KINDS; i++) {
for (j = 0; j < threadsCount; j++) {
if (!NSK_JNI_VERIFY(jni, (threadsList[i][j] =
! NSK_CPP_STUB2(NewGlobalRef, jni, threadsList[i][j])) != NULL))
return NSK_FALSE;
}
}
return NSK_TRUE;
--- 220,230 ----
/* make global refs */
for (i = 0; i < THREADS_KINDS; i++) {
for (j = 0; j < threadsCount; j++) {
if (!NSK_JNI_VERIFY(jni, (threadsList[i][j] =
! jni->NewGlobalRef(threadsList[i][j])) != NULL))
return NSK_FALSE;
}
}
return NSK_TRUE;
*** 242,268 ****
jvmtiError* results = NULL;
const char* kind = (suspend ? "suspending" : "resuming");
int i, j;
/* allocate results array */
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(Allocate, jvmti, resultsSize, (unsigned char**)&results))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
for (i = 0; i < THREADS_KINDS; i++) {
/* suspend or resume threads list */
if (suspend) {
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB4(SuspendThreadList, jvmti, threadsCount,
! threadsList[i], results)))
nsk_jvmti_setFailStatus();
} else {
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB4(ResumeThreadList, jvmti, threadsCount,
! threadsList[i], results)))
nsk_jvmti_setFailStatus();
}
/* check results */
for (j = 0; j < threadsCount; j++) {
--- 238,259 ----
jvmtiError* results = NULL;
const char* kind = (suspend ? "suspending" : "resuming");
int i, j;
/* allocate results array */
! if (!NSK_JVMTI_VERIFY(jvmti->Allocate(resultsSize, (unsigned char**)&results))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
for (i = 0; i < THREADS_KINDS; i++) {
/* suspend or resume threads list */
if (suspend) {
! if (!NSK_JVMTI_VERIFY(jvmti->SuspendThreadList(threadsCount, threadsList[i], results)))
nsk_jvmti_setFailStatus();
} else {
! if (!NSK_JVMTI_VERIFY(jvmti->ResumeThreadList(threadsCount, threadsList[i], results)))
nsk_jvmti_setFailStatus();
}
/* check results */
for (j = 0; j < threadsCount; j++) {
*** 275,286 ****
}
}
}
/* deallocate results array */
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)results))) {
nsk_jvmti_setFailStatus();
}
return NSK_TRUE;
}
--- 266,276 ----
}
}
}
/* deallocate results array */
! if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)results))) {
nsk_jvmti_setFailStatus();
}
return NSK_TRUE;
}
*** 293,309 ****
for (i = 0; i < THREADS_KINDS; i++) {
for (j = 0; j < threadsCount; j++) {
if (suspend) {
NSK_DISPLAY2(" suspend thread #%d (%s)\n", j, threadsName[i]);
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB2(SuspendThread, jvmti, threadsList[i][j])))
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY2(" resume thread #%d (%s)\n", j, threadsName[i]);
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB2(ResumeThread, jvmti, threadsList[i][j])))
nsk_jvmti_setFailStatus();
}
}
}
return NSK_TRUE;
--- 283,297 ----
for (i = 0; i < THREADS_KINDS; i++) {
for (j = 0; j < threadsCount; j++) {
if (suspend) {
NSK_DISPLAY2(" suspend thread #%d (%s)\n", j, threadsName[i]);
! if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(threadsList[i][j])))
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY2(" resume thread #%d (%s)\n", j, threadsName[i]);
! if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(threadsList[i][j])))
nsk_jvmti_setFailStatus();
}
}
}
return NSK_TRUE;
*** 327,338 ****
jlong t = 0;
NSK_DISPLAY2(" thread #%d (%s):\n", j, threadsName[i]);
/* get thread state */
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB3(GetThreadState, jvmti, threadsList[i][j], &state))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY2(" state = %s (%d)\n",
--- 315,325 ----
jlong t = 0;
NSK_DISPLAY2(" thread #%d (%s):\n", j, threadsName[i]);
/* get thread state */
! if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(threadsList[i][j], &state))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY2(" state = %s (%d)\n",
*** 371,388 ****
int i, j;
/* dispose global references to threads */
for (i = 0; i < THREADS_KINDS; i++) {
for (j = 0; j < threadsCount; j++) {
! NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threadsList[i][j]));
}
}
/* deallocate memory */
for (i = 0; i < THREADS_KINDS; i++) {
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threadsList[i])))
return NSK_FALSE;
threadsList[i] = NULL;
}
return NSK_TRUE;
--- 358,374 ----
int i, j;
/* dispose global references to threads */
for (i = 0; i < THREADS_KINDS; i++) {
for (j = 0; j < threadsCount; j++) {
! NSK_TRACE(jni->DeleteGlobalRef(threadsList[i][j]));
}
}
/* deallocate memory */
for (i = 0; i < THREADS_KINDS; i++) {
! if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadsList[i])))
return NSK_FALSE;
threadsList[i] = NULL;
}
return NSK_TRUE;
*** 463,474 ****
/* add specific capabilities for suspending thread */
{
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
! if (!NSK_JVMTI_VERIFY(
! NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
return JNI_ERR;
}
/* register agent proc and arg */
if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
--- 449,459 ----
/* add specific capabilities for suspending thread */
{
jvmtiCapabilities suspendCaps;
memset(&suspendCaps, 0, sizeof(suspendCaps));
suspendCaps.can_suspend = 1;
! if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
return JNI_ERR;
}
/* register agent proc and arg */
if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
< prev index next >