8228998: Remove the testing against NSK_FALSE from tests

Remove the testing against NSK_FALSE from tests

Reviewed-by: cjplummer, sspitsyn
This commit is contained in:
Jean Christophe Beyler 2019-08-02 11:24:59 -07:00
parent f84231bfbd
commit 76b7c9a0ce
39 changed files with 339 additions and 361 deletions
test/hotspot/jtreg/vmTestbase/nsk/jvmti
scenarios
events/EM02
em02t001
em02t002
em02t003
em02t004
em02t005
em02t006
em02t007
em02t008
em02t009
em02t010
em02t011
em02t012
hotswap
HS103/hs103t002
HS104
hs104t001
hs104t002
HS202
hs202t001
hs202t002
HS203
hs203t001
hs203t002
hs203t003
hs203t004
HS301
hs301t001
hs301t002
hs301t003
hs301t004
hs301t005
HS302
hs302t001
hs302t002
hs302t003
hs302t004
hs302t005
hs302t006
hs302t007
hs302t008
hs302t009
hs302t010
hs302t011
hs302t012
unit/FollowReferences/followref001

@ -114,27 +114,27 @@ getStaticObjField(const char* className, const char* objFieldName,
/* ============================================================================= */ /* ============================================================================= */
static int prepare() { static bool prepare() {
ExceptionCheckingJniEnvPtr ec_jni(jni); ExceptionCheckingJniEnvPtr ec_jni(jni);
mainThread = findThread(MAIN_THREAD_NAME); mainThread = findThread(MAIN_THREAD_NAME);
if (!NSK_VERIFY(mainThread != NULL)) { if (!NSK_VERIFY(mainThread != NULL)) {
NSK_COMPLAIN1("<%s> thread not found\n", MAIN_THREAD_NAME); NSK_COMPLAIN1("<%s> thread not found\n", MAIN_THREAD_NAME);
return NSK_FALSE; return false;
} }
/* make thread accessable for a long time */ /* make thread accessable for a long time */
mainThread = ec_jni->NewGlobalRef(mainThread, TRACE_JNI_CALL); mainThread = ec_jni->NewGlobalRef(mainThread, TRACE_JNI_CALL);
startObject = getStaticObjField(DEBUGEE_CLASS_NAME, START_FIELD_NAME, OBJECT_FIELD_SIG); startObject = getStaticObjField(DEBUGEE_CLASS_NAME, START_FIELD_NAME, OBJECT_FIELD_SIG);
if (!NSK_VERIFY(startObject != NULL)) if (!NSK_VERIFY(startObject != NULL))
return NSK_FALSE; return false;
/*make object accessable for a long time*/ /*make object accessable for a long time*/
startObject = ec_jni->NewGlobalRef(startObject, TRACE_JNI_CALL); startObject = ec_jni->NewGlobalRef(startObject, TRACE_JNI_CALL);
endObject = getStaticObjField(DEBUGEE_CLASS_NAME, END_FIELD_NAME, OBJECT_FIELD_SIG); endObject = getStaticObjField(DEBUGEE_CLASS_NAME, END_FIELD_NAME, OBJECT_FIELD_SIG);
if (!NSK_VERIFY(endObject != NULL)) if (!NSK_VERIFY(endObject != NULL))
return NSK_FALSE; return false;
/*make object accessable for a long time*/ /*make object accessable for a long time*/
endObject = ec_jni->NewGlobalRef(endObject, TRACE_JNI_CALL); endObject = ec_jni->NewGlobalRef(endObject, TRACE_JNI_CALL);
@ -143,17 +143,16 @@ static int prepare() {
THREAD_FIELD_NAME, THREAD_FIELD_NAME,
THREAD_FIELD_SIG); THREAD_FIELD_SIG);
if (!NSK_VERIFY(debuggeeThread != NULL)) if (!NSK_VERIFY(debuggeeThread != NULL))
return NSK_FALSE; return false;
/* make thread accessable for a long time */ /* make thread accessable for a long time */
debuggeeThread = ec_jni->NewGlobalRef(debuggeeThread, TRACE_JNI_CALL); debuggeeThread = ec_jni->NewGlobalRef(debuggeeThread, TRACE_JNI_CALL);
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */
static int static bool clean() {
clean() {
ExceptionCheckingJniEnvPtr ec_jni(jni); ExceptionCheckingJniEnvPtr ec_jni(jni);
/* disable MonitorContendedEnter event */ /* disable MonitorContendedEnter event */
@ -173,7 +172,7 @@ clean() {
debuggeeThread = NULL; debuggeeThread = NULL;
mainThread = NULL; mainThread = NULL;
return NSK_TRUE; return true;
} }
/* ========================================================================== */ /* ========================================================================== */
@ -224,10 +223,10 @@ changeCount(jvmtiEvent event, int *currentCounts) {
/* ============================================================================= */ /* ============================================================================= */
int checkEvents(int step) { bool checkEvents(int step) {
int i; int i;
jvmtiEvent curr; jvmtiEvent curr;
int result = NSK_TRUE; bool result = true;
int *currentCounts; int *currentCounts;
int isExpected = 0; int isExpected = 0;
@ -243,7 +242,7 @@ int checkEvents(int step) {
default: default:
NSK_COMPLAIN1("Unexpected step no: %d\n", step); NSK_COMPLAIN1("Unexpected step no: %d\n", step);
return NSK_FALSE; return false;
} }
for (i = 0; i < JVMTI_EVENT_COUNT; i++) { for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
@ -277,14 +276,14 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value is 1\n", NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value is 1\n",
currentCounts[i], currentCounts[i],
TranslateEvent(curr)); TranslateEvent(curr));
result = NSK_FALSE; result = false;
} }
} else { } else {
if (currentCounts[i] > 0) { if (currentCounts[i] > 0) {
NSK_COMPLAIN2("Unexpected event %s was sent %d times\n", NSK_COMPLAIN2("Unexpected event %s was sent %d times\n",
TranslateEvent(curr), TranslateEvent(curr),
currentCounts[i]); currentCounts[i]);
result = NSK_FALSE; result = false;
} }
} }
} }
@ -546,7 +545,7 @@ cbNewMonitorContendedEnter(jvmtiEnv* jvmti, JNIEnv* jni_env, jthread thread,
/* ============================================================================= */ /* ============================================================================= */
static int enableEvent(jvmtiEvent event) { static bool enableEvent(jvmtiEvent event) {
if (nsk_jvmti_isOptionalEvent(event) if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_MONITOR_CONTENDED_ENTER) && (event != JVMTI_EVENT_MONITOR_CONTENDED_ENTER)
@ -557,22 +556,22 @@ static int enableEvent(jvmtiEvent event) {
jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} else { } else {
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} }
return NSK_TRUE; return true;
} }
static int enableEventList() { static bool enableEventList() {
int i; int i;
int result = NSK_TRUE; bool result = true;
NSK_DISPLAY0("Enable events\n"); NSK_DISPLAY0("Enable events\n");
@ -588,18 +587,17 @@ static int enableEventList() {
result = result && enableEvent(event); result = result && enableEvent(event);
} }
if (result == NSK_FALSE) { if (!result) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */
static int static bool setCallBacks(int step) {
setCallBacks(int step) {
int i; int i;
@ -659,9 +657,9 @@ setCallBacks(int step) {
} }
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE; return false;
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -69,12 +69,12 @@ showEventStatistics(int step /*int *currentCounts*/) {
* Testcase: check tested events. * Testcase: check tested events.
* - check if expected events received for each method * - check if expected events received for each method
* *
* Returns NSK_TRUE if test may continue; or NSK_FALSE for test break. * Returns true if test may continue; or false for test break.
*/ */
int checkEvents(int step) { bool checkEvents(int step) {
int i; int i;
jvmtiEvent curr; jvmtiEvent curr;
int result = NSK_TRUE; bool result = true;
int *currentCounts; int *currentCounts;
int isExpected = 0; int isExpected = 0;
@ -93,7 +93,7 @@ int checkEvents(int step) {
default: default:
NSK_COMPLAIN1("Unexpected step no: %d\n", step); NSK_COMPLAIN1("Unexpected step no: %d\n", step);
return NSK_FALSE; return false;
} }
if (currentCounts[ind_start] != currentCounts[ind_fnsh]) { if (currentCounts[ind_start] != currentCounts[ind_fnsh]) {
@ -103,7 +103,7 @@ int checkEvents(int step) {
currentCounts[ind_start]); currentCounts[ind_start]);
NSK_COMPLAIN1("\tGARBAGE_COLLECTION_FINISH:\t%6d\n", NSK_COMPLAIN1("\tGARBAGE_COLLECTION_FINISH:\t%6d\n",
currentCounts[ind_fnsh]); currentCounts[ind_fnsh]);
return NSK_FALSE; return false;
} }
for (i = 0; i < JVMTI_EVENT_COUNT; i++) { for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
@ -132,14 +132,14 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n", NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n",
currentCounts[i], currentCounts[i],
TranslateEvent(curr)); TranslateEvent(curr));
result = NSK_FALSE; result = false;
} }
} else { } else {
if (currentCounts[i] > 0) { if (currentCounts[i] > 0) {
NSK_COMPLAIN2("Unexpected event %s was sent %d times\n", NSK_COMPLAIN2("Unexpected event %s was sent %d times\n",
TranslateEvent(curr), TranslateEvent(curr),
currentCounts[i]); currentCounts[i]);
result = NSK_FALSE; result = false;
} }
} }
} }
@ -338,7 +338,7 @@ cbNewGarbageCollectionFinish(jvmtiEnv *jvmti_env) {
/* ============================================================================= */ /* ============================================================================= */
static int enableEvent(jvmtiEvent event) { static bool enableEvent(jvmtiEvent event) {
if (nsk_jvmti_isOptionalEvent(event) if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_GARBAGE_COLLECTION_START) && (event != JVMTI_EVENT_GARBAGE_COLLECTION_START)
@ -347,22 +347,22 @@ static int enableEvent(jvmtiEvent event) {
jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} else { } else {
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} }
return NSK_TRUE; return true;
} }
static int enableEventList() { static bool enableEventList() {
int i; int i;
int result = NSK_TRUE; bool result = true;
NSK_DISPLAY0("Enable events\n"); NSK_DISPLAY0("Enable events\n");
@ -378,18 +378,17 @@ static int enableEventList() {
result = result && enableEvent(event); result = result && enableEvent(event);
} }
if (result == NSK_FALSE) { if (!result) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */
static int static bool setCallBacks(int step) {
setCallBacks(int step) {
int i; int i;
@ -447,9 +446,9 @@ setCallBacks(int step) {
} }
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE; return false;
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -67,10 +67,10 @@ showEventStatistics(int step) {
/* ========================================================================== */ /* ========================================================================== */
int checkEvents(int step) { bool checkEvents(int step) {
int i; int i;
jvmtiEvent curr; jvmtiEvent curr;
int result = NSK_TRUE; bool result = true;
int *currentCounts; int *currentCounts;
int isExpected = 0; int isExpected = 0;
@ -86,7 +86,7 @@ int checkEvents(int step) {
default: default:
NSK_COMPLAIN1("Unexpected step no: %d\n", step); NSK_COMPLAIN1("Unexpected step no: %d\n", step);
return NSK_FALSE; return false;
} }
for (i = 0; i < JVMTI_EVENT_COUNT; i++) { for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
@ -113,7 +113,7 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n", NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n",
currentCounts[i], currentCounts[i],
TranslateEvent(curr)); TranslateEvent(curr));
result = NSK_FALSE; result = false;
} }
} else { } else {
@ -122,7 +122,7 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected event %s was sent %d times\n", NSK_COMPLAIN2("Unexpected event %s was sent %d times\n",
TranslateEvent(curr), TranslateEvent(curr),
currentCounts[i]); currentCounts[i]);
result = NSK_FALSE; result = false;
} }
} }
} }
@ -372,7 +372,7 @@ cbNewCompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method,
/* ============================================================================= */ /* ============================================================================= */
static int enableEvent(jvmtiEvent event) { static bool enableEvent(jvmtiEvent event) {
if (nsk_jvmti_isOptionalEvent(event) if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_COMPILED_METHOD_LOAD) && (event != JVMTI_EVENT_COMPILED_METHOD_LOAD)
@ -381,25 +381,25 @@ static int enableEvent(jvmtiEvent event) {
jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} else { } else {
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} }
return NSK_TRUE; return true;
} }
/** /**
* Enable or disable tested events. * Enable or disable tested events.
*/ */
static int enableEventList() { static bool enableEventList() {
int i; int i;
int result = NSK_TRUE; bool result = true;
NSK_DISPLAY0("Enable events\n"); NSK_DISPLAY0("Enable events\n");
@ -415,18 +415,17 @@ static int enableEventList() {
result = result && enableEvent(event); result = result && enableEvent(event);
} }
if (result == NSK_FALSE) { if (!result) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */
static int static bool setCallBacks(int step) {
setCallBacks(int step) {
int i; int i;
@ -485,9 +484,9 @@ setCallBacks(int step) {
} }
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE; return false;
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -82,10 +82,10 @@ showEventStatistics(int step) {
/* ========================================================================== */ /* ========================================================================== */
int checkEvents(int step) { bool checkEvents(int step) {
int i; int i;
jvmtiEvent curr; jvmtiEvent curr;
int result = NSK_TRUE; bool result = true;
int *currentCounts; int *currentCounts;
int isExpected = 0; int isExpected = 0;
@ -101,7 +101,7 @@ int checkEvents(int step) {
default: default:
NSK_COMPLAIN1("Unexpected step no: %d\n", step); NSK_COMPLAIN1("Unexpected step no: %d\n", step);
return NSK_FALSE; return false;
} }
for (i = 0; i < JVMTI_EVENT_COUNT; i++) { for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
@ -128,14 +128,14 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n", NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n",
currentCounts[i], currentCounts[i],
TranslateEvent(curr)); TranslateEvent(curr));
result = NSK_FALSE; result = false;
} }
} else { } else {
if (currentCounts[i] > 0) { if (currentCounts[i] > 0) {
NSK_COMPLAIN2("Unexpected event %s was sent %d times\n", NSK_COMPLAIN2("Unexpected event %s was sent %d times\n",
TranslateEvent(curr), TranslateEvent(curr),
currentCounts[i]); currentCounts[i]);
result = NSK_FALSE; result = false;
} }
} }
} }
@ -382,7 +382,7 @@ cbNewNativeMethodBind(jvmtiEnv *jvmti_env, JNIEnv* jni_env,jthread thread,
/* ============================================================================= */ /* ============================================================================= */
static int enableEvent(jvmtiEvent event) { static bool enableEvent(jvmtiEvent event) {
if (nsk_jvmti_isOptionalEvent(event) if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_NATIVE_METHOD_BIND)) { && (event != JVMTI_EVENT_NATIVE_METHOD_BIND)) {
@ -390,25 +390,25 @@ static int enableEvent(jvmtiEvent event) {
jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} else { } else {
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} }
return NSK_TRUE; return true;
} }
/** /**
* Enable or disable tested events. * Enable or disable tested events.
*/ */
static int enableEventList() { static bool enableEventList() {
int i; int i;
int result = NSK_TRUE; bool result = true;
NSK_DISPLAY0("Enable events\n"); NSK_DISPLAY0("Enable events\n");
@ -424,18 +424,17 @@ static int enableEventList() {
result = result && enableEvent(event); result = result && enableEvent(event);
} }
if (result == NSK_FALSE) { if (!result) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */
static int static bool setCallBacks(int step) {
setCallBacks(int step) {
int i; int i;
@ -492,9 +491,9 @@ setCallBacks(int step) {
} }
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE; return false;
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -70,7 +70,7 @@ showEventStatistics(int step) {
int checkEvents(int step) { int checkEvents(int step) {
int i; int i;
jvmtiEvent curr; jvmtiEvent curr;
int result = NSK_TRUE; bool result = true;
int *currentCounts; int *currentCounts;
int isExpected = 0; int isExpected = 0;
@ -86,7 +86,7 @@ int checkEvents(int step) {
default: default:
NSK_COMPLAIN1("Unexpected step no: %d\n", step); NSK_COMPLAIN1("Unexpected step no: %d\n", step);
return NSK_FALSE; return false;
} }
for (i = 0; i < JVMTI_EVENT_COUNT; i++) { for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
@ -113,7 +113,7 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be non-negative\n", NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be non-negative\n",
currentCounts[i], currentCounts[i],
TranslateEvent(curr)); TranslateEvent(curr));
result = NSK_FALSE; result = false;
} }
} else { } else {
@ -122,7 +122,7 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected event %s was sent %d times\n", NSK_COMPLAIN2("Unexpected event %s was sent %d times\n",
TranslateEvent(curr), TranslateEvent(curr),
currentCounts[i]); currentCounts[i]);
result = NSK_FALSE; result = false;
} }
} }
} }
@ -374,7 +374,7 @@ cbNewVMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
/* ============================================================================= */ /* ============================================================================= */
static int enableEvent(jvmtiEvent event) { static bool enableEvent(jvmtiEvent event) {
if (nsk_jvmti_isOptionalEvent(event) if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_VM_OBJECT_ALLOC)) { && (event != JVMTI_EVENT_VM_OBJECT_ALLOC)) {
@ -382,23 +382,23 @@ static int enableEvent(jvmtiEvent event) {
jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} else { } else {
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} }
return NSK_TRUE; return true;
} }
/** /**
* Enable or disable tested events. * Enable or disable tested events.
*/ */
static int enableEventList() { static bool enableEventList() {
int i, result; int i, result;
@ -414,18 +414,17 @@ static int enableEventList() {
result = result && enableEvent(event); result = result && enableEvent(event);
} }
if (result == NSK_FALSE) { if (!result) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */
static int static bool setCallBacks(int step) {
setCallBacks(int step) {
int i; int i;
@ -479,9 +478,9 @@ setCallBacks(int step) {
} }
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE; return false;
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -59,9 +59,9 @@ Java_nsk_jvmti_scenarios_events_EM02_em02t006_setTag(JNIEnv *env,
if (!NSK_JVMTI_VERIFY(jvmti->SetTag(object, tag))) { if (!NSK_JVMTI_VERIFY(jvmti->SetTag(object, tag))) {
NSK_COMPLAIN0("TEST FAILED: unable to set tag for a tested object\n"); NSK_COMPLAIN0("TEST FAILED: unable to set tag for a tested object\n");
return NSK_FALSE; return false;
} }
return NSK_TRUE; return true;
} }
static void static void
@ -86,7 +86,7 @@ showEventStatistics(int step) {
int checkEvents(int step) { int checkEvents(int step) {
int i; int i;
jvmtiEvent curr; jvmtiEvent curr;
int result = NSK_TRUE; bool result = true;
int *currentCounts; int *currentCounts;
int isExpected = 0; int isExpected = 0;
@ -102,7 +102,7 @@ int checkEvents(int step) {
default: default:
NSK_COMPLAIN1("Unexpected step no: %d\n", step); NSK_COMPLAIN1("Unexpected step no: %d\n", step);
return NSK_FALSE; return false;
} }
for (i = 0; i < JVMTI_EVENT_COUNT; i++) { for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
@ -129,7 +129,7 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n", NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n",
currentCounts[i], currentCounts[i],
TranslateEvent(curr)); TranslateEvent(curr));
result = NSK_FALSE; result = false;
} }
} else { } else {
@ -137,7 +137,7 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected event %s was sent %d times\n", NSK_COMPLAIN2("Unexpected event %s was sent %d times\n",
TranslateEvent(curr), TranslateEvent(curr),
currentCounts[i]); currentCounts[i]);
result = NSK_FALSE; result = false;
} }
} }
} }
@ -323,7 +323,7 @@ cbVMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
/* ============================================================================= */ /* ============================================================================= */
static int enableEvent(jvmtiEvent event) { static bool enableEvent(jvmtiEvent event) {
if (nsk_jvmti_isOptionalEvent(event) if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_OBJECT_FREE)) { && (event != JVMTI_EVENT_OBJECT_FREE)) {
@ -331,23 +331,23 @@ static int enableEvent(jvmtiEvent event) {
jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} else { } else {
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} }
return NSK_TRUE; return true;
} }
/** /**
* Enable or disable tested events. * Enable or disable tested events.
*/ */
static int enableEventList() { static bool enableEventList() {
int i, result; int i, result;
@ -363,18 +363,17 @@ static int enableEventList() {
result = result && enableEvent(event); result = result && enableEvent(event);
} }
if (result == NSK_FALSE) { if (!result) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */
static int static bool setCallBacks(int step) {
setCallBacks(int step) {
int i; int i;
@ -428,9 +427,9 @@ setCallBacks(int step) {
} }
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE; return false;
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -71,7 +71,7 @@ showEventStatistics(int step) {
int checkEvents(int step) { int checkEvents(int step) {
int i; int i;
jvmtiEvent curr; jvmtiEvent curr;
int result = NSK_TRUE; bool result = true;
int *currentCounts; int *currentCounts;
int isExpected = 0; int isExpected = 0;
@ -87,7 +87,7 @@ int checkEvents(int step) {
default: default:
NSK_COMPLAIN1("Unexpected step no: %d\n", step); NSK_COMPLAIN1("Unexpected step no: %d\n", step);
return NSK_FALSE; return false;
} }
for (i = 0; i < JVMTI_EVENT_COUNT; i++) { for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
@ -114,7 +114,7 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n", NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n",
currentCounts[i], currentCounts[i],
TranslateEvent(curr)); TranslateEvent(curr));
result = NSK_FALSE; result = false;
} }
} else { } else {
@ -122,7 +122,7 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected event %s was sent %d times\n", NSK_COMPLAIN2("Unexpected event %s was sent %d times\n",
TranslateEvent(curr), TranslateEvent(curr),
currentCounts[i]); currentCounts[i]);
result = NSK_FALSE; result = false;
} }
} }
} }
@ -352,7 +352,7 @@ cbVMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
/* ============================================================================= */ /* ============================================================================= */
static int enableEvent(jvmtiEvent event) { static bool enableEvent(jvmtiEvent event) {
if (nsk_jvmti_isOptionalEvent(event) if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_SINGLE_STEP)) { && (event != JVMTI_EVENT_SINGLE_STEP)) {
@ -360,23 +360,23 @@ static int enableEvent(jvmtiEvent event) {
jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} else { } else {
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} }
return NSK_TRUE; return true;
} }
/** /**
* Enable or disable tested events. * Enable or disable tested events.
*/ */
static int enableEventList() { static bool enableEventList() {
int i, result; int i, result;
@ -392,18 +392,17 @@ static int enableEventList() {
result = result && enableEvent(event); result = result && enableEvent(event);
} }
if (result == NSK_FALSE) { if (!result) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */
static int static bool setCallBacks(int step) {
setCallBacks(int step) {
int i; int i;
@ -464,9 +463,9 @@ setCallBacks(int step) {
} }
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE; return false;
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -68,7 +68,7 @@ showEventStatistics(int step) {
int checkEvents(int step) { int checkEvents(int step) {
int i; int i;
jvmtiEvent curr; jvmtiEvent curr;
int result = NSK_TRUE; bool result = true;
int *currentCounts; int *currentCounts;
int isExpected = 0; int isExpected = 0;
@ -84,7 +84,7 @@ int checkEvents(int step) {
default: default:
NSK_COMPLAIN1("Unexpected step no: %d\n", step); NSK_COMPLAIN1("Unexpected step no: %d\n", step);
return NSK_FALSE; return false;
} }
for (i = 0; i < JVMTI_EVENT_COUNT; i++) { for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
@ -113,7 +113,7 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n", NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n",
currentCounts[i], currentCounts[i],
TranslateEvent(curr)); TranslateEvent(curr));
result = NSK_FALSE; result = false;
} }
} else { } else {
@ -121,7 +121,7 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected event %s was sent %d times\n", NSK_COMPLAIN2("Unexpected event %s was sent %d times\n",
TranslateEvent(curr), TranslateEvent(curr),
currentCounts[i]); currentCounts[i]);
result = NSK_FALSE; result = false;
} }
} }
} }
@ -371,7 +371,7 @@ cbVMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
/* ============================================================================= */ /* ============================================================================= */
static int enableEvent(jvmtiEvent event) { static bool enableEvent(jvmtiEvent event) {
if (nsk_jvmti_isOptionalEvent(event) if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_EXCEPTION) && (event != JVMTI_EVENT_EXCEPTION)
@ -380,23 +380,23 @@ static int enableEvent(jvmtiEvent event) {
jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} else { } else {
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} }
return NSK_TRUE; return true;
} }
/** /**
* Enable or disable tested events. * Enable or disable tested events.
*/ */
static int enableEventList() { static bool enableEventList() {
int i, result; int i, result;
@ -412,18 +412,17 @@ static int enableEventList() {
result = result && enableEvent(event); result = result && enableEvent(event);
} }
if (result == NSK_FALSE) { if (!result) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */
static int static bool setCallBacks(int step) {
setCallBacks(int step) {
int i; int i;
@ -478,9 +477,9 @@ setCallBacks(int step) {
} }
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE; return false;
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -69,7 +69,7 @@ showEventStatistics(int step) {
int checkEvents(int step) { int checkEvents(int step) {
int i; int i;
jvmtiEvent curr; jvmtiEvent curr;
int result = NSK_TRUE; bool result = true;
int *currentCounts; int *currentCounts;
int isExpected = 0; int isExpected = 0;
@ -85,7 +85,7 @@ int checkEvents(int step) {
default: default:
NSK_COMPLAIN1("Unexpected step no: %d\n", step); NSK_COMPLAIN1("Unexpected step no: %d\n", step);
return NSK_FALSE; return false;
} }
for (i = 0; i < JVMTI_EVENT_COUNT; i++) { for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
@ -115,7 +115,7 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n", NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n",
currentCounts[i], currentCounts[i],
TranslateEvent(curr)); TranslateEvent(curr));
result = NSK_FALSE; result = false;
} }
} else { } else {
if (currentCounts[i] != NUMBER_OF_INVOCATIONS) { if (currentCounts[i] != NUMBER_OF_INVOCATIONS) {
@ -123,7 +123,7 @@ int checkEvents(int step) {
TranslateEvent(curr), TranslateEvent(curr),
currentCounts[i], currentCounts[i],
NUMBER_OF_INVOCATIONS); NUMBER_OF_INVOCATIONS);
result = NSK_FALSE; result = false;
} }
} }
} else { } else {
@ -132,7 +132,7 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected event %s was sent %d times\n", NSK_COMPLAIN2("Unexpected event %s was sent %d times\n",
TranslateEvent(curr), TranslateEvent(curr),
currentCounts[i]); currentCounts[i]);
result = NSK_FALSE; result = false;
} }
} }
} }
@ -378,7 +378,7 @@ cbVMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
/* ============================================================================= */ /* ============================================================================= */
static int enableEvent(jvmtiEvent event) { static bool enableEvent(jvmtiEvent event) {
if (nsk_jvmti_isOptionalEvent(event) if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_METHOD_ENTRY) && (event != JVMTI_EVENT_METHOD_ENTRY)
@ -387,23 +387,23 @@ static int enableEvent(jvmtiEvent event) {
jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} else { } else {
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} }
return NSK_TRUE; return true;
} }
/** /**
* Enable or disable tested events. * Enable or disable tested events.
*/ */
static int enableEventList() { static bool enableEventList() {
int i, result; int i, result;
@ -419,18 +419,17 @@ static int enableEventList() {
result = result && enableEvent(event); result = result && enableEvent(event);
} }
if (result == NSK_FALSE) { if (!result) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */
static int static bool setCallBacks(int step) {
setCallBacks(int step) {
int i; int i;
@ -485,9 +484,9 @@ setCallBacks(int step) {
} }
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE; return false;
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */

@ -73,7 +73,7 @@ showEventStatistics(int step) {
int checkEvents(int step) { int checkEvents(int step) {
int i; int i;
jvmtiEvent curr; jvmtiEvent curr;
int result = NSK_TRUE; bool result = true;
int *currentCounts; int *currentCounts;
int isExpected = 0; int isExpected = 0;
@ -89,7 +89,7 @@ int checkEvents(int step) {
default: default:
NSK_COMPLAIN1("Unexpected step no: %d\n", step); NSK_COMPLAIN1("Unexpected step no: %d\n", step);
return NSK_FALSE; return false;
} }
for (i = 0; i < JVMTI_EVENT_COUNT; i++) { for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
@ -121,14 +121,14 @@ int checkEvents(int step) {
TranslateEvent(curr), TranslateEvent(curr),
currentCounts[i], currentCounts[i],
NUMBER_OF_INVOCATIONS); NUMBER_OF_INVOCATIONS);
result = NSK_FALSE; result = false;
} }
} else { } else {
if (currentCounts[i] < 1) { if (currentCounts[i] < 1) {
NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n", NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n",
currentCounts[i], currentCounts[i],
TranslateEvent(curr)); TranslateEvent(curr));
result = NSK_FALSE; result = false;
} }
} }
@ -138,7 +138,7 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected event %s was sent %d times\n", NSK_COMPLAIN2("Unexpected event %s was sent %d times\n",
TranslateEvent(curr), TranslateEvent(curr),
currentCounts[i]); currentCounts[i]);
result = NSK_FALSE; result = false;
} }
} }
} }
@ -334,7 +334,7 @@ cbVMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
/* ============================================================================= */ /* ============================================================================= */
static int enableEvent(jvmtiEvent event) { static bool enableEvent(jvmtiEvent event) {
if (nsk_jvmti_isOptionalEvent(event) if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_FIELD_MODIFICATION) && (event != JVMTI_EVENT_FIELD_MODIFICATION)
@ -343,23 +343,23 @@ static int enableEvent(jvmtiEvent event) {
jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} else { } else {
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} }
return NSK_TRUE; return true;
} }
/** /**
* Enable or disable tested events. * Enable or disable tested events.
*/ */
static int enableEventList() { static bool enableEventList() {
int i, result; int i, result;
@ -375,18 +375,17 @@ static int enableEventList() {
result = result && enableEvent(event); result = result && enableEvent(event);
} }
if (result == NSK_FALSE) { if (!result) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */
static int static bool setCallBacks(int step) {
setCallBacks(int step) {
int i; int i;
@ -441,9 +440,9 @@ setCallBacks(int step) {
} }
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE; return false;
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */

@ -72,7 +72,7 @@ showEventStatistics(int step) {
int checkEvents(int step) { int checkEvents(int step) {
int i; int i;
jvmtiEvent curr; jvmtiEvent curr;
int result = NSK_TRUE; bool result = true;
int *currentCounts; int *currentCounts;
int isExpected = 0; int isExpected = 0;
@ -88,7 +88,7 @@ int checkEvents(int step) {
default: default:
NSK_COMPLAIN1("Unexpected step no: %d\n", step); NSK_COMPLAIN1("Unexpected step no: %d\n", step);
return NSK_FALSE; return false;
} }
for (i = 0; i < JVMTI_EVENT_COUNT; i++) { for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
@ -116,7 +116,7 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n", NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n",
currentCounts[i], currentCounts[i],
TranslateEvent(curr)); TranslateEvent(curr));
result = NSK_FALSE; result = false;
} }
} else { } else {
if (currentCounts[i] != NUMBER_OF_INVOCATIONS) { if (currentCounts[i] != NUMBER_OF_INVOCATIONS) {
@ -124,7 +124,7 @@ int checkEvents(int step) {
TranslateEvent(curr), TranslateEvent(curr),
currentCounts[i], currentCounts[i],
NUMBER_OF_INVOCATIONS); NUMBER_OF_INVOCATIONS);
result = NSK_FALSE; result = false;
} }
} }
@ -134,7 +134,7 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected event %s was sent %d times\n", NSK_COMPLAIN2("Unexpected event %s was sent %d times\n",
TranslateEvent(curr), TranslateEvent(curr),
currentCounts[i]); currentCounts[i]);
result = NSK_FALSE; result = false;
} }
} }
} }
@ -321,7 +321,7 @@ cbVMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
/* ============================================================================= */ /* ============================================================================= */
static int enableEvent(jvmtiEvent event) { static bool enableEvent(jvmtiEvent event) {
if (nsk_jvmti_isOptionalEvent(event) if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_BREAKPOINT)) { && (event != JVMTI_EVENT_BREAKPOINT)) {
@ -329,23 +329,23 @@ static int enableEvent(jvmtiEvent event) {
jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} else { } else {
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} }
return NSK_TRUE; return true;
} }
/** /**
* Enable or disable tested events. * Enable or disable tested events.
*/ */
static int enableEventList() { static bool enableEventList() {
int i, result; int i, result;
@ -361,18 +361,17 @@ static int enableEventList() {
result = result && enableEvent(event); result = result && enableEvent(event);
} }
if (result == NSK_FALSE) { if (!result) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */
static int static bool setCallBacks(int step) {
setCallBacks(int step) {
int i; int i;
@ -426,9 +425,9 @@ setCallBacks(int step) {
} }
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE; return false;
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */

@ -75,10 +75,10 @@ showEventStatistics(int step) {
/* ========================================================================== */ /* ========================================================================== */
int checkEvents(int step) { bool checkEvents(int step) {
int i; int i;
jvmtiEvent curr; jvmtiEvent curr;
int result = NSK_TRUE; bool result = true;
int *currentCounts; int *currentCounts;
int isExpected = 0; int isExpected = 0;
@ -94,7 +94,7 @@ int checkEvents(int step) {
default: default:
NSK_COMPLAIN1("Unexpected step no: %d\n", step); NSK_COMPLAIN1("Unexpected step no: %d\n", step);
return NSK_FALSE; return false;
} }
for (i = 0; i < JVMTI_EVENT_COUNT; i++) { for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
@ -123,14 +123,14 @@ int checkEvents(int step) {
TranslateEvent(curr), TranslateEvent(curr),
currentCounts[i], currentCounts[i],
NUMBER_OF_INVOCATIONS); NUMBER_OF_INVOCATIONS);
result = NSK_FALSE; result = false;
} }
} else { } else {
if (currentCounts[i] < 1) { if (currentCounts[i] < 1) {
NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n", NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n",
currentCounts[i], currentCounts[i],
TranslateEvent(curr)); TranslateEvent(curr));
result = NSK_FALSE; result = false;
} }
} }
@ -140,7 +140,7 @@ int checkEvents(int step) {
NSK_COMPLAIN2("Unexpected event %s was sent %d times\n", NSK_COMPLAIN2("Unexpected event %s was sent %d times\n",
TranslateEvent(curr), TranslateEvent(curr),
currentCounts[i]); currentCounts[i]);
result = NSK_FALSE; result = false;
} }
} }
} }
@ -325,7 +325,7 @@ cbVMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
/* ============================================================================= */ /* ============================================================================= */
static int enableEvent(jvmtiEvent event) { static bool enableEvent(jvmtiEvent event) {
if (nsk_jvmti_isOptionalEvent(event) if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_FRAME_POP)) { && (event != JVMTI_EVENT_FRAME_POP)) {
@ -333,23 +333,23 @@ static int enableEvent(jvmtiEvent event) {
jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} else { } else {
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n", NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event)); TranslateEvent(event));
return NSK_FALSE; return false;
} }
} }
return NSK_TRUE; return true;
} }
/** /**
* Enable or disable tested events. * Enable or disable tested events.
*/ */
static int enableEventList() { static bool enableEventList() {
int i, result; int i, result;
@ -365,18 +365,17 @@ static int enableEventList() {
result = result && enableEvent(event); result = result && enableEvent(event);
} }
if (result == NSK_FALSE) { if (!result) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */
static int static bool setCallBacks(int step) {
setCallBacks(int step) {
int i; int i;
@ -430,9 +429,9 @@ setCallBacks(int step) {
} }
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE; return false;
return NSK_TRUE; return true;
} }
/* ============================================================================= */ /* ============================================================================= */

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -117,7 +117,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
return JNI_ERR; return JNI_ERR;
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -81,7 +81,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -54,7 +54,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
return JNI_ERR; return JNI_ERR;
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -151,7 +151,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
memset(&caps, 0, sizeof(caps)); memset(&caps, 0, sizeof(caps));
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -103,7 +103,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
memset(&caps, 0, sizeof(caps)); memset(&caps, 0, sizeof(caps));
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -145,7 +145,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -146,7 +146,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -134,7 +134,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("#error Agent :: Failed to parse options.\n"); nsk_printf("#error Agent :: Failed to parse options.\n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -151,7 +151,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
memset(&caps, 0, sizeof(caps)); memset(&caps, 0, sizeof(caps));
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
NSK_DISPLAY0("#error Agent :: Failed to parse options.\n"); NSK_DISPLAY0("#error Agent :: Failed to parse options.\n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -55,7 +55,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options.\n"); nsk_printf("# error agent Failed to parse options.\n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -57,7 +57,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
return JNI_ERR; return JNI_ERR;
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf(" Agent:: ## error agent Failed to parse options.\n"); nsk_printf(" Agent:: ## error agent Failed to parse options.\n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -75,7 +75,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options.\n"); nsk_printf("# error agent Failed to parse options.\n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -76,7 +76,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -73,7 +73,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -73,7 +73,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -76,7 +76,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -77,7 +77,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -73,7 +73,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -75,7 +75,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -74,7 +74,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -71,7 +71,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -74,7 +74,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -74,7 +74,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -73,7 +73,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -74,7 +74,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -76,7 +76,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
} else { } else {
jvmtiCapabilities caps; jvmtiCapabilities caps;
jvmtiEventCallbacks eventCallbacks; jvmtiEventCallbacks eventCallbacks;
if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { if (!nsk_jvmti_parseOptions(options)) {
nsk_printf("# error agent Failed to parse options \n"); nsk_printf("# error agent Failed to parse options \n");
return JNI_ERR; return JNI_ERR;
} }

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -101,8 +101,7 @@ static const char* ref_kind_str[28] = {
/* ============================================================================= */ /* ============================================================================= */
static int get_reference_index(jvmtiHeapReferenceKind reference_kind, static int get_reference_index(jvmtiHeapReferenceKind reference_kind,
const jvmtiHeapReferenceInfo* reference_info) const jvmtiHeapReferenceInfo* reference_info) {
{
int referrer_index = 0; int referrer_index = 0;
switch (reference_kind) { switch (reference_kind) {
@ -132,11 +131,10 @@ static int get_reference_index(jvmtiHeapReferenceKind reference_kind,
/** Initialize objectDescList. */ /** Initialize objectDescList. */
static int initObjectDescList(jvmtiEnv* jvmti, static bool initObjectDescList(jvmtiEnv* jvmti,
int chainLength, int chainLength,
int* objectsCount, int* objectsCount,
ObjectDesc** objectDescList) ObjectDesc** objectDescList) {
{
/* root object + reachable and unreachable object chains */ /* root object + reachable and unreachable object chains */
*objectsCount = 1 + 2 * chainLength; *objectsCount = 1 + 2 * chainLength;
@ -145,7 +143,7 @@ static int initObjectDescList(jvmtiEnv* jvmti,
if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)), if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)),
(unsigned char**) objectDescList))) { (unsigned char**) objectDescList))) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
printf(" ... allocated array: 0x%p\n", (void*)objectDescList); printf(" ... allocated array: 0x%p\n", (void*)objectDescList);
fflush(0); fflush(0);
@ -166,21 +164,20 @@ static int initObjectDescList(jvmtiEnv* jvmti,
(*objectDescList)[chainLength].exp_found = 1; (*objectDescList)[chainLength].exp_found = 1;
return NSK_TRUE; return true;
} /* initObjectDescList */ } /* initObjectDescList */
/** Find and tag classes. */ /** Find and tag classes. */
static int getAndTagClasses(jvmtiEnv* jvmti, static bool getAndTagClasses(jvmtiEnv* jvmti,
JNIEnv* jni, JNIEnv* jni,
jclass* debugeeClass, jclass* debugeeClass,
jclass* rootObjectClass, jclass* rootObjectClass,
jclass* chainObjectClass) jclass* chainObjectClass) {
{
if (!NSK_JNI_VERIFY(jni, (*debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { if (!NSK_JNI_VERIFY(jni, (*debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
printf("\nFound debugee class: 0x%p\n %s\n", printf("\nFound debugee class: 0x%p\n %s\n",
(void*) *debugeeClass, DEBUGEE_CLASS_NAME); (void*) *debugeeClass, DEBUGEE_CLASS_NAME);
@ -189,7 +186,7 @@ static int getAndTagClasses(jvmtiEnv* jvmti,
if (!NSK_JNI_VERIFY(jni, (*rootObjectClass = if (!NSK_JNI_VERIFY(jni, (*rootObjectClass =
jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
if (!NSK_JVMTI_VERIFY(jvmti->SetTag(*rootObjectClass, ROOT_CLASS_TAG))) { if (!NSK_JVMTI_VERIFY(jvmti->SetTag(*rootObjectClass, ROOT_CLASS_TAG))) {
@ -205,7 +202,7 @@ static int getAndTagClasses(jvmtiEnv* jvmti,
if (!NSK_JNI_VERIFY(jni, (*chainObjectClass = if (!NSK_JNI_VERIFY(jni, (*chainObjectClass =
jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
if (!NSK_JVMTI_VERIFY(jvmti->SetTag(*chainObjectClass, CHAIN_CLASS_TAG))) { if (!NSK_JVMTI_VERIFY(jvmti->SetTag(*chainObjectClass, CHAIN_CLASS_TAG))) {
@ -216,27 +213,26 @@ static int getAndTagClasses(jvmtiEnv* jvmti,
CHAIN_OBJECT_CLASS_NAME); CHAIN_OBJECT_CLASS_NAME);
fflush(0); fflush(0);
return NSK_TRUE; return true;
} /* getAndTagClasses */ } /* getAndTagClasses */
/** Obtain chain of tested objects and tag them recursively. */ /** Obtain chain of tested objects and tag them recursively. */
static int getFieldsAndObjects(jvmtiEnv* jvmti, static bool getFieldsAndObjects(jvmtiEnv* jvmti,
JNIEnv* jni, JNIEnv* jni,
jclass debugeeClass, jclass debugeeClass,
jclass rootObjectClass, jclass rootObjectClass,
jclass chainObjectClass, jclass chainObjectClass,
jobject* rootObjectPtr, jobject* rootObjectPtr,
jfieldID* reachableChainField, jfieldID* reachableChainField,
jfieldID* unreachableChainField, jfieldID* unreachableChainField,
jfieldID* nextField) jfieldID* nextField) {
{
jfieldID rootObjectField = NULL; jfieldID rootObjectField = NULL;
if (!NSK_JNI_VERIFY(jni, (rootObjectField = if (!NSK_JNI_VERIFY(jni, (rootObjectField =
jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
printf("\nFound fieldID: 0x%p - \'%s\' static field in debugee class\n", printf("\nFound fieldID: 0x%p - \'%s\' static field in debugee class\n",
(void*) rootObjectField, OBJECT_FIELD_NAME); (void*) rootObjectField, OBJECT_FIELD_NAME);
@ -245,7 +241,7 @@ static int getFieldsAndObjects(jvmtiEnv* jvmti,
if (!NSK_JNI_VERIFY(jni, (*reachableChainField = if (!NSK_JNI_VERIFY(jni, (*reachableChainField =
jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
printf("\nFound fieldID: 0x%p - \'%s\' field in root object class\n", printf("\nFound fieldID: 0x%p - \'%s\' field in root object class\n",
(void*) reachableChainField, REACHABLE_CHAIN_FIELD_NAME); (void*) reachableChainField, REACHABLE_CHAIN_FIELD_NAME);
@ -254,7 +250,7 @@ static int getFieldsAndObjects(jvmtiEnv* jvmti,
if (!NSK_JNI_VERIFY(jni, (*unreachableChainField = if (!NSK_JNI_VERIFY(jni, (*unreachableChainField =
jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
printf("\nFound fieldID: 0x%p - \'%s\' field in root object class\n", printf("\nFound fieldID: 0x%p - \'%s\' field in root object class\n",
@ -264,7 +260,7 @@ static int getFieldsAndObjects(jvmtiEnv* jvmti,
if (!NSK_JNI_VERIFY(jni, (*nextField = if (!NSK_JNI_VERIFY(jni, (*nextField =
jni->GetFieldID(chainObjectClass, NEXT_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { jni->GetFieldID(chainObjectClass, NEXT_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
printf("\nFound fieldID: 0x%p - \'%s\' field in chain object class\n", printf("\nFound fieldID: 0x%p - \'%s\' field in chain object class\n",
(void*) nextField, NEXT_FIELD_NAME); (void*) nextField, NEXT_FIELD_NAME);
@ -273,24 +269,24 @@ static int getFieldsAndObjects(jvmtiEnv* jvmti,
if (!NSK_JNI_VERIFY(jni, (*rootObjectPtr = if (!NSK_JNI_VERIFY(jni, (*rootObjectPtr =
jni->GetStaticObjectField(debugeeClass, rootObjectField)) != NULL)) { jni->GetStaticObjectField(debugeeClass, rootObjectField)) != NULL)) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
printf("\nFound root object: 0x%p\n", (void*) *rootObjectPtr); printf("\nFound root object: 0x%p\n", (void*) *rootObjectPtr);
fflush(0); fflush(0);
if (!NSK_JNI_VERIFY(jni, (*rootObjectPtr = jni->NewGlobalRef(*rootObjectPtr)) != NULL)) { if (!NSK_JNI_VERIFY(jni, (*rootObjectPtr = jni->NewGlobalRef(*rootObjectPtr)) != NULL)) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
printf("Created root object global ref: 0x%p\n", (void*)*rootObjectPtr); printf("Created root object global ref: 0x%p\n", (void*)*rootObjectPtr);
fflush(0); fflush(0);
return NSK_TRUE; return true;
} /* getFieldsAndObjects */ } /* getFieldsAndObjects */
/** Obtain chain of tested objects and tag them recursively. */ /** Obtain chain of tested objects and tag them recursively. */
static int getAndTagChainObjects( static bool getAndTagChainObjects(
jvmtiEnv* jvmti, jvmtiEnv* jvmti,
JNIEnv* jni, JNIEnv* jni,
jobject currObj, jobject currObj,
@ -299,13 +295,12 @@ static int getAndTagChainObjects(
int count, int count,
ObjectDesc objectDescList[], ObjectDesc objectDescList[],
jlong tag, jlong tag,
int reachable) bool reachable) {
{
jobject nextObj = NULL; jobject nextObj = NULL;
jlong objTag = (reachable ? tag : -tag); jlong objTag = (reachable ? tag : -tag);
if (count <= 0) { if (count <= 0) {
return NSK_TRUE; return true;
} }
count--; count--;
@ -313,7 +308,7 @@ static int getAndTagChainObjects(
if (!NSK_JNI_VERIFY(jni, (nextObj = jni->GetObjectField(currObj, refField)) != NULL)) { if (!NSK_JNI_VERIFY(jni, (nextObj = jni->GetObjectField(currObj, refField)) != NULL)) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
objectDescList[count].tag = objTag; objectDescList[count].tag = objTag;
@ -338,12 +333,12 @@ static int getAndTagChainObjects(
tag, tag,
reachable) reachable)
) { ) {
return NSK_FALSE; return false;
} }
NSK_TRACE(jni->DeleteLocalRef(nextObj)); NSK_TRACE(jni->DeleteLocalRef(nextObj));
return NSK_TRUE; return true;
} /* getAndTagChainObjects */ } /* getAndTagChainObjects */
/** Obtain all tested objects from debugee class and tag them recursively. */ /** Obtain all tested objects from debugee class and tag them recursively. */
@ -363,31 +358,31 @@ static int getAndTagTestedObjects(
jfieldID unreachableChainField = NULL; jfieldID unreachableChainField = NULL;
jfieldID nextField = NULL; jfieldID nextField = NULL;
if (initObjectDescList(jvmti, if (!initObjectDescList(jvmti,
chainLength, chainLength,
objectsCount, objectsCount,
objectDescList) == NSK_FALSE) { objectDescList)) {
return NSK_FALSE; return false;
} }
if (getAndTagClasses(jvmti, if (!getAndTagClasses(jvmti,
jni, jni,
&debugeeClass, &debugeeClass,
&rootObjectClass, &rootObjectClass,
&chainObjectClass) == NSK_FALSE) { &chainObjectClass)) {
return NSK_FALSE; return false;
} }
if (getFieldsAndObjects(jvmti, if (!getFieldsAndObjects(jvmti,
jni, jni,
debugeeClass, debugeeClass,
rootObjectClass, rootObjectClass,
chainObjectClass, chainObjectClass,
rootObjectPtr, rootObjectPtr,
&reachableChainField, &reachableChainField,
&unreachableChainField, &unreachableChainField,
&nextField) == NSK_FALSE) { &nextField)) {
return NSK_FALSE; return false;
} }
printf("\nObtain and tag chain objects:\n"); printf("\nObtain and tag chain objects:\n");
@ -411,10 +406,10 @@ static int getAndTagTestedObjects(
chainLength, chainLength,
(*objectDescList) + 1, (*objectDescList) + 1,
CHAIN_OBJECT_TAG, CHAIN_OBJECT_TAG,
NSK_TRUE) /* reachable objects */ true) /* reachable objects */
) { ) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
printf(" unreachable objects chain: %d objects\n", chainLength); printf(" unreachable objects chain: %d objects\n", chainLength);
@ -426,22 +421,22 @@ static int getAndTagTestedObjects(
chainLength, chainLength,
(*objectDescList) + 1 + chainLength, (*objectDescList) + 1 + chainLength,
CHAIN_OBJECT_TAG, CHAIN_OBJECT_TAG,
NSK_FALSE) /* unreachable objects */ false) /* unreachable objects */
) { ) {
nsk_jvmti_setFailStatus(); nsk_jvmti_setFailStatus();
return NSK_FALSE; return false;
} }
return NSK_TRUE; return true;
} /* getAndTagTestedObjects */ } /* getAndTagTestedObjects */
/** Check if tagged objects were iterated. */ /** Check if tagged objects were iterated. */
static int checkTestedObjects(jvmtiEnv* jvmti, static bool checkTestedObjects(jvmtiEnv* jvmti,
JNIEnv* jni, JNIEnv* jni,
int chainLength, int chainLength,
ObjectDesc objectDescList[]) ObjectDesc objectDescList[])
{ {
int success = NSK_TRUE; bool success = true;
int i, idx; int i, idx;
printf("Following tagged objects were iterated:\n"); printf("Following tagged objects were iterated:\n");
@ -498,16 +493,16 @@ static int checkTestedObjects(jvmtiEnv* jvmti,
fflush(0); fflush(0);
} }
return NSK_TRUE; return true;
} /* checkTestedObjects */ } /* checkTestedObjects */
/** Release references to the tested objects and free allocated memory. */ /** Release references to the tested objects and free allocated memory. */
static int releaseTestedObjects(jvmtiEnv* jvmti, static void releaseTestedObjects(jvmtiEnv* jvmti,
JNIEnv* jni, JNIEnv* jni,
int chainLength, int chainLength,
ObjectDesc* objectDescList, ObjectDesc* objectDescList,
jobject rootObject) jobject rootObject)
{ {
if (rootObject != NULL) { if (rootObject != NULL) {
printf("Release object reference to root tested object: 0x%p\n", rootObject); printf("Release object reference to root tested object: 0x%p\n", rootObject);
@ -522,7 +517,6 @@ static int releaseTestedObjects(jvmtiEnv* jvmti,
} }
fflush(0); fflush(0);
return NSK_TRUE;
} /* releaseTestedObjects */ } /* releaseTestedObjects */
@ -784,10 +778,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
printf(">>> Clean used data\n"); printf(">>> Clean used data\n");
fflush(0); fflush(0);
if (!NSK_VERIFY(releaseTestedObjects(jvmti, jni, chainLength, releaseTestedObjects(jvmti, jni, chainLength, objectDescList, rootObject);
objectDescList, rootObject))) {
return;
}
printf(">>> Let debugee to finish\n"); printf(">>> Let debugee to finish\n");
fflush(0); fflush(0);