8215160: Normalize spaces for remaining vmTestbase tests
Add spaces where needed Reviewed-by: sspitsyn, amenkov
This commit is contained in:
parent
9be447e22f
commit
019bd7cf2b
@ -68,7 +68,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
|
|||||||
jvmtiEnv * jvmti;
|
jvmtiEnv * jvmti;
|
||||||
nsk_printf("Agent:: VM.. Started..\n");
|
nsk_printf("Agent:: VM.. Started..\n");
|
||||||
rc=vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1);
|
rc=vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1);
|
||||||
if (rc!= JNI_OK) {
|
if (rc != JNI_OK) {
|
||||||
nsk_printf("Agent:: Could not load JVMTI interface \n");
|
nsk_printf("Agent:: Could not load JVMTI interface \n");
|
||||||
return JNI_ERR;
|
return JNI_ERR;
|
||||||
} else {
|
} else {
|
||||||
|
@ -67,7 +67,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
|
|||||||
jvmtiEnv * jvmti;
|
jvmtiEnv * jvmti;
|
||||||
nsk_printf("Agent:: VM.. Started..\n");
|
nsk_printf("Agent:: VM.. Started..\n");
|
||||||
rc=vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1);
|
rc=vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1);
|
||||||
if (rc!= JNI_OK) {
|
if (rc != JNI_OK) {
|
||||||
nsk_printf("Agent:: Could not load JVMTI interface \n");
|
nsk_printf("Agent:: Could not load JVMTI interface \n");
|
||||||
return JNI_ERR;
|
return JNI_ERR;
|
||||||
} else {
|
} else {
|
||||||
|
@ -68,7 +68,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
|
|||||||
jvmtiEnv * jvmti;
|
jvmtiEnv * jvmti;
|
||||||
nsk_printf("Agent:: VM.. Started..\n");
|
nsk_printf("Agent:: VM.. Started..\n");
|
||||||
rc=vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1);
|
rc=vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1);
|
||||||
if (rc!= JNI_OK) {
|
if (rc != JNI_OK) {
|
||||||
nsk_printf("Agent:: Could not load JVMTI interface \n");
|
nsk_printf("Agent:: Could not load JVMTI interface \n");
|
||||||
return JNI_ERR;
|
return JNI_ERR;
|
||||||
} else {
|
} else {
|
||||||
|
@ -46,7 +46,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env,
|
|||||||
nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL);
|
nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL);
|
||||||
nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName,
|
nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName,
|
||||||
sizeof(fileName)/sizeof(char));
|
sizeof(fileName)/sizeof(char));
|
||||||
if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName) == NSK_TRUE) {
|
if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName) == NSK_TRUE) {
|
||||||
nsk_printf("Redefine successful ..\n");
|
nsk_printf("Redefine successful ..\n");
|
||||||
} else {
|
} else {
|
||||||
nsk_printf("# error :: Redefine failed..\n");
|
nsk_printf("# error :: Redefine failed..\n");
|
||||||
@ -70,7 +70,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
|
|||||||
jint rc ;
|
jint rc ;
|
||||||
nsk_printf("Agent:: VM.. Started..\n");
|
nsk_printf("Agent:: VM.. Started..\n");
|
||||||
rc=vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1);
|
rc=vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1);
|
||||||
if (rc!= JNI_OK) {
|
if (rc != JNI_OK) {
|
||||||
nsk_printf("Agent:: Could not load JVMTI interface \n");
|
nsk_printf("Agent:: Could not load JVMTI interface \n");
|
||||||
return JNI_ERR;
|
return JNI_ERR;
|
||||||
} else {
|
} else {
|
||||||
|
@ -205,8 +205,8 @@ static void checkCall(JNIEnv *env
|
|||||||
if ((exFndCalls > 0 && fnd_calls >= exFndCalls) || (fnd_calls == exFndCalls)) {
|
if ((exFndCalls > 0 && fnd_calls >= exFndCalls) || (fnd_calls == exFndCalls)) {
|
||||||
NSK_DISPLAY5("CHECK PASSED: %s: the %s JNI function FindClass() has been %s during %s phase\n\t%d intercepted call(s) as expected\n"
|
NSK_DISPLAY5("CHECK PASSED: %s: the %s JNI function FindClass() has been %s during %s phase\n\t%d intercepted call(s) as expected\n"
|
||||||
, callBackFunc
|
, callBackFunc
|
||||||
, (step==1) ? "tested" : "original"
|
, (step == 1) ? "tested" : "original"
|
||||||
, (step==1) ? "redirected" : "restored"
|
, (step == 1) ? "redirected" : "restored"
|
||||||
, msg
|
, msg
|
||||||
, fnd_calls
|
, fnd_calls
|
||||||
);
|
);
|
||||||
@ -222,8 +222,8 @@ static void checkCall(JNIEnv *env
|
|||||||
|
|
||||||
NSK_COMPLAIN6("TEST FAILED: %s: the %s JNI function FindClass() has not been %s during %s phase\n\t%d intercepted call(s) instead of %d as expected\n"
|
NSK_COMPLAIN6("TEST FAILED: %s: the %s JNI function FindClass() has not been %s during %s phase\n\t%d intercepted call(s) instead of %d as expected\n"
|
||||||
, callBackFunc
|
, callBackFunc
|
||||||
, (step==1) ? "tested" : "original"
|
, (step == 1) ? "tested" : "original"
|
||||||
, (step==1) ? "redirected" : "restored"
|
, (step == 1) ? "redirected" : "restored"
|
||||||
, msg
|
, msg
|
||||||
, fnd_calls
|
, fnd_calls
|
||||||
, exFndCalls
|
, exFndCalls
|
||||||
|
@ -236,17 +236,17 @@ void checkCall(int step, int exJniCalls, int exJavaCalls) {
|
|||||||
if (meth_info[i].jni_calls == exJniCalls) {
|
if (meth_info[i].jni_calls == exJniCalls) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("\nCHECK PASSED: the %s JNI function for calling method \"%s %s\" has been %s\n\t%d intercepted call(s) as expected\n",
|
printf("\nCHECK PASSED: the %s JNI function for calling method \"%s %s\" has been %s\n\t%d intercepted call(s) as expected\n",
|
||||||
(step==1)?"tested":"original",
|
(step == 1) ? "tested" : "original",
|
||||||
meth_info[i].m_name, meth_info[i].m_sign,
|
meth_info[i].m_name, meth_info[i].m_sign,
|
||||||
(step==1)?"redirected":"restored",
|
(step == 1) ? "redirected" : "restored",
|
||||||
meth_info[i].jni_calls);
|
meth_info[i].jni_calls);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = STATUS_FAILED;
|
result = STATUS_FAILED;
|
||||||
printf("\nTEST FAILED: the %s JNI function for calling method \"%s %s\" has not been %s\n\t%d intercepted call(s) instead of %d as expected\n",
|
printf("\nTEST FAILED: the %s JNI function for calling method \"%s %s\" has not been %s\n\t%d intercepted call(s) instead of %d as expected\n",
|
||||||
(step==1)?"tested":"original",
|
(step == 1) ? "tested" : "original",
|
||||||
meth_info[i].m_name, meth_info[i].m_sign,
|
meth_info[i].m_name, meth_info[i].m_sign,
|
||||||
(step==1)?"redirected":"restored",
|
(step == 1) ? "redirected" : "restored",
|
||||||
meth_info[i].jni_calls, exJniCalls);
|
meth_info[i].jni_calls, exJniCalls);
|
||||||
}
|
}
|
||||||
meth_info[i].jni_calls = 0; /* zeroing interception counter */
|
meth_info[i].jni_calls = 0; /* zeroing interception counter */
|
||||||
@ -255,13 +255,13 @@ void checkCall(int step, int exJniCalls, int exJavaCalls) {
|
|||||||
if (verbose)
|
if (verbose)
|
||||||
printf("CHECK PASSED: the java method \"%s %s\" has been really invoked by the %s JNI function\n",
|
printf("CHECK PASSED: the java method \"%s %s\" has been really invoked by the %s JNI function\n",
|
||||||
meth_info[i].m_name, meth_info[i].m_sign,
|
meth_info[i].m_name, meth_info[i].m_sign,
|
||||||
(step==1)?"redirected":"restored");
|
(step == 1) ? "redirected" : "restored");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = STATUS_FAILED;
|
result = STATUS_FAILED;
|
||||||
printf("TEST FAILED: the tested java method \"%s %s\" has not been really invoked by the %s JNI function\n",
|
printf("TEST FAILED: the tested java method \"%s %s\" has not been really invoked by the %s JNI function\n",
|
||||||
meth_info[i].m_name, meth_info[i].m_sign,
|
meth_info[i].m_name, meth_info[i].m_sign,
|
||||||
(step==1)?"redirected":"restored");
|
(step == 1) ? "redirected" : "restored");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,15 +202,15 @@ void checkCall(int step, int exThrCalls, int exThrNewCalls, int exExcOccCalls) {
|
|||||||
if (throw_calls == exThrCalls) {
|
if (throw_calls == exThrCalls) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("\nCHECK PASSED: the %s JNI function Throw() has been %s:\n\t%d intercepted call(s) as expected\n",
|
printf("\nCHECK PASSED: the %s JNI function Throw() has been %s:\n\t%d intercepted call(s) as expected\n",
|
||||||
(step==1)?"tested":"original",
|
(step == 1) ? "tested" : "original",
|
||||||
(step==1)?"redirected":"restored",
|
(step == 1) ? "redirected" : "restored",
|
||||||
throw_calls);
|
throw_calls);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = STATUS_FAILED;
|
result = STATUS_FAILED;
|
||||||
printf("\nTEST FAILED: the %s JNI function Throw() has not been %s:\n\t%d intercepted call(s) instead of %d as expected\n",
|
printf("\nTEST FAILED: the %s JNI function Throw() has not been %s:\n\t%d intercepted call(s) instead of %d as expected\n",
|
||||||
(step==1)?"tested":"original",
|
(step == 1) ? "tested" : "original",
|
||||||
(step==1)?"redirected":"restored",
|
(step == 1) ? "redirected" : "restored",
|
||||||
throw_calls, exThrCalls);
|
throw_calls, exThrCalls);
|
||||||
}
|
}
|
||||||
throw_calls = 0; /* zeroing an interception counter */
|
throw_calls = 0; /* zeroing an interception counter */
|
||||||
@ -218,15 +218,15 @@ void checkCall(int step, int exThrCalls, int exThrNewCalls, int exExcOccCalls) {
|
|||||||
if (thrownew_calls == exThrNewCalls) {
|
if (thrownew_calls == exThrNewCalls) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("\nCHECK PASSED: the %s JNI function ThrowNew() has been %s:\n\t%d intercepted call(s) as expected\n",
|
printf("\nCHECK PASSED: the %s JNI function ThrowNew() has been %s:\n\t%d intercepted call(s) as expected\n",
|
||||||
(step==1)?"tested":"original",
|
(step == 1) ? "tested" : "original",
|
||||||
(step==1)?"redirected":"restored",
|
(step == 1) ? "redirected" : "restored",
|
||||||
thrownew_calls);
|
thrownew_calls);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = STATUS_FAILED;
|
result = STATUS_FAILED;
|
||||||
printf("\nTEST FAILED: the %s JNI function ThrowNew() has not been %s:\n\t%d intercepted call(s) instead of %d as expected\n",
|
printf("\nTEST FAILED: the %s JNI function ThrowNew() has not been %s:\n\t%d intercepted call(s) instead of %d as expected\n",
|
||||||
(step==1)?"tested":"original",
|
(step == 1) ? "tested" : "original",
|
||||||
(step==1)?"redirected":"restored",
|
(step == 1) ? "redirected" : "restored",
|
||||||
thrownew_calls, exThrNewCalls);
|
thrownew_calls, exThrNewCalls);
|
||||||
}
|
}
|
||||||
thrownew_calls = 0; /* zeroing an interception counter */
|
thrownew_calls = 0; /* zeroing an interception counter */
|
||||||
@ -234,15 +234,15 @@ void checkCall(int step, int exThrCalls, int exThrNewCalls, int exExcOccCalls) {
|
|||||||
if (excoccur_calls == exExcOccCalls) {
|
if (excoccur_calls == exExcOccCalls) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("\nCHECK PASSED: the %s JNI function ExceptionOccurred() has been %s:\n\t%d intercepted call(s) as expected\n",
|
printf("\nCHECK PASSED: the %s JNI function ExceptionOccurred() has been %s:\n\t%d intercepted call(s) as expected\n",
|
||||||
(step==1)?"tested":"original",
|
(step == 1) ? "tested" : "original",
|
||||||
(step==1)?"redirected":"restored",
|
(step == 1) ? "redirected" : "restored",
|
||||||
excoccur_calls);
|
excoccur_calls);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = STATUS_FAILED;
|
result = STATUS_FAILED;
|
||||||
printf("\nTEST FAILED: the %s JNI function ExceptionOccurred() has not been %s:\n\t%d intercepted call(s) instead of %d as expected\n",
|
printf("\nTEST FAILED: the %s JNI function ExceptionOccurred() has not been %s:\n\t%d intercepted call(s) instead of %d as expected\n",
|
||||||
(step==1)?"tested":"original",
|
(step == 1) ? "tested" : "original",
|
||||||
(step==1)?"redirected":"restored",
|
(step == 1) ? "redirected" : "restored",
|
||||||
excoccur_calls, exExcOccCalls);
|
excoccur_calls, exExcOccCalls);
|
||||||
}
|
}
|
||||||
excoccur_calls = 0; /* zeroing an interception counter */
|
excoccur_calls = 0; /* zeroing an interception counter */
|
||||||
|
@ -173,15 +173,15 @@ void checkCall(int step, int exAllObjCalls, int exNewObjCalls) {
|
|||||||
if (allobj_calls == exAllObjCalls) {
|
if (allobj_calls == exAllObjCalls) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("\nCHECK PASSED: the %s JNI function AllocObject() has been %s:\n\t%d intercepted call(s) as expected\n",
|
printf("\nCHECK PASSED: the %s JNI function AllocObject() has been %s:\n\t%d intercepted call(s) as expected\n",
|
||||||
(step==1)?"tested":"original",
|
(step == 1) ? "tested" : "original",
|
||||||
(step==1)?"redirected":"restored",
|
(step == 1) ? "redirected" : "restored",
|
||||||
allobj_calls);
|
allobj_calls);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = STATUS_FAILED;
|
result = STATUS_FAILED;
|
||||||
printf("\nTEST FAILED: the %s JNI function AllocObject() has not been %s:\t%d intercepted call(s) instead of %d as expected\n\n",
|
printf("\nTEST FAILED: the %s JNI function AllocObject() has not been %s:\t%d intercepted call(s) instead of %d as expected\n\n",
|
||||||
(step==1)?"tested":"original",
|
(step == 1) ? "tested" : "original",
|
||||||
(step==1)?"redirected":"restored",
|
(step == 1) ? "redirected" : "restored",
|
||||||
allobj_calls, exAllObjCalls);
|
allobj_calls, exAllObjCalls);
|
||||||
}
|
}
|
||||||
allobj_calls = 0; /* zeroing an interception counter */
|
allobj_calls = 0; /* zeroing an interception counter */
|
||||||
@ -189,15 +189,15 @@ void checkCall(int step, int exAllObjCalls, int exNewObjCalls) {
|
|||||||
if (newobj_calls == exNewObjCalls) {
|
if (newobj_calls == exNewObjCalls) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("\nCHECK PASSED: the %s JNI function NewObjectV() has been %s:\n\t%d intercepted call(s) as expected\n",
|
printf("\nCHECK PASSED: the %s JNI function NewObjectV() has been %s:\n\t%d intercepted call(s) as expected\n",
|
||||||
(step==1)?"tested":"original",
|
(step == 1) ? "tested" : "original",
|
||||||
(step==1)?"redirected":"restored",
|
(step == 1) ? "redirected" : "restored",
|
||||||
newobj_calls);
|
newobj_calls);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = STATUS_FAILED;
|
result = STATUS_FAILED;
|
||||||
printf("\nTEST FAILED: the %s JNI function NewObjectV() has not been %s:\n\t%d intercepted call(s) instead of %d as expected\n",
|
printf("\nTEST FAILED: the %s JNI function NewObjectV() has not been %s:\n\t%d intercepted call(s) instead of %d as expected\n",
|
||||||
(step==1)?"tested":"original",
|
(step == 1) ? "tested" : "original",
|
||||||
(step==1)?"redirected":"restored",
|
(step == 1) ? "redirected" : "restored",
|
||||||
newobj_calls, exNewObjCalls);
|
newobj_calls, exNewObjCalls);
|
||||||
}
|
}
|
||||||
newobj_calls = 0; /* zeroing an interception counter */
|
newobj_calls = 0; /* zeroing an interception counter */
|
||||||
|
@ -98,19 +98,19 @@ static void doRedirect(JNIEnv *env, jvmtiEnv *jvmti, int indx) {
|
|||||||
jvmtiError err;
|
jvmtiError err;
|
||||||
|
|
||||||
NSK_DISPLAY1("\n%s JVMTI env: doRedirect: obtaining the JNI function table ...\n",
|
NSK_DISPLAY1("\n%s JVMTI env: doRedirect: obtaining the JNI function table ...\n",
|
||||||
(indx==0)?"first":"second");
|
(indx == 0) ? "first" : "second");
|
||||||
err = jvmti->GetJNIFunctionTable(&orig_jni_functions[indx]);
|
err = jvmti->GetJNIFunctionTable(&orig_jni_functions[indx]);
|
||||||
if (err != JVMTI_ERROR_NONE) {
|
if (err != JVMTI_ERROR_NONE) {
|
||||||
result = STATUS_FAILED;
|
result = STATUS_FAILED;
|
||||||
NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to get original JNI function table: %s\n",
|
NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to get original JNI function table: %s\n",
|
||||||
(indx==0)?"first":"second", TranslateError(err));
|
(indx == 0) ? "first" : "second", TranslateError(err));
|
||||||
env->FatalError("failed to get original JNI function table");
|
env->FatalError("failed to get original JNI function table");
|
||||||
}
|
}
|
||||||
err = jvmti->GetJNIFunctionTable(&redir_jni_functions[indx]);
|
err = jvmti->GetJNIFunctionTable(&redir_jni_functions[indx]);
|
||||||
if (err != JVMTI_ERROR_NONE) {
|
if (err != JVMTI_ERROR_NONE) {
|
||||||
result = STATUS_FAILED;
|
result = STATUS_FAILED;
|
||||||
NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to get redirected JNI function table: %s\n",
|
NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to get redirected JNI function table: %s\n",
|
||||||
(indx==0)?"first":"second", TranslateError(err));
|
(indx == 0) ? "first" : "second", TranslateError(err));
|
||||||
env->FatalError("failed to get redirected JNI function table");
|
env->FatalError("failed to get redirected JNI function table");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,18 +119,18 @@ static void doRedirect(JNIEnv *env, jvmtiEnv *jvmti, int indx) {
|
|||||||
"\toverwriting the function GetVersion() ...\n",
|
"\toverwriting the function GetVersion() ...\n",
|
||||||
(indx == 0) ? "first" : "second");
|
(indx == 0) ? "first" : "second");
|
||||||
redir_jni_functions[indx]->GetVersion =
|
redir_jni_functions[indx]->GetVersion =
|
||||||
(indx==0)?MyGetVersionA:MyGetVersionB;
|
(indx == 0) ? MyGetVersionA : MyGetVersionB;
|
||||||
|
|
||||||
err = jvmti->SetJNIFunctionTable(redir_jni_functions[indx]);
|
err = jvmti->SetJNIFunctionTable(redir_jni_functions[indx]);
|
||||||
if (err != JVMTI_ERROR_NONE) {
|
if (err != JVMTI_ERROR_NONE) {
|
||||||
result = STATUS_FAILED;
|
result = STATUS_FAILED;
|
||||||
NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to set new JNI function table: %s\n",
|
NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to set new JNI function table: %s\n",
|
||||||
(indx==0)?"first":"second", TranslateError(err));
|
(indx == 0) ? "first" : "second", TranslateError(err));
|
||||||
env->FatalError("failed to set new JNI function table");
|
env->FatalError("failed to set new JNI function table");
|
||||||
}
|
}
|
||||||
|
|
||||||
NSK_DISPLAY1("%s JVMTI env: doRedirect: the functions are overwritten successfully\n",
|
NSK_DISPLAY1("%s JVMTI env: doRedirect: the functions are overwritten successfully\n",
|
||||||
(indx==0)?"first":"second");
|
(indx == 0) ? "first" : "second");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void provokeIntercept(JNIEnv *env, const char *name) {
|
static void provokeIntercept(JNIEnv *env, const char *name) {
|
||||||
@ -146,22 +146,22 @@ static int checkIntercept(int indx, int env_num, int exCalls) {
|
|||||||
NSK_DISPLAY5(
|
NSK_DISPLAY5(
|
||||||
"\nCHECK PASSED: GetVersion() interception set in the %s JVMTI env %s properly:\n"
|
"\nCHECK PASSED: GetVersion() interception set in the %s JVMTI env %s properly:\n"
|
||||||
"\t%d interception(s) with the%s%s JVMTI env as expected\n",
|
"\t%d interception(s) with the%s%s JVMTI env as expected\n",
|
||||||
(indx==0)?"first":"second",
|
(indx == 0) ? "first" : "second",
|
||||||
(exCalls==0)?"overwritten by another environment":"works",
|
(exCalls == 0) ? "overwritten by another environment" : "works",
|
||||||
redir_calls[indx],
|
redir_calls[indx],
|
||||||
(indx==env_num)?" same ":" ",
|
(indx == env_num) ? " same " : " ",
|
||||||
(env_num==0)?"first":"second");
|
(env_num == 0) ? "first" : "second");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = STATUS_FAILED;
|
result = STATUS_FAILED;
|
||||||
NSK_COMPLAIN6(
|
NSK_COMPLAIN6(
|
||||||
"\nTEST FAILED: GetVersion() interception set in the %s JVMTI env doesn't %s properly:\n"
|
"\nTEST FAILED: GetVersion() interception set in the %s JVMTI env doesn't %s properly:\n"
|
||||||
"\t%d interception(s) with the%s%s JVMTI env instead of %d as expected\n",
|
"\t%d interception(s) with the%s%s JVMTI env instead of %d as expected\n",
|
||||||
(indx==0)?"first":"second",
|
(indx == 0) ? "first" : "second",
|
||||||
(exCalls==0)?"overwritten by another environment":"work",
|
(exCalls == 0) ? "overwritten by another environment" : "work",
|
||||||
redir_calls[indx],
|
redir_calls[indx],
|
||||||
(indx==env_num)?" same ":" ",
|
(indx == env_num) ? " same " : " ",
|
||||||
(env_num==0)?"first":"second",
|
(env_num == 0) ? "first" : "second",
|
||||||
exCalls);
|
exCalls);
|
||||||
return STATUS_FAILED;
|
return STATUS_FAILED;
|
||||||
}
|
}
|
||||||
@ -177,17 +177,17 @@ static int initAgent(int indx) {
|
|||||||
|
|
||||||
thrstarted[indx] = redir[indx] = redir_calls[indx] = 0;
|
thrstarted[indx] = redir[indx] = redir_calls[indx] = 0;
|
||||||
|
|
||||||
NSK_DISPLAY1("\nagent %s initializer: obtaining the JVMTI env ...\n", (indx==0)?"A":"B");
|
NSK_DISPLAY1("\nagent %s initializer: obtaining the JVMTI env ...\n", (indx == 0) ? "A" : "B");
|
||||||
res = vm->GetEnv((void **) &jvmti[indx], JVMTI_VERSION_1_1);
|
res = vm->GetEnv((void **) &jvmti[indx], JVMTI_VERSION_1_1);
|
||||||
if (res != JNI_OK || jvmti[indx] == NULL) {
|
if (res != JNI_OK || jvmti[indx] == NULL) {
|
||||||
NSK_COMPLAIN1("TEST FAILURE: failed to call GetEnv for the agent %s\n",
|
NSK_COMPLAIN1("TEST FAILURE: failed to call GetEnv for the agent %s\n",
|
||||||
(indx==0)?"A":"B");
|
(indx == 0) ? "A" : "B");
|
||||||
result = STATUS_FAILED;
|
result = STATUS_FAILED;
|
||||||
return STATUS_FAILED;
|
return STATUS_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSK_DISPLAY1("\nagent %s initializer: the JVMTI env obtained\n\tsetting event callbacks ...\n",
|
NSK_DISPLAY1("\nagent %s initializer: the JVMTI env obtained\n\tsetting event callbacks ...\n",
|
||||||
(indx==0)?"A":"B");
|
(indx == 0) ? "A" : "B");
|
||||||
(void) memset(&callbacks, 0, sizeof(callbacks));
|
(void) memset(&callbacks, 0, sizeof(callbacks));
|
||||||
switch (indx) {
|
switch (indx) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -206,16 +206,16 @@ static int initAgent(int indx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSK_DISPLAY1("\nagent %s initializer: setting event callbacks done\n\tenabling events ...\n",
|
NSK_DISPLAY1("\nagent %s initializer: setting event callbacks done\n\tenabling events ...\n",
|
||||||
(indx==0)?"A":"B");
|
(indx == 0) ? "A" : "B");
|
||||||
err = jvmti[indx]->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
|
err = jvmti[indx]->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
|
||||||
if (err != JVMTI_ERROR_NONE) { /* enable event globally */
|
if (err != JVMTI_ERROR_NONE) { /* enable event globally */
|
||||||
NSK_COMPLAIN2("TEST FAILURE: failed to enable JVMTI_EVENT_VM_INIT event for the agent %s: %s\n",
|
NSK_COMPLAIN2("TEST FAILURE: failed to enable JVMTI_EVENT_VM_INIT event for the agent %s: %s\n",
|
||||||
(indx==0)?"A":"B", TranslateError(err));
|
(indx == 0) ? "A" : "B", TranslateError(err));
|
||||||
result = STATUS_FAILED;
|
result = STATUS_FAILED;
|
||||||
return STATUS_FAILED;
|
return STATUS_FAILED;
|
||||||
}
|
}
|
||||||
NSK_DISPLAY2("\nagent %s initializer: enabling events done, returning exit code %d\n",
|
NSK_DISPLAY2("\nagent %s initializer: enabling events done, returning exit code %d\n",
|
||||||
(indx==0)?"A":"B", exitCode);
|
(indx == 0) ? "A" : "B", exitCode);
|
||||||
|
|
||||||
return exitCode;
|
return exitCode;
|
||||||
}
|
}
|
||||||
@ -224,29 +224,29 @@ static void startAgent(int indx) {
|
|||||||
int tries = 0;
|
int tries = 0;
|
||||||
|
|
||||||
NSK_DISPLAY1("\nstartAgent: starting agent %s thread ...\n",
|
NSK_DISPLAY1("\nstartAgent: starting agent %s thread ...\n",
|
||||||
(indx==0)?"A":"B");
|
(indx == 0) ? "A" : "B");
|
||||||
void* context = (void*) ((indx==0)?"agent A":"agent B");
|
void* context = (void*) ((indx == 0) ? "agent A" : "agent B");
|
||||||
agentThr[indx] = THREAD_new((indx==0)?agentA:agentB, context);
|
agentThr[indx] = THREAD_new((indx == 0) ? agentA : agentB, context);
|
||||||
if (THREAD_start(agentThr[indx]) == NULL) {
|
if (THREAD_start(agentThr[indx]) == NULL) {
|
||||||
NSK_COMPLAIN1("TEST FAILURE: cannot start the agent %s thread\n",
|
NSK_COMPLAIN1("TEST FAILURE: cannot start the agent %s thread\n",
|
||||||
(indx==0)?"A":"B");
|
(indx == 0) ? "A" : "B");
|
||||||
exit(STATUS_FAILED);
|
exit(STATUS_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
NSK_DISPLAY1("\nstartAgent: waiting for the agent %s to be started ...\n",
|
NSK_DISPLAY1("\nstartAgent: waiting for the agent %s to be started ...\n",
|
||||||
(indx==0)?"A":"B");
|
(indx == 0) ? "A" : "B");
|
||||||
do {
|
do {
|
||||||
THREAD_sleep(1);
|
THREAD_sleep(1);
|
||||||
tries++;
|
tries++;
|
||||||
if (tries > TRIES) {
|
if (tries > TRIES) {
|
||||||
NSK_COMPLAIN2("TEST FAILURE: the agent %s thread is still not started after %d attempts\n",
|
NSK_COMPLAIN2("TEST FAILURE: the agent %s thread is still not started after %d attempts\n",
|
||||||
(indx==0)?"A":"B", TRIES);
|
(indx == 0) ? "A" : "B", TRIES);
|
||||||
exit(STATUS_FAILED);
|
exit(STATUS_FAILED);
|
||||||
}
|
}
|
||||||
} while (thrstarted[indx] != 1);
|
} while (thrstarted[indx] != 1);
|
||||||
|
|
||||||
NSK_DISPLAY1("\nstartAgent: the agent %s thread started\n",
|
NSK_DISPLAY1("\nstartAgent: the agent %s thread started\n",
|
||||||
(indx==0)?"A":"B");
|
(indx == 0) ? "A" : "B");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* agent thread procedures */
|
/* agent thread procedures */
|
||||||
@ -402,15 +402,15 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI05_ji05t001_getResult(JNIEnv *env,
|
|||||||
|
|
||||||
for (i=0; i<AGENTS; i++) {
|
for (i=0; i<AGENTS; i++) {
|
||||||
NSK_DISPLAY1("\ngetResult: waiting for the agent %s thread...\n",
|
NSK_DISPLAY1("\ngetResult: waiting for the agent %s thread...\n",
|
||||||
(i==0)?"A":"B");
|
(i == 0) ? "A" : "B");
|
||||||
THREAD_waitFor(agentThr[i]);
|
THREAD_waitFor(agentThr[i]);
|
||||||
if (THREAD_status(agentThr[i]) != PASSED) {
|
if (THREAD_status(agentThr[i]) != PASSED) {
|
||||||
result = STATUS_FAILED;
|
result = STATUS_FAILED;
|
||||||
NSK_COMPLAIN2("TEST FAILED: the agent %s thread done with the error code %d\n",
|
NSK_COMPLAIN2("TEST FAILED: the agent %s thread done with the error code %d\n",
|
||||||
(i==0)?"A":"B", THREAD_status(agentThr[i]));
|
(i == 0) ? "A" : "B", THREAD_status(agentThr[i]));
|
||||||
}
|
}
|
||||||
else NSK_DISPLAY2("getResult: the agent %s thread done with the code %d\n",
|
else NSK_DISPLAY2("getResult: the agent %s thread done with the code %d\n",
|
||||||
(i==0)?"A":"B", THREAD_status(agentThr[i]));
|
(i == 0) ? "A" : "B", THREAD_status(agentThr[i]));
|
||||||
free(agentThr[i]);
|
free(agentThr[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,7 +439,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
|
|||||||
|
|
||||||
for (i=0; i<AGENTS; i++) {
|
for (i=0; i<AGENTS; i++) {
|
||||||
NSK_DISPLAY1("initializing agent %s ...\n",
|
NSK_DISPLAY1("initializing agent %s ...\n",
|
||||||
(i==0)?"A":"B");
|
(i == 0) ? "A" : "B");
|
||||||
if (initAgent(i) != PASSED)
|
if (initAgent(i) != PASSED)
|
||||||
return JNI_ERR;
|
return JNI_ERR;
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ void checkGetLineNumberTable(jmethodID mid, const char *methName,
|
|||||||
err = jvmti->GetLineNumberTable(mid, &entryCount, &table);
|
err = jvmti->GetLineNumberTable(mid, &entryCount, &table);
|
||||||
if (printdump == JNI_TRUE) {
|
if (printdump == JNI_TRUE) {
|
||||||
printf("\n Method: %s%s\n", methName,
|
printf("\n Method: %s%s\n", methName,
|
||||||
(abstract==0) ? "" : " (abstract)");
|
(abstract == 0) ? "" : " (abstract)");
|
||||||
}
|
}
|
||||||
if (err != exp) {
|
if (err != exp) {
|
||||||
result = STATUS_FAILED;
|
result = STATUS_FAILED;
|
||||||
@ -112,8 +112,8 @@ void checkGetLineNumberTable(jmethodID mid, const char *methName,
|
|||||||
printf(" actual: %s (%d)\n", TranslateError(err), err);
|
printf(" actual: %s (%d)\n", TranslateError(err), err);
|
||||||
if (err == JVMTI_ERROR_NONE) {
|
if (err == JVMTI_ERROR_NONE) {
|
||||||
printf(" %s%s line number table (%d entries):%s\n",
|
printf(" %s%s line number table (%d entries):%s\n",
|
||||||
methName, (abstract==0) ? "" : " (abstract)",
|
methName, (abstract == 0) ? "" : " (abstract)",
|
||||||
entryCount, (entryCount==0 ? " empty" : ""));
|
entryCount, (entryCount == 0 ? " empty" : ""));
|
||||||
for (i = 0; i < entryCount; i++) {
|
for (i = 0; i < entryCount; i++) {
|
||||||
printf(" start_location = 0x%x%08x,",
|
printf(" start_location = 0x%x%08x,",
|
||||||
(jint)(table[i].start_location >> 32),
|
(jint)(table[i].start_location >> 32),
|
||||||
|
@ -170,7 +170,7 @@ Java_nsk_jvmti_unit_functions_nosuspendMonitorInfo_JvmtiTest_CheckMonitorInfo(JN
|
|||||||
iGlobalStatus = 2;
|
iGlobalStatus = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (expected_count !=0) {
|
if (expected_count != 0) {
|
||||||
|
|
||||||
ret = jvmti->GetCurrentContendedMonitor(thr, owned_monitor);
|
ret = jvmti->GetCurrentContendedMonitor(thr, owned_monitor);
|
||||||
if (ret != JVMTI_ERROR_NONE) {
|
if (ret != JVMTI_ERROR_NONE) {
|
||||||
|
@ -441,7 +441,7 @@ extern "C" {
|
|||||||
// while (!threadsGroupLocks.runnableCanExit.get()) {
|
// while (!threadsGroupLocks.runnableCanExit.get()) {
|
||||||
// Thread.yield();
|
// Thread.yield();
|
||||||
// }
|
// }
|
||||||
while (flag==JNI_FALSE)
|
while (flag == JNI_FALSE)
|
||||||
{
|
{
|
||||||
GET_BOOL_FIELD(flag, threadsGroupLocks, ThreadsGroupLocks, "runnableCanExit");
|
GET_BOOL_FIELD(flag, threadsGroupLocks, ThreadsGroupLocks, "runnableCanExit");
|
||||||
CALL_STATIC_VOID_NOPARAM(Thread, "yield");
|
CALL_STATIC_VOID_NOPARAM(Thread, "yield");
|
||||||
|
@ -150,7 +150,7 @@ ClassLoad(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jclass klass) {
|
|||||||
char *cls_sig;
|
char *cls_sig;
|
||||||
jint clsByteCount;
|
jint clsByteCount;
|
||||||
|
|
||||||
display((hotswap != HOTSWAP_OFF)?0:1,
|
display((hotswap != HOTSWAP_OFF) ? 0 : 1,
|
||||||
"#### JVMTIagent: ClassLoad occurred ####\n");
|
"#### JVMTIagent: ClassLoad occurred ####\n");
|
||||||
|
|
||||||
getVerdict(jni_env, "ClassLoad");
|
getVerdict(jni_env, "ClassLoad");
|
||||||
@ -236,7 +236,7 @@ Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thr,
|
|||||||
jclass decl_clazz;
|
jclass decl_clazz;
|
||||||
|
|
||||||
display((hotswap == HOTSWAP_EVERY_EXCEPTION ||
|
display((hotswap == HOTSWAP_EVERY_EXCEPTION ||
|
||||||
hotswap == HOTSWAP_EVERY_EXCEPTION_FOR_EVERY_CLASS)?0:1,
|
hotswap == HOTSWAP_EVERY_EXCEPTION_FOR_EVERY_CLASS) ? 0 : 1,
|
||||||
"#### JVMTIagent: Exception occurred ####\n");
|
"#### JVMTIagent: Exception occurred ####\n");
|
||||||
|
|
||||||
getVerdict(jni_env, "Exception");
|
getVerdict(jni_env, "Exception");
|
||||||
@ -408,7 +408,7 @@ SingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
|
|||||||
jmethodID method, jlocation location) {
|
jmethodID method, jlocation location) {
|
||||||
jclass decl_clazz;
|
jclass decl_clazz;
|
||||||
|
|
||||||
display((hotswap == HOTSWAP_EVERY_SINGLE_STEP)?0:1,
|
display((hotswap == HOTSWAP_EVERY_SINGLE_STEP) ? 0 : 1,
|
||||||
"#### JVMTIagent: SingleStep occurred ####\n");
|
"#### JVMTIagent: SingleStep occurred ####\n");
|
||||||
|
|
||||||
getVerdict(jni_env, "SingleStep");
|
getVerdict(jni_env, "SingleStep");
|
||||||
@ -428,7 +428,7 @@ MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env,
|
|||||||
jclass decl_clazz;
|
jclass decl_clazz;
|
||||||
|
|
||||||
display((hotswap == HOTSWAP_EVERY_METHOD_ENTRY ||
|
display((hotswap == HOTSWAP_EVERY_METHOD_ENTRY ||
|
||||||
hotswap == HOTSWAP_EVERY_METHOD_ENTRY_FOR_EVERY_CLASS)?0:1,
|
hotswap == HOTSWAP_EVERY_METHOD_ENTRY_FOR_EVERY_CLASS) ? 0 : 1,
|
||||||
"#### JVMTIagent: MethodEntry occurred ####\n");
|
"#### JVMTIagent: MethodEntry occurred ####\n");
|
||||||
|
|
||||||
getVerdict(jni_env, "MethodEntry");
|
getVerdict(jni_env, "MethodEntry");
|
||||||
@ -459,7 +459,7 @@ ExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thr,
|
|||||||
jclass decl_clazz;
|
jclass decl_clazz;
|
||||||
|
|
||||||
display((hotswap == HOTSWAP_EVERY_EXCEPTION ||
|
display((hotswap == HOTSWAP_EVERY_EXCEPTION ||
|
||||||
hotswap == HOTSWAP_EVERY_EXCEPTION_FOR_EVERY_CLASS)?0:1,
|
hotswap == HOTSWAP_EVERY_EXCEPTION_FOR_EVERY_CLASS) ? 0 : 1,
|
||||||
"#### JVMTIagent: ExceptionCatch occurred ####\n");
|
"#### JVMTIagent: ExceptionCatch occurred ####\n");
|
||||||
|
|
||||||
getVerdict(jni_env, "ExceptionCatch");
|
getVerdict(jni_env, "ExceptionCatch");
|
||||||
@ -1153,7 +1153,7 @@ static void getVerdict(JNIEnv *jni_env, const char *evnt) {
|
|||||||
sprintf(error_msg, "JVMTIagent: getVerdict: %s event occured after VMDeath",
|
sprintf(error_msg, "JVMTIagent: getVerdict: %s event occured after VMDeath",
|
||||||
evnt);
|
evnt);
|
||||||
|
|
||||||
if (jni_env==NULL) { /* some event callbacks have no pointer to jni */
|
if (jni_env == NULL) { /* some event callbacks have no pointer to jni */
|
||||||
printf("ERROR: %s\n", error_msg);
|
printf("ERROR: %s\n", error_msg);
|
||||||
exit(97);
|
exit(97);
|
||||||
}
|
}
|
||||||
|
@ -432,7 +432,7 @@ extern "C" {
|
|||||||
put_u1(SAME_FRAME_EXTENDED);
|
put_u1(SAME_FRAME_EXTENDED);
|
||||||
put_u2(calculateOffsetDelta(i, (u2) frame_type));
|
put_u2(calculateOffsetDelta(i, (u2) frame_type));
|
||||||
|
|
||||||
} else if ((frame_type >= SAME_LOCALS_1_STACK_ITEM_BEGIN) && (frame_type<=SAME_LOCALS_1_STACK_ITEM_END)) {
|
} else if ((frame_type >= SAME_LOCALS_1_STACK_ITEM_BEGIN) && (frame_type <= SAME_LOCALS_1_STACK_ITEM_END)) {
|
||||||
// same_locals_1_stack_item_frame {
|
// same_locals_1_stack_item_frame {
|
||||||
// u1 frame_type = SAME_LOCALS_1_STACK_ITEM;/* 64-127 */
|
// u1 frame_type = SAME_LOCALS_1_STACK_ITEM;/* 64-127 */
|
||||||
// verification_type_info stack[1];
|
// verification_type_info stack[1];
|
||||||
|
@ -318,7 +318,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
|
|||||||
NSK_DISPLAY1("SingleStepEventsCount: %d\n", SingleStepEventsCount);
|
NSK_DISPLAY1("SingleStepEventsCount: %d\n", SingleStepEventsCount);
|
||||||
if (vm_mode == VM_MODE_MIXED) {
|
if (vm_mode == VM_MODE_MIXED) {
|
||||||
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(
|
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(
|
||||||
(((i % 2)==0) ? JVMTI_DISABLE : JVMTI_ENABLE),
|
(((i % 2) == 0) ? JVMTI_DISABLE : JVMTI_ENABLE),
|
||||||
JVMTI_EVENT_SINGLE_STEP, NULL)))
|
JVMTI_EVENT_SINGLE_STEP, NULL)))
|
||||||
nsk_jvmti_setFailStatus();
|
nsk_jvmti_setFailStatus();
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ void* THREAD_start(void* t) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return 1 if the thread has been started, or 0 if not,
|
* Return 1 if the thread has been started, or 0 if not,
|
||||||
* or -1 if thread==NULL.
|
* or -1 if thread == NULL.
|
||||||
*/
|
*/
|
||||||
int THREAD_isStarted(void* t) {
|
int THREAD_isStarted(void* t) {
|
||||||
THREAD* thread = (THREAD*)t;
|
THREAD* thread = (THREAD*)t;
|
||||||
@ -154,7 +154,7 @@ int THREAD_isStarted(void* t) {
|
|||||||
/**
|
/**
|
||||||
* Return 1 if the thread has been started and already has finished,
|
* Return 1 if the thread has been started and already has finished,
|
||||||
* or 0 if the thread hasn't finish (or even hasn't been started),
|
* or 0 if the thread hasn't finish (or even hasn't been started),
|
||||||
* or -1 if thread==NULL.
|
* or -1 if thread == NULL.
|
||||||
*/
|
*/
|
||||||
int THREAD_hasFinished(void* t) {
|
int THREAD_hasFinished(void* t) {
|
||||||
THREAD* thread = (THREAD*)t;
|
THREAD* thread = (THREAD*)t;
|
||||||
@ -166,7 +166,7 @@ int THREAD_hasFinished(void* t) {
|
|||||||
/**
|
/**
|
||||||
* Return thread->status if thread has finished,
|
* Return thread->status if thread has finished,
|
||||||
* or return 0 if thread hasn't finished,
|
* or return 0 if thread hasn't finished,
|
||||||
* or retuen -1 if thread==NULL.
|
* or retuen -1 if thread == NULL.
|
||||||
*/
|
*/
|
||||||
int THREAD_status(void* t) {
|
int THREAD_status(void* t) {
|
||||||
THREAD* thread = (THREAD*)t;
|
THREAD* thread = (THREAD*)t;
|
||||||
@ -179,7 +179,7 @@ int THREAD_status(void* t) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Cycle with 1 second sleeps until the thread has finished;
|
* Cycle with 1 second sleeps until the thread has finished;
|
||||||
* or return immediately, if thread==NULL.
|
* or return immediately, if thread == NULL.
|
||||||
*/
|
*/
|
||||||
void THREAD_waitFor(void* t) {
|
void THREAD_waitFor(void* t) {
|
||||||
THREAD* thread = (THREAD*)t;
|
THREAD* thread = (THREAD*)t;
|
||||||
|
@ -86,13 +86,13 @@ Java_nsk_stress_jni_JNIter001_jnistress (JNIEnv *env, jobject jobj, jstring jstr
|
|||||||
}
|
}
|
||||||
memcpy(element->checkstr[allocs],digest,DIGESTLENGTH);
|
memcpy(element->checkstr[allocs],digest,DIGESTLENGTH);
|
||||||
allocs++;
|
allocs++;
|
||||||
if (allocs%printperiod==0) {
|
if (allocs % printperiod == 0) {
|
||||||
printf("Check string for thread %s is ", element->str[allocs-1]);
|
printf("Check string for thread %s is ", element->str[allocs-1]);
|
||||||
for (j=0;j<DIGESTLENGTH;j++)
|
for (j=0;j<DIGESTLENGTH;j++)
|
||||||
printf("%02x", digest[j]);
|
printf("%02x", digest[j]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
if (allocs==nstr) {
|
if (allocs == nstr) {
|
||||||
printf("JNI UTF8 strings memory=%zd\n", strsize);
|
printf("JNI UTF8 strings memory=%zd\n", strsize);
|
||||||
tmpstr=env->NewStringUTF(element->str[allocs-1]); CE
|
tmpstr=env->NewStringUTF(element->str[allocs-1]); CE
|
||||||
for (j=0; j<nstr; j++) {
|
for (j=0; j<nstr; j++) {
|
||||||
@ -103,7 +103,7 @@ Java_nsk_stress_jni_JNIter001_jnistress (JNIEnv *env, jobject jobj, jstring jstr
|
|||||||
for (k=0; k < strlen(element->str[j]); k++) {
|
for (k=0; k < strlen(element->str[j]); k++) {
|
||||||
digest[k % DIGESTLENGTH] += element->str[j][k];
|
digest[k % DIGESTLENGTH] += element->str[j][k];
|
||||||
}
|
}
|
||||||
if (memcmp(digest,element->checkstr[j],DIGESTLENGTH)==0) {
|
if (memcmp(digest,element->checkstr[j],DIGESTLENGTH) == 0) {
|
||||||
env->ReleaseStringUTFChars(jstr,element->str[j]); CE
|
env->ReleaseStringUTFChars(jstr,element->str[j]); CE
|
||||||
element->str[j] = NULL;
|
element->str[j] = NULL;
|
||||||
element->checkstr[j] = NULL;
|
element->checkstr[j] = NULL;
|
||||||
@ -185,14 +185,14 @@ Java_nsk_stress_jni_JNIter001_jnistress1(JNIEnv *env, jobject jobj, jstring jstr
|
|||||||
digest[j % DIGESTLENGTH]+=elem[j];
|
digest[j % DIGESTLENGTH]+=elem[j];
|
||||||
}
|
}
|
||||||
memcpy(javachars->checkstr[index++],digest,DIGESTLENGTH);
|
memcpy(javachars->checkstr[index++],digest,DIGESTLENGTH);
|
||||||
if (index%printperiod==0) {
|
if (index % printperiod == 0) {
|
||||||
printf("Check string sum for thread %.*s is ", elem_len, elem);
|
printf("Check string sum for thread %.*s is ", elem_len, elem);
|
||||||
for (j=0;j<DIGESTLENGTH;j++)
|
for (j=0;j<DIGESTLENGTH;j++)
|
||||||
printf("%02x", digest[j]);
|
printf("%02x", digest[j]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
free(elem);
|
free(elem);
|
||||||
if (index==nstr) {
|
if (index == nstr) {
|
||||||
printf("JNI Unicode strings memory=%ld\n",len);
|
printf("JNI Unicode strings memory=%ld\n",len);
|
||||||
tmpstr=env->NewString(javachars->str[index-1],elem_len); CE
|
tmpstr=env->NewString(javachars->str[index-1],elem_len); CE
|
||||||
for (j=0; j<nstr; j++) {
|
for (j=0; j<nstr; j++) {
|
||||||
@ -208,7 +208,7 @@ Java_nsk_stress_jni_JNIter001_jnistress1(JNIEnv *env, jobject jobj, jstring jstr
|
|||||||
digest[i % DIGESTLENGTH]+=elem[i];
|
digest[i % DIGESTLENGTH]+=elem[i];
|
||||||
}
|
}
|
||||||
free(elem);
|
free(elem);
|
||||||
if (memcmp(digest,javachars->checkstr[j],javachars->size[j])==0) {
|
if (memcmp(digest,javachars->checkstr[j],javachars->size[j]) == 0) {
|
||||||
env->ReleaseStringChars(jstr,javachars->str[j]); CE
|
env->ReleaseStringChars(jstr,javachars->str[j]); CE
|
||||||
javachars->str[j] = NULL;
|
javachars->str[j] = NULL;
|
||||||
javachars->checkstr[j] = NULL;
|
javachars->checkstr[j] = NULL;
|
||||||
|
@ -69,13 +69,13 @@ Java_nsk_stress_jni_JNIter002_jniobjects (JNIEnv *env, jobject jobj, jstring jst
|
|||||||
clazz=env->FindClass(classname); CE
|
clazz=env->FindClass(classname); CE
|
||||||
obj=env->NewObjectArray((jsize)3,clazz,
|
obj=env->NewObjectArray((jsize)3,clazz,
|
||||||
env->AllocObject(clazz)); CE
|
env->AllocObject(clazz)); CE
|
||||||
if (obj==NULL) {
|
if (obj == NULL) {
|
||||||
fprintf(stderr,"Can not construct the object Array for %s\n", classname);
|
fprintf(stderr,"Can not construct the object Array for %s\n", classname);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
methodID=env->GetMethodID(clazz,name,sig); CE
|
methodID=env->GetMethodID(clazz,name,sig); CE
|
||||||
if (methodID==NULL) {
|
if (methodID == NULL) {
|
||||||
fprintf(stderr,"Can not get the ID of <init> for %s\n", classname);
|
fprintf(stderr,"Can not get the ID of <init> for %s\n", classname);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ Java_nsk_stress_jni_JNIter003_jniInitArrays (JNIEnv *env, jobject jobj, jint siz
|
|||||||
doubleBuf=(jdouble *)malloc(SIZE*sizeof(jdouble));
|
doubleBuf=(jdouble *)malloc(SIZE*sizeof(jdouble));
|
||||||
|
|
||||||
for (i=0;i<SIZE;i++) {
|
for (i=0;i<SIZE;i++) {
|
||||||
if (i%2==0) boolBuf[i]=JNI_TRUE;
|
if (i%2 == 0) boolBuf[i]=JNI_TRUE;
|
||||||
else boolBuf[i]=JNI_FALSE;
|
else boolBuf[i]=JNI_FALSE;
|
||||||
/*
|
/*
|
||||||
byteBuf[i]=(jbyte)random();
|
byteBuf[i]=(jbyte)random();
|
||||||
@ -140,7 +140,7 @@ Java_nsk_stress_jni_JNIter003_jniBodyChangeArray (JNIEnv *env, jobject jobj,
|
|||||||
jdouble *doubleOrig, *doubleClone;
|
jdouble *doubleOrig, *doubleClone;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((orig==NULL) || (clone==NULL)) {
|
if ((orig == NULL) || (clone == NULL)) {
|
||||||
fprintf(stderr,"JNI received a NULL array from Java\n");
|
fprintf(stderr,"JNI received a NULL array from Java\n");
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ Java_nsk_stress_jni_JNIter004_CheckSum (JNIEnv *env, jobject jobj, jstring jstr)
|
|||||||
/* const char *threadName=env->GetStringUTFChars(jstr, 0); */
|
/* const char *threadName=env->GetStringUTFChars(jstr, 0); */
|
||||||
|
|
||||||
env->MonitorEnter(jobj); CE
|
env->MonitorEnter(jobj); CE
|
||||||
if (upper==0) tmp=(jchar *)malloc(DIGESTLENGTH*sizeof(char));
|
if (upper == 0) tmp = (jchar *) malloc(DIGESTLENGTH*sizeof(char));
|
||||||
if (env->ExceptionOccurred()) {
|
if (env->ExceptionOccurred()) {
|
||||||
env->ExceptionDescribe();
|
env->ExceptionDescribe();
|
||||||
env->ExceptionClear();
|
env->ExceptionClear();
|
||||||
@ -140,7 +140,7 @@ Java_nsk_stress_jni_JNIter004_CheckCompare (JNIEnv *env, jobject jobj, jstring j
|
|||||||
|
|
||||||
printf("Comparing: ");
|
printf("Comparing: ");
|
||||||
for (i=0;i<len;i++)
|
for (i=0;i<len;i++)
|
||||||
if (ch[i]!=tmp[i]) {
|
if (ch[i] != tmp[i]) {
|
||||||
printf("Error in %d\n",i);
|
printf("Error in %d\n",i);
|
||||||
printf("ch[%d]=%02x tmp[%d]=%02x\n",i,ch[i],i,tmp[i]);
|
printf("ch[%d]=%02x tmp[%d]=%02x\n",i,ch[i],i,tmp[i]);
|
||||||
ret=JNI_FALSE;
|
ret=JNI_FALSE;
|
||||||
@ -153,7 +153,7 @@ Java_nsk_stress_jni_JNIter004_CheckCompare (JNIEnv *env, jobject jobj, jstring j
|
|||||||
++upper;
|
++upper;
|
||||||
if (!(upper % 500))
|
if (!(upper % 500))
|
||||||
fprintf(stderr,"There are %d elements now.\n", upper);
|
fprintf(stderr,"There are %d elements now.\n", upper);
|
||||||
if (upper==limit) {
|
if (upper == limit) {
|
||||||
jclass clazz;
|
jclass clazz;
|
||||||
jmethodID methodID;
|
jmethodID methodID;
|
||||||
char *name = (char*) "halt";
|
char *name = (char*) "halt";
|
||||||
|
@ -56,7 +56,7 @@ Java_nsk_stress_jni_JNIter005_except (JNIEnv *env, jobject jobj, jthrowable tobj
|
|||||||
CHECK_EXCEPTION
|
CHECK_EXCEPTION
|
||||||
if (!env->Throw(tobj)) {
|
if (!env->Throw(tobj)) {
|
||||||
if (env->ExceptionOccurred())
|
if (env->ExceptionOccurred())
|
||||||
if (Exceptcalls%1000==0)
|
if (Exceptcalls % 1000 == 0)
|
||||||
fprintf(stderr, "NATIVE: Throw has been catched in native\n");
|
fprintf(stderr, "NATIVE: Throw has been catched in native\n");
|
||||||
env->ExceptionClear();
|
env->ExceptionClear();
|
||||||
++Exceptcalls;
|
++Exceptcalls;
|
||||||
@ -65,7 +65,7 @@ Java_nsk_stress_jni_JNIter005_except (JNIEnv *env, jobject jobj, jthrowable tobj
|
|||||||
env->MonitorExit(jobj);
|
env->MonitorExit(jobj);
|
||||||
CHECK_EXCEPTION
|
CHECK_EXCEPTION
|
||||||
|
|
||||||
switch (Exceptcalls%23) {
|
switch (Exceptcalls % 23) {
|
||||||
case 0: name="java/lang/ArithmeticException"; break;
|
case 0: name="java/lang/ArithmeticException"; break;
|
||||||
case 1: name="java/lang/ArrayIndexOutOfBoundsException"; break;
|
case 1: name="java/lang/ArrayIndexOutOfBoundsException"; break;
|
||||||
case 2: name="java/lang/ArrayStoreException"; break;
|
case 2: name="java/lang/ArrayStoreException"; break;
|
||||||
|
@ -48,8 +48,9 @@ Java_nsk_stress_jni_JNIter006_refs (JNIEnv *env, jobject jobj, jobject tobj, jin
|
|||||||
|
|
||||||
if (upper >= LIMIT) return JNI_TRUE;
|
if (upper >= LIMIT) return JNI_TRUE;
|
||||||
|
|
||||||
if (upper==0)
|
if (upper == 0) {
|
||||||
globRefsArray=(jobject*)(malloc(LIMIT*sizeof(jobject)));
|
globRefsArray=(jobject*)(malloc(LIMIT*sizeof(jobject)));
|
||||||
|
}
|
||||||
|
|
||||||
globRefsArray[upper]=env->NewGlobalRef(tobj); CE
|
globRefsArray[upper]=env->NewGlobalRef(tobj); CE
|
||||||
if (env->IsSameObject(tobj, globRefsArray[upper])) {
|
if (env->IsSameObject(tobj, globRefsArray[upper])) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user