diff --git a/test/hotspot/jtreg/runtime/Thread/libAsyncExceptionOnMonitorEnter.cpp b/test/hotspot/jtreg/runtime/Thread/libAsyncExceptionOnMonitorEnter.cpp index 1b5833d8042..0249235bc18 100644 --- a/test/hotspot/jtreg/runtime/Thread/libAsyncExceptionOnMonitorEnter.cpp +++ b/test/hotspot/jtreg/runtime/Thread/libAsyncExceptionOnMonitorEnter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ extern "C" { -static jvmtiEnv* jvmti = NULL; +static jvmtiEnv* jvmti = nullptr; static jrawMonitorID monitor; JNIEXPORT jint JNICALL diff --git a/test/hotspot/jtreg/runtime/Thread/libStopAtExit.cpp b/test/hotspot/jtreg/runtime/Thread/libStopAtExit.cpp index 1204915050b..8432912876b 100644 --- a/test/hotspot/jtreg/runtime/Thread/libStopAtExit.cpp +++ b/test/hotspot/jtreg/runtime/Thread/libStopAtExit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ extern "C" { -static jvmtiEnv* jvmti = NULL; +static jvmtiEnv* jvmti = nullptr; #define LOG(...) \ do { \ diff --git a/test/hotspot/jtreg/runtime/Thread/libSuspendAtExit.cpp b/test/hotspot/jtreg/runtime/Thread/libSuspendAtExit.cpp index 2a64e1a249f..b49cbf2c924 100644 --- a/test/hotspot/jtreg/runtime/Thread/libSuspendAtExit.cpp +++ b/test/hotspot/jtreg/runtime/Thread/libSuspendAtExit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ extern "C" { -static jvmtiEnv* jvmti = NULL; +static jvmtiEnv* jvmti = nullptr; #define LOG(...) \ do { \ diff --git a/test/hotspot/jtreg/runtime/clinit/libClassInitBarrier.cpp b/test/hotspot/jtreg/runtime/clinit/libClassInitBarrier.cpp index 521c51ce6af..dce5c1057a8 100644 --- a/test/hotspot/jtreg/runtime/clinit/libClassInitBarrier.cpp +++ b/test/hotspot/jtreg/runtime/clinit/libClassInitBarrier.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,38 +39,38 @@ static jfieldID test_A_f_id; extern "C" { JNIEXPORT jboolean JNICALL Java_ClassInitBarrier_init(JNIEnv* env, jclass cls) { jclass runnable = env->FindClass("java/lang/Runnable"); - if (runnable == NULL) return JNI_FALSE; + if (runnable == nullptr) return JNI_FALSE; methodId = env->GetMethodID(runnable, "run", "()V"); - if (methodId == NULL) return JNI_FALSE; + if (methodId == nullptr) return JNI_FALSE; return JNI_TRUE; } JNIEXPORT jboolean JNICALL Java_ClassInitBarrier_00024Test_00024A_init(JNIEnv* env, jclass cls, jclass arg1) { test_class_A = (jclass)env->NewGlobalRef(cls); - if (test_class_A == NULL) return JNI_FALSE; + if (test_class_A == nullptr) return JNI_FALSE; test_class_B = (jclass)env->NewGlobalRef(arg1); - if (test_class_B == NULL) return JNI_FALSE; + if (test_class_B == nullptr) return JNI_FALSE; test_staticM_id = env->GetStaticMethodID(test_class_A, "staticM", "(Ljava/lang/Runnable;)V"); - if (test_staticM_id == NULL) return JNI_FALSE; + if (test_staticM_id == nullptr) return JNI_FALSE; test_staticS_id = env->GetStaticMethodID(test_class_A, "staticS", "(Ljava/lang/Runnable;)V"); - if (test_staticS_id == NULL) return JNI_FALSE; + if (test_staticS_id == nullptr) return JNI_FALSE; test_staticN_id = env->GetStaticMethodID(test_class_A, "staticN", "(Ljava/lang/Runnable;)V"); - if (test_staticN_id == NULL) return JNI_FALSE; + if (test_staticN_id == nullptr) return JNI_FALSE; test_A_m_id = env->GetMethodID(test_class_A, "m", "()V"); - if (test_A_m_id == NULL) return JNI_FALSE; + if (test_A_m_id == nullptr) return JNI_FALSE; test_staticF_id = env->GetStaticFieldID(test_class_A, "staticF", "I"); - if (test_staticF_id == NULL) return JNI_FALSE; + if (test_staticF_id == nullptr) return JNI_FALSE; test_A_f_id = env->GetFieldID(test_class_A, "f", "I"); - if (test_A_f_id == NULL) return JNI_FALSE; + if (test_A_f_id == nullptr) return JNI_FALSE; return JNI_TRUE; } @@ -105,11 +105,11 @@ extern "C" { JNIEXPORT jobject JNICALL Java_ClassInitBarrier_00024Test_testNewInstanceAJNI(JNIEnv* env, jclass cls, jobject action) { jobject obj = env->AllocObject(test_class_A); // A obj = new A(); if (env->ExceptionOccurred()) { - return NULL; - } else if (obj == NULL) { + return nullptr; + } else if (obj == nullptr) { jclass errorClass = env->FindClass("java/lang/AssertionError"); int ret = env->ThrowNew(errorClass, "JNI: AllocObject: allocation failed, but no exception thrown"); - return NULL; + return nullptr; } env->CallVoidMethod(action, methodId); // action.run(); return obj; @@ -118,11 +118,11 @@ extern "C" { JNIEXPORT jobject JNICALL Java_ClassInitBarrier_00024Test_testNewInstanceBJNI(JNIEnv* env, jclass cls, jobject action) { jobject obj = env->AllocObject(test_class_B); // B obj = new B(); if (env->ExceptionOccurred()) { - return NULL; - } else if (obj == NULL) { + return nullptr; + } else if (obj == nullptr) { jclass errorClass = env->FindClass("java/lang/AssertionError"); int ret = env->ThrowNew(errorClass, "JNI: AllocObject: allocation failed, but no exception thrown"); - return NULL; + return nullptr; } env->CallVoidMethod(action, methodId); // action.run(); return obj; diff --git a/test/hotspot/jtreg/serviceability/AsyncGetCallTrace/libAsyncGetCallTraceTest.cpp b/test/hotspot/jtreg/serviceability/AsyncGetCallTrace/libAsyncGetCallTraceTest.cpp index e8886f4bb67..ccdaf985d57 100644 --- a/test/hotspot/jtreg/serviceability/AsyncGetCallTrace/libAsyncGetCallTraceTest.cpp +++ b/test/hotspot/jtreg/serviceability/AsyncGetCallTrace/libAsyncGetCallTraceTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019, Google and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -35,7 +35,7 @@ template class JvmtiDeallocator { public: JvmtiDeallocator() { - elem_ = NULL; + elem_ = nullptr; } ~JvmtiDeallocator() { @@ -100,7 +100,7 @@ extern "C" { static jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { fprintf(stderr, "Error: wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -129,13 +129,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr); if (err != JVMTI_ERROR_NONE) { fprintf(stderr, "AgentInitialize: Error in SetEventNotificationMode for CLASS_LOAD: %d\n", err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, nullptr); if (err != JVMTI_ERROR_NONE) { fprintf(stderr, "AgentInitialize: Error in SetEventNotificationMode for CLASS_PREPARE: %d\n", @@ -143,7 +143,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { fprintf( stderr, "AgentInitialize: Error in SetEventNotificationMode for VM_INIT: %d\n", @@ -194,12 +194,12 @@ Java_MyPackage_ASGCTBaseTest_checkAsyncGetCallTraceCall(JNIEnv* env, jclass cls) trace.env_id = env; trace.num_frames = 0; - if (agct == NULL) { + if (agct == nullptr) { fprintf(stderr, "AsyncGetCallTrace not found.\n"); return false; } - agct(&trace, MAX_DEPTH, NULL); + agct(&trace, MAX_DEPTH, nullptr); // For now, just check that the first frame is (-3, checkAsyncGetCallTraceCall). if (trace.num_frames <= 0) { @@ -214,19 +214,19 @@ Java_MyPackage_ASGCTBaseTest_checkAsyncGetCallTraceCall(JNIEnv* env, jclass cls) } JvmtiDeallocator name; - if (trace.frames[0].method_id == NULL) { - fprintf(stderr, "First frame method_id is NULL\n"); + if (trace.frames[0].method_id == nullptr) { + fprintf(stderr, "First frame method_id is null\n"); return false; } - jvmtiError err = jvmti->GetMethodName(trace.frames[0].method_id, name.get_addr(), NULL, NULL); + jvmtiError err = jvmti->GetMethodName(trace.frames[0].method_id, name.get_addr(), nullptr, nullptr); if (err != JVMTI_ERROR_NONE) { fprintf(stderr, "checkAsyncGetCallTrace: Error in GetMethodName: %d\n", err); return false; } - if (name.get() == NULL) { - fprintf(stderr, "Name is NULL\n"); + if (name.get() == nullptr) { + fprintf(stderr, "Name is null\n"); return false; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/CompiledMethodLoad/libCompiledZombie.cpp b/test/hotspot/jtreg/serviceability/jvmti/CompiledMethodLoad/libCompiledZombie.cpp index fbff3c847f1..3bf2988dd0f 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/CompiledMethodLoad/libCompiledZombie.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/CompiledMethodLoad/libCompiledZombie.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,7 +45,7 @@ void JNICALL CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method, // Continuously generate CompiledMethodLoad events for all currently compiled methods void JNICALL GenerateEventsThread(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr); int count = 0; while (true) { @@ -64,7 +64,7 @@ void JNICALL VMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { jmethodID thread_constructor = jni->GetMethodID(thread_class, "", "()V"); jthread agent_thread = jni->NewObject(thread_class, thread_constructor); - jvmti->RunAgentThread(agent_thread, GenerateEventsThread, NULL, JVMTI_THREAD_NORM_PRIORITY); + jvmti->RunAgentThread(agent_thread, GenerateEventsThread, nullptr, JVMTI_THREAD_NORM_PRIORITY); } JNIEXPORT @@ -83,7 +83,7 @@ jint JNICALL Agent_OnLoad(JavaVM* vm, char* options, void* reserved) { callbacks.VMInit = VMInit; callbacks.CompiledMethodLoad = CompiledMethodLoad; jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); return 0; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/DynamicCodeGenerated/libDynamicCodeGenerated.cpp b/test/hotspot/jtreg/serviceability/jvmti/DynamicCodeGenerated/libDynamicCodeGenerated.cpp index 6ede1fe2eb9..f13ba00aa41 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/DynamicCodeGenerated/libDynamicCodeGenerated.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/DynamicCodeGenerated/libDynamicCodeGenerated.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include "jvmti_common.h" -static jvmtiEnv* jvmti = NULL; +static jvmtiEnv* jvmti = nullptr; #ifdef __cplusplus extern "C" { @@ -34,8 +34,8 @@ extern "C" { JNIEXPORT void JNICALL Java_DynamicCodeGeneratedTest_changeEventNotificationMode(JNIEnv* jni, jclass cls) { while (true) { - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL); - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, nullptr); + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, nullptr); } } diff --git a/test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents1.cpp b/test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents1.cpp index 846ba45d274..fa60c07f8db 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents1.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,9 +28,9 @@ extern "C" { #define AGENT_NAME "agent1" -static JavaVM *java_vm = NULL; -static jthread exp_thread = NULL; -static jvmtiEnv *jvmti1 = NULL; +static JavaVM *java_vm = nullptr; +static jthread exp_thread = nullptr; +static jvmtiEnv *jvmti1 = nullptr; static jint agent1_event_count = 0; static bool fail_status = false; @@ -48,10 +48,10 @@ CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method, jint code_size, const void* code_addr, jint map_length, const jvmtiAddrLocationMap* map, const void* compile_info) { - JNIEnv* env = NULL; - jthread thread = NULL; - char* name = NULL; - char* sign = NULL; + JNIEnv* env = nullptr; + jthread thread = nullptr; + char* name = nullptr; + char* sign = nullptr; jvmtiError err; // Posted on JavaThread's, so it is legal to obtain JNIEnv* @@ -67,7 +67,7 @@ CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method, } agent1_event_count++; - err = jvmti->GetMethodName(method, &name, &sign, NULL); + err = jvmti->GetMethodName(method, &name, &sign, nullptr); check_jvmti_status(env, err, "CompiledMethodLoad: Error in JVMTI GetMethodName"); printf("%s: CompiledMethodLoad: %s%s\n", AGENT_NAME, name, sign); @@ -111,7 +111,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_MyPackage_GenerateEventsTest_agent1GenerateEvents(JNIEnv *env, jclass cls) { - jthread thread = NULL; + jthread thread = nullptr; jvmtiError err; err = jvmti1->GetCurrentThread(&thread); @@ -119,13 +119,13 @@ Java_MyPackage_GenerateEventsTest_agent1GenerateEvents(JNIEnv *env, jclass cls) exp_thread = (jthread)env->NewGlobalRef(thread); - err = jvmti1->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL); + err = jvmti1->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr); check_jvmti_status(env, err, "generateEvents1: Error in JVMTI SetEventNotificationMode: JVMTI_ENABLE"); err = jvmti1->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD); check_jvmti_status(env, err, "generateEvents1: Error in JVMTI GenerateEvents"); - err = jvmti1->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL); + err = jvmti1->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr); check_jvmti_status(env, err, "generateEvents1: Error in JVMTI SetEventNotificationMode: JVMTI_DISABLE"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents2.cpp b/test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents2.cpp index 7cec9624cf3..7af061196a1 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents2.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,9 +28,9 @@ extern "C" { #define AGENT_NAME "agent2" -static JavaVM *java_vm = NULL; -static jthread exp_thread = NULL; -static jvmtiEnv *jvmti2 = NULL; +static JavaVM *java_vm = nullptr; +static jthread exp_thread = nullptr; +static jvmtiEnv *jvmti2 = nullptr; static jint agent2_event_count = 0; static bool fail_status = false; @@ -48,10 +48,10 @@ CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method, jint code_size, const void* code_addr, jint map_length, const jvmtiAddrLocationMap* map, const void* compile_info) { - JNIEnv* env = NULL; - jthread thread = NULL; - char* name = NULL; - char* sign = NULL; + JNIEnv* env = nullptr; + jthread thread = nullptr; + char* name = nullptr; + char* sign = nullptr; jvmtiError err; // Posted on JavaThread's, so it is legal to obtain JNIEnv* @@ -67,7 +67,7 @@ CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method, } agent2_event_count++; - err = jvmti->GetMethodName(method, &name, &sign, NULL); + err = jvmti->GetMethodName(method, &name, &sign, nullptr); check_jvmti_status(env, err, "CompiledMethodLoad: Error in JVMTI GetMethodName"); printf("%s: CompiledMethodLoad: %s%s\n", AGENT_NAME, name, sign); @@ -113,7 +113,7 @@ Java_MyPackage_GenerateEventsTest_agent2SetThread(JNIEnv *env, jclass cls, jthre exp_thread = (jthread)env->NewGlobalRef(thread); - err = jvmti2->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL); + err = jvmti2->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr); check_jvmti_status(env, err, "setThread2: Error in JVMTI SetEventNotificationMode: JVMTI_ENABLE"); } @@ -121,7 +121,7 @@ JNIEXPORT jboolean JNICALL Java_MyPackage_GenerateEventsTest_agent2FailStatus(JNIEnv *env, jclass cls) { jvmtiError err; - err = jvmti2->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL); + err = jvmti2->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr); check_jvmti_status(env, err, "check2: Error in JVMTI SetEventNotificationMode: JVMTI_DISABLE"); printf("\n"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetClassFields/FilteredFields/libFilteredFieldsTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/GetClassFields/FilteredFields/libFilteredFieldsTest.cpp index 521242a1c29..24c36444ac2 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/GetClassFields/FilteredFields/libFilteredFieldsTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/GetClassFields/FilteredFields/libFilteredFieldsTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,12 +28,12 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); fflush(0); return JNI_ERR; @@ -51,7 +51,7 @@ JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *jvm, char *options, void *reserved JNIEXPORT jint JNICALL Java_FilteredFieldsTest_getJVMTIFieldCount(JNIEnv *env, jclass cls, jclass clazz) { - if (jvmti == NULL) { + if (jvmti == nullptr) { env->FatalError("JVMTI agent was not properly loaded"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/libOverpassMethods.cpp b/test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/libOverpassMethods.cpp index 17025c1b9aa..414c3149298 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/libOverpassMethods.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/libOverpassMethods.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ extern "C" { #define ACC_STATIC 0x0008 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) { @@ -41,7 +41,7 @@ jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) { vm->GetEnv((void **)&jvmti, JVMTI_VERSION_11); - if (options != NULL && strcmp(options, "maintain_original_method_order") == 0) { + if (options != nullptr && strcmp(options, "maintain_original_method_order") == 0) { printf("Enabled capability: maintain_original_method_order\n"); jvmtiCapabilities caps; memset(&caps, 0, sizeof(caps)); @@ -58,22 +58,22 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) { JNIEXPORT jobjectArray JNICALL Java_OverpassMethods_getJVMTIDeclaredMethods(JNIEnv *env, jclass static_klass, jclass klass) { jint method_count = 0; - jmethodID* methods = NULL; + jmethodID* methods = nullptr; jvmtiError err = jvmti->GetClassMethods(klass, &method_count, &methods); if (err != JVMTI_ERROR_NONE) { printf("GetClassMethods failed with error: %d\n", err); - return NULL; + return nullptr; } jclass method_cls = env->FindClass("java/lang/reflect/Method"); - if (method_cls == NULL) { + if (method_cls == nullptr) { printf("FindClass (Method) failed\n"); - return NULL; + return nullptr; } - jobjectArray array = env->NewObjectArray(method_count, method_cls, NULL); - if (array == NULL) { + jobjectArray array = env->NewObjectArray(method_count, method_cls, nullptr); + if (array == nullptr) { printf("NewObjectArray failed\n"); - return NULL; + return nullptr; } for (int i = 0; i < method_count; i++) { @@ -81,13 +81,13 @@ JNIEXPORT jobjectArray JNICALL Java_OverpassMethods_getJVMTIDeclaredMethods(JNIE err = jvmti->GetMethodModifiers(methods[i], &modifiers); if (err != JVMTI_ERROR_NONE) { printf("GetMethodModifiers failed with error: %d\n", err); - return NULL; + return nullptr; } jobject m = env->ToReflectedMethod(klass, methods[i], (modifiers & ACC_STATIC) == ACC_STATIC); - if (array == NULL) { + if (array == nullptr) { printf("ToReflectedMethod failed\n"); - return NULL; + return nullptr; } env->SetObjectArrayElement(array, i, m); diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetLocalVars.cpp b/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetLocalVars.cpp index 08a61427dde..e0c3e0664d0 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetLocalVars.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetLocalVars.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define TranslateError(err) "JVMTI error" static jint result = STATUS_PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; #define DECL_TEST_FUNC(type, Type) \ static void \ @@ -167,7 +167,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { static jvmtiCapabilities caps; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -223,16 +223,16 @@ Java_GetLocalVars_testLocals(JNIEnv *env, jclass cls, jobject thread) { static const int IntSlot = 4; static const int InvalidSlot = 5; - jmethodID mid = NULL; + jmethodID mid = nullptr; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; } mid = env->GetStaticMethodID(cls, METHOD_NAME, METHOD_SIGN); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for %s%s\n", METHOD_NAME, METHOD_SIGN); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetSetLocalUnsuspended.cpp b/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetSetLocalUnsuspended.cpp index 3cb048bda98..9ae5005ee6c 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetSetLocalUnsuspended.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetSetLocalUnsuspended.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ enum Slots { SlotDouble = 6, }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static void check_jvmti_error_not_suspended(JNIEnv* jni, const char* func_name, jvmtiError err) { @@ -55,7 +55,7 @@ test_GetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { jvmtiError err; const int depth = 0; - jobject msg = NULL; + jobject msg = nullptr; jint ii = 0; jlong ll = 0L; jfloat ff = 0.0; @@ -101,7 +101,7 @@ test_SetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { jvmtiError err; const int depth = 0; - const jobject msg = NULL; + const jobject msg = nullptr; const jint ii = 0; const jlong ll = 0L; const jfloat ff = 0.0; @@ -163,7 +163,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_GetSetLocalUnsuspended_testUnsuspendedThread(JNIEnv *jni, jclass klass, jthread thread) { char* tname = get_thread_name(jvmti, jni, thread); - jmethodID method = NULL; + jmethodID method = nullptr; jlocation location = 0; LOG("\ntestUnsuspendedThread: started for thread: %s\n", tname); diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetThreadListStackTraces/libOneGetThreadListStackTraces.cpp b/test/hotspot/jtreg/serviceability/jvmti/GetThreadListStackTraces/libOneGetThreadListStackTraces.cpp index 2c5ec19e93c..56db0b74797 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/GetThreadListStackTraces/libOneGetThreadListStackTraces.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/GetThreadListStackTraces/libOneGetThreadListStackTraces.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, NTT DATA. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -35,7 +35,7 @@ extern "C" { #endif -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return jvm->GetEnv(reinterpret_cast(&jvmti), JVMTI_VERSION_11); @@ -103,7 +103,7 @@ JNIEXPORT void JNICALL Java_OneGetThreadListStackTraces_checkCallStacks(JNIEnv * /* Find jvmtiStackInfo for `thread` (in arguments) */ jboolean is_same; - target_info = NULL; + target_info = nullptr; for (jint i = 0; i < num_threads; i++) { is_same = env->IsSameObject(stack_info[i].thread, thread); if (env->ExceptionOccurred()) { @@ -115,7 +115,7 @@ JNIEXPORT void JNICALL Java_OneGetThreadListStackTraces_checkCallStacks(JNIEnv * break; } } - if (target_info == NULL) { + if (target_info == nullptr) { env->FatalError("Target thread not found"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/Heap/libIterateHeapWithEscapeAnalysisEnabled.cpp b/test/hotspot/jtreg/serviceability/jvmti/Heap/libIterateHeapWithEscapeAnalysisEnabled.cpp index e090bf29709..9cddba2e89a 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/Heap/libIterateHeapWithEscapeAnalysisEnabled.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/Heap/libIterateHeapWithEscapeAnalysisEnabled.cpp @@ -64,7 +64,7 @@ JNI_OnLoad(JavaVM *jvm, void *reserved) { JNIEnv *env; res = jvm->GetEnv((void **) &env, JNI_VERSION_9); - if (res != JNI_OK || env == NULL) { + if (res != JNI_OK || env == nullptr) { fprintf(stderr, "Error: GetEnv call failed(%d)!\n", res); return JNI_ERR; } @@ -79,7 +79,7 @@ Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printf("Agent_OnLoad started\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { fprintf(stderr, "Error: wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -257,9 +257,9 @@ Java_IterateHeapWithEscapeAnalysisEnabled_countAndTagInstancesOfClass(JNIEnv *en if (env->IsSameObject(method, method_IterateOverReachableObjects)) { method_found = JNI_TRUE; - err = jvmti->IterateOverReachableObjects(NULL /*jvmtiHeapRootCallback*/, + err = jvmti->IterateOverReachableObjects(nullptr /*jvmtiHeapRootCallback*/, __stackReferenceCallback, - NULL /* jvmtiObjectReferenceCallback */, + nullptr /* jvmtiObjectReferenceCallback */, &data); if (err != JVMTI_ERROR_NONE) { ShowErrorMessage(jvmti, err, @@ -294,8 +294,8 @@ Java_IterateHeapWithEscapeAnalysisEnabled_countAndTagInstancesOfClass(JNIEnv *en method_found = JNI_TRUE; callbacks.heap_reference_callback = __jvmtiHeapReferenceCallback; err = jvmti->FollowReferences(0 /* filter nothing */, - NULL /* no class filter */, - NULL /* no initial object, follow roots */, + nullptr /* no class filter */, + nullptr /* no initial object, follow roots */, &callbacks, &data); if (err != JVMTI_ERROR_NONE) { @@ -308,7 +308,7 @@ Java_IterateHeapWithEscapeAnalysisEnabled_countAndTagInstancesOfClass(JNIEnv *en method_found = JNI_TRUE; callbacks.heap_iteration_callback = __jvmtiHeapIterationCallback; err = jvmti->IterateThroughHeap(0 /* filter nothing */, - NULL /* no class filter */, + nullptr /* no class filter */, &callbacks, &data); if (err != JVMTI_ERROR_NONE) { diff --git a/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/libHeapMonitorTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/libHeapMonitorTest.cpp index f672a143144..035aaef827e 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/libHeapMonitorTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/libHeapMonitorTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, Google and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -34,8 +34,8 @@ extern "C" { #define FALSE 0 #define PRINT_OUT 0 -static jvmtiEnv *jvmti = NULL; -static jvmtiEnv *second_jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; +static jvmtiEnv *second_jvmti = nullptr; typedef struct _ObjectTrace{ jweak object; @@ -138,7 +138,7 @@ static void print_out_frames(JNIEnv* env, ObjectTrace* trace) { // Get basic information out of the trace. jlocation bci = frames[i].location; jmethodID methodid = frames[i].method; - char *name = NULL, *signature = NULL, *file_name = NULL; + char *name = nullptr, *signature = nullptr, *file_name = nullptr; jclass declaring_class; int line_number; jvmtiError err; @@ -166,18 +166,18 @@ static void print_out_frames(JNIEnv* env, ObjectTrace* trace) { continue; } - // Compare now, none should be NULL. - if (name == NULL) { + // Compare now, none should be null. + if (name == nullptr) { fprintf(stderr, "\tUnknown name\n"); continue; } - if (file_name == NULL) { + if (file_name == nullptr) { fprintf(stderr, "\tUnknown file\n"); continue; } - if (signature == NULL) { + if (signature == nullptr) { fprintf(stderr, "\tUnknown signature\n"); continue; } @@ -204,7 +204,7 @@ static jboolean check_sample_content(JNIEnv* env, // Get basic information out of the trace. jlocation bci = frames[i].location; jmethodID methodid = frames[i].method; - char *name = NULL, *signature = NULL, *file_name = NULL; + char *name = nullptr, *signature = nullptr, *file_name = nullptr; jclass declaring_class; int line_number; jboolean differ; @@ -227,16 +227,16 @@ static jboolean check_sample_content(JNIEnv* env, return FALSE; } - // Compare now, none should be NULL. - if (name == NULL) { + // Compare now, none should be null. + if (name == nullptr) { return FALSE; } - if (file_name == NULL) { + if (file_name == nullptr) { return FALSE; } - if (signature == NULL) { + if (signature == nullptr) { return FALSE; } @@ -267,14 +267,14 @@ static int fill_native_frames(JNIEnv* env, jobjectArray frames, ExpectedContentFrame* native_frames, size_t size) { size_t i; for (i = 0; i < size; i++) { - jclass frame_class = NULL; + jclass frame_class = nullptr; jfieldID line_number_field_id = 0; int line_number = 0; jfieldID string_id = 0; - jstring string_object = NULL; - const char* method = NULL; - const char* file_name = NULL; - const char* signature = NULL; + jstring string_object = nullptr; + const char* method = nullptr; + const char* file_name = nullptr; + const char* signature = nullptr; jobject obj = env->GetObjectArrayElement(frames, (jsize) i); @@ -410,7 +410,7 @@ static void event_storage_add_garbage_collected_object(EventStorage* storage, ObjectTrace* object) { int idx = storage->garbage_history_index; ObjectTrace* old_object = storage->garbage_collected_objects[idx]; - if (old_object != NULL) { + if (old_object != nullptr) { free(old_object->frames); free(storage->garbage_collected_objects[idx]); } @@ -496,7 +496,7 @@ static jboolean event_storage_garbage_contains(JNIEnv* env, for (i = 0; i < storage->garbage_history_size; i++) { ObjectTrace* trace = storage->garbage_collected_objects[i]; - if (trace == NULL) { + if (trace == nullptr) { continue; } @@ -587,14 +587,14 @@ static void event_storage_compact(EventStorage* storage, JNIEnv* jni) { ObjectTrace* live_object = live_objects[i]; jweak object = live_object->object; - if (!jni->IsSameObject(object, NULL)) { + if (!jni->IsSameObject(object, nullptr)) { if (dest != i) { live_objects[dest] = live_object; dest++; } } else { jni->DeleteWeakGlobalRef(object); - live_object->object = NULL; + live_object->object = nullptr; event_storage_add_garbage_collected_object(storage, live_object); } @@ -607,7 +607,7 @@ static void event_storage_compact(EventStorage* storage, JNIEnv* jni) { static void event_storage_free_objects(ObjectTrace** array, int max) { int i; for (i = 0; i < max; i++) { - free(array[i]), array[i] = NULL; + free(array[i]), array[i] = nullptr; } } @@ -620,7 +620,7 @@ static void event_storage_reset(EventStorage* storage) { storage->live_object_additions = 0; storage->live_object_size = 0; storage->live_object_count = 0; - free(storage->live_objects), storage->live_objects = NULL; + free(storage->live_objects), storage->live_objects = nullptr; event_storage_free_objects(storage->garbage_collected_objects, storage->garbage_history_size); @@ -799,13 +799,13 @@ void JNICALL GarbageCollectionFinish(jvmtiEnv *jvmti_env) { static int enable_notifications() { if (check_error(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL), + JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr), "Set event notifications")) { return 1; } return check_error(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC, NULL), + JVMTI_ENABLE, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC, nullptr), "Set event notifications"); } @@ -816,14 +816,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiCapabilities caps; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { fprintf(stderr, "Error: wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } // Get second jvmti environment. res = jvm->GetEnv((void **) &second_jvmti, JVMTI_VERSION); - if (res != JNI_OK || second_jvmti == NULL) { + if (res != JNI_OK || second_jvmti == nullptr) { fprintf(stderr, "Error: wrong result of a valid second call to GetEnv!\n"); return JNI_ERR; } @@ -893,11 +893,11 @@ Java_MyPackage_HeapMonitor_enableSamplingEvents(JNIEnv* env, jclass cls) { JNIEXPORT void JNICALL Java_MyPackage_HeapMonitor_disableSamplingEvents(JNIEnv* env, jclass cls) { check_error(jvmti->SetEventNotificationMode( - JVMTI_DISABLE, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC, NULL), + JVMTI_DISABLE, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC, nullptr), "Set event notifications"); check_error(jvmti->SetEventNotificationMode( - JVMTI_DISABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL), + JVMTI_DISABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr), "Garbage Collection Finish"); } @@ -912,8 +912,8 @@ static ExpectedContentFrame *get_native_frames(JNIEnv* env, jclass cls, native_frames = reinterpret_cast (malloc(size * sizeof(*native_frames))); - if (native_frames == NULL) { - env->FatalError("Error in get_native_frames: malloc returned NULL\n"); + if (native_frames == nullptr) { + env->FatalError("Error in get_native_frames: malloc returned null\n"); } if (fill_native_frames(env, frames, native_frames, size) != 0) { @@ -934,7 +934,7 @@ Java_MyPackage_HeapMonitor_obtainedEvents(JNIEnv* env, jclass cls, result = event_storage_contains(env, &global_event_storage, native_frames, size, check_lines); - free(native_frames), native_frames = NULL; + free(native_frames), native_frames = nullptr; return result; } @@ -949,7 +949,7 @@ Java_MyPackage_HeapMonitor_garbageContains(JNIEnv* env, jclass cls, result = event_storage_garbage_contains(env, &global_event_storage, native_frames, size, check_lines); - free(native_frames), native_frames = NULL; + free(native_frames), native_frames = nullptr; return result; } @@ -964,7 +964,7 @@ Java_MyPackage_HeapMonitor_getSize(JNIEnv* env, jclass cls, result = event_storage_get_size(env, &global_event_storage, native_frames, size, check_lines); - free(native_frames), native_frames = NULL; + free(native_frames), native_frames = nullptr; return result; } @@ -1083,7 +1083,7 @@ Java_MyPackage_HeapMonitorTwoAgentsTest_enablingSamplingInSecondaryAgent( JNIEXPORT void JNICALL Java_MyPackage_HeapMonitor_enableVMEvents(JNIEnv* env, jclass cls) { check_error(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL), + JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, nullptr), "Set vm event notifications"); } @@ -1103,19 +1103,19 @@ static jobject allocate_object(JNIEnv* env) { jmethodID constructor; jobject result; - if (env->ExceptionOccurred() || cls == NULL) { + if (env->ExceptionOccurred() || cls == nullptr) { env->FatalError("Error in jni FindClass: Cannot find Object class\n"); } constructor = env->GetMethodID(cls, "", "()V"); - if (env->ExceptionOccurred() || constructor == NULL) { + if (env->ExceptionOccurred() || constructor == nullptr) { env->FatalError("Error in jni GetMethodID: Cannot find Object class constructor\n"); } // Call back constructor to allocate a new instance, with an int argument result = env->NewObject(cls, constructor); - if (env->ExceptionOccurred() || result == NULL) { + if (env->ExceptionOccurred() || result == nullptr) { env->FatalError("Error in jni NewObject: Cannot allocate an object\n"); } return result; @@ -1135,8 +1135,8 @@ void JNICALL RecursiveSampledObjectAlloc(jvmtiEnv *jvmti_env, // infinite recursion here. int i; for (i = 0; i < 1000; i++) { - if (allocate_object(jni_env) == NULL) { - jni_env->FatalError("allocate_object returned NULL\n"); + if (allocate_object(jni_env) == nullptr) { + jni_env->FatalError("allocate_object returned null\n"); } } diff --git a/test/hotspot/jtreg/serviceability/jvmti/HiddenClass/libHiddenClassSigTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/HiddenClass/libHiddenClassSigTest.cpp index 5d94a3879fe..ad9da9e5301 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/HiddenClass/libHiddenClassSigTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/HiddenClass/libHiddenClassSigTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ static const char* SIG_START = "LP/Q/HiddenClassSig"; static const size_t SIG_START_LEN = strlen(SIG_START); static const int ACC_INTERFACE = 0x0200; // Interface class modifiers bit -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint class_load_count = 0; static jint class_prep_count = 0; static bool failed = false; @@ -50,18 +50,18 @@ static bool failed = false; /* Return the jmethodID of j.l.Class.isHidden() method. */ static jmethodID is_hidden_mid(JNIEnv* jni) { - char* csig = NULL; + char* csig = nullptr; jint count = 0; - jmethodID *methods = NULL; + jmethodID *methods = nullptr; jclass clazz = jni->FindClass("java/lang/Class"); - if (clazz == NULL) { - jni->FatalError("is_hidden_mid: Error: FindClass returned NULL for java/lang/Class\n"); - return NULL; + if (clazz == nullptr) { + jni->FatalError("is_hidden_mid: Error: FindClass returned null for java/lang/Class\n"); + return nullptr; } // find the jmethodID of j.l.Class.isHidden() method jmethodID mid = jni->GetMethodID(clazz, "isHidden", "()Z"); - if (mid == NULL) { + if (mid == nullptr) { jni->FatalError("is_hidden_mid: Error in jni GetMethodID: Cannot find j.l.Class.isHidden method\n"); } return mid; @@ -70,9 +70,9 @@ is_hidden_mid(JNIEnv* jni) { /* Return true if the klass is hidden. */ static bool is_hidden(JNIEnv* jni, jclass klass) { - static jmethodID is_hid_mid = NULL; + static jmethodID is_hid_mid = nullptr; - if (is_hid_mid == NULL) { + if (is_hid_mid == nullptr) { is_hid_mid = is_hidden_mid(jni); } // invoke j.l.Class.isHidden() method @@ -88,8 +88,8 @@ is_hidden(JNIEnv* jni, jclass klass) { static void check_class_signature(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, bool is_hidden, const char* exp_sig) { jint class_modifiers = 0; - char* sig = NULL; - char* gsig = NULL; + char* sig = nullptr; + char* gsig = nullptr; jvmtiError err; // get class signature @@ -103,8 +103,8 @@ check_class_signature(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, bool is_hidden LOG2("check_class_signature: FAIL: Hidden class signature %s does not match expected: %s\n", sig, exp_sig); failed = true; } - if (is_hidden && gsig == NULL) { - LOG0("check_class_signature: FAIL: unexpected NULL generic signature for hidden class\n"); + if (is_hidden && gsig == nullptr) { + LOG0("check_class_signature: FAIL: unexpected null generic signature for hidden class\n"); failed = true; } } @@ -152,8 +152,8 @@ check_hidden_class_flags(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) { static void check_hidden_class_loader(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) { jint count = 0; - jobject loader = NULL; - jclass* loader_classes = NULL; + jobject loader = nullptr; + jclass* loader_classes = nullptr; jboolean found = false; jvmtiError err; @@ -166,7 +166,7 @@ check_hidden_class_loader(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) { CHECK_JVMTI_ERROR(jni, err, "check_hidden_class_loader: Error in JVMTI GetClassLoaderClasses"); for (int idx = 0; idx < count; idx++) { - char* sig = NULL; + char* sig = nullptr; jclass kls = loader_classes[idx]; // GetClassLoaderClasses should not return any hidden classes @@ -174,7 +174,7 @@ check_hidden_class_loader(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) { continue; } // get class signature - err = jvmti->GetClassSignature(kls, &sig, NULL); + err = jvmti->GetClassSignature(kls, &sig, nullptr); CHECK_JVMTI_ERROR(jni, err, "check_hidden_class_loader: Error in JVMTI GetClassSignature"); LOG1("check_hidden_class_loader: FAIL: JVMTI GetClassLoaderClasses returned hidden class: %s\n", sig); @@ -187,9 +187,9 @@ check_hidden_class_loader(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) { /* Test the hidden class implements expected interface. */ static void check_hidden_class_impl_interf(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) { - char* sig = NULL; + char* sig = nullptr; jint count = 0; - jclass* interfaces = NULL; + jclass* interfaces = nullptr; jvmtiError err; // check that hidden class implements just one interface @@ -201,7 +201,7 @@ check_hidden_class_impl_interf(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) { return; } // get interface signature - err = jvmti->GetClassSignature(interfaces[0], &sig, NULL); + err = jvmti->GetClassSignature(interfaces[0], &sig, nullptr); CHECK_JVMTI_ERROR(jni, err, "check_hidden_class_impl_interf: Error in JVMTI GetClassSignature for implemented interface"); // check the interface signature is matching the expected @@ -215,7 +215,7 @@ check_hidden_class_impl_interf(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) { /* Test hidden class. */ static void check_hidden_class(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, const char* exp_sig) { - char* source_file_name = NULL; + char* source_file_name = nullptr; LOG1("\n### Native agent: check_hidden_class started: class: %s\n", exp_sig); @@ -237,7 +237,7 @@ check_hidden_class(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, const char* exp_s /* Test hidden class array. */ static void check_hidden_class_array(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass_array, const char* exp_sig) { - char* source_file_name = NULL; + char* source_file_name = nullptr; LOG1("\n### Native agent: check_hidden_class_array started: array: %s\n", exp_sig); @@ -250,8 +250,8 @@ check_hidden_class_array(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass_array, const /* Process a CLASS_LOAD or aClassPrepare event. */ static void process_class_event(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, jint* event_count_ptr, const char* event_name) { - char* sig = NULL; - char* gsig = NULL; + char* sig = nullptr; + char* gsig = nullptr; jvmtiError err; // get class signature @@ -263,8 +263,8 @@ static void process_class_event(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, strncmp(sig, SIG_START, SIG_START_LEN) == 0 && is_hidden(jni, klass)) { (*event_count_ptr)++; - if (gsig == NULL) { - LOG1("%s event: FAIL: GetClassSignature returned NULL generic signature for hidden class\n", event_name); + if (gsig == nullptr) { + LOG1("%s event: FAIL: GetClassSignature returned null generic signature for hidden class\n", event_name); failed = true; } LOG2("%s event: hidden class with sig: %s\n", event_name, sig); @@ -293,11 +293,11 @@ VMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { fflush(stdout); // enable ClassLoad event notification mode - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr); CHECK_JVMTI_ERROR(jni, err, "VMInit event: Error in enabling ClassLoad events notification"); // enable ClassPrepare event notification mode - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, nullptr); CHECK_JVMTI_ERROR(jni, err, "VMInit event: Error in enabling ClassPrepare events notification"); } @@ -327,7 +327,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { } // enable VM_INIT event notification mode - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG1("Agent_OnLoad: Error in JVMTI SetEventNotificationMode: %d\n", err); failed = true; @@ -341,10 +341,10 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { /* Native method: checkHiddenClass(). */ JNIEXPORT void JNICALL Java_P_Q_HiddenClassSigTest_checkHiddenClass(JNIEnv *jni, jclass klass, jclass hidden_klass, jstring exp_sig_str) { - const char* exp_sig = jni->GetStringUTFChars(exp_sig_str, NULL); + const char* exp_sig = jni->GetStringUTFChars(exp_sig_str, nullptr); - if (exp_sig == NULL) { - jni->FatalError("check_hidden_class: Error: JNI GetStringChars returned NULL for jstring\n"); + if (exp_sig == nullptr) { + jni->FatalError("check_hidden_class: Error: JNI GetStringChars returned null for jstring\n"); return; } check_hidden_class(jvmti, jni, hidden_klass, exp_sig); @@ -355,10 +355,10 @@ Java_P_Q_HiddenClassSigTest_checkHiddenClass(JNIEnv *jni, jclass klass, jclass h /* Native method: checkHiddenClassArray(). */ JNIEXPORT void JNICALL Java_P_Q_HiddenClassSigTest_checkHiddenClassArray(JNIEnv *jni, jclass klass, jclass hidden_klass_array, jstring exp_sig_str) { - const char* exp_sig = jni->GetStringUTFChars(exp_sig_str, NULL); + const char* exp_sig = jni->GetStringUTFChars(exp_sig_str, nullptr); - if (exp_sig == NULL) { - jni->FatalError("check_hidden_class_array: Error: JNI GetStringChars returned NULL for jstring\n"); + if (exp_sig == nullptr) { + jni->FatalError("check_hidden_class_array: Error: JNI GetStringChars returned null for jstring\n"); return; } check_hidden_class_array(jvmti, jni, hidden_klass_array, exp_sig); diff --git a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/MissedStackMapFrames/libMissedStackMapFrames.cpp b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/MissedStackMapFrames/libMissedStackMapFrames.cpp index 18d4a2e5d1d..5cebf608c34 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/MissedStackMapFrames/libMissedStackMapFrames.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/MissedStackMapFrames/libMissedStackMapFrames.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,7 +62,7 @@ struct SavedClassBytes { jbyteArray get(JNIEnv *env) { if (bytes == nullptr) { - _log("SavedClassBytes: NULL\n"); + _log("SavedClassBytes: null\n"); return nullptr; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineRetransform/libRedefineRetransform.cpp b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineRetransform/libRedefineRetransform.cpp index 9ac4f0dfc26..518e147c942 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineRetransform/libRedefineRetransform.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineRetransform/libRedefineRetransform.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -152,7 +152,7 @@ public: jbyteArray getSavedHookClassBytes() { if (savedClassBytes == nullptr) { - _log("%s: savedClassBytes is NULL\n", mode); + _log("%s: savedClassBytes is null\n", mode); return nullptr; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/SetBreakpoint/libTestManyBreakpoints.cpp b/test/hotspot/jtreg/serviceability/jvmti/SetBreakpoint/libTestManyBreakpoints.cpp index dcb8f87ddd7..b9520cc0e1c 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/SetBreakpoint/libTestManyBreakpoints.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/SetBreakpoint/libTestManyBreakpoints.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ #define TARGET_CLASS_NAME "LTarget;" -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static void check_jvmti_status(JNIEnv* jni, jvmtiError err, const char* msg) { @@ -42,7 +42,7 @@ void JNICALL classprepare(jvmtiEnv* jvmti_env, JNIEnv* jni_env, jthread thread, char* buf; jvmtiError err; - err = jvmti->GetClassSignature(klass, &buf, NULL); + err = jvmti->GetClassSignature(klass, &buf, nullptr); check_jvmti_status(jni_env, err, "classprepare: GetClassSignature error"); if (strncmp(buf, TARGET_CLASS_NAME, strlen(TARGET_CLASS_NAME)) == 0) { @@ -95,13 +95,13 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM* vm, char* options, void* reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, nullptr); if (err != JNI_OK) { printf("Agent_OnLoad: SetEventNotificationMode CLASS_PREPARE error\n"); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JNI_OK) { printf("Agent_OnLoad: SetEventNotificationMode BREAKPOINT error\n"); return JNI_ERR; diff --git a/test/hotspot/jtreg/serviceability/jvmti/SetTag/libTagMapTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/SetTag/libTagMapTest.cpp index cb23df82485..488d6a05fed 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/SetTag/libTagMapTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/SetTag/libTagMapTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ namespace { jlong nextTag = 1; - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; void checkJvmti(int code, const char* message) { if (code != JVMTI_ERROR_NONE) { @@ -55,7 +55,7 @@ extern "C" JNIEXPORT jlong JNICALL Java_TagMapTest_getTag(JNIEnv* jni_env, jclas } extern "C" JNIEXPORT void JNICALL Java_TagMapTest_iterate(JNIEnv* jni_env, jclass clazz, jboolean tagged) { - checkJvmti(jvmti->IterateOverHeap(tagged ? JVMTI_HEAP_OBJECT_TAGGED : JVMTI_HEAP_OBJECT_EITHER, &heapObjectCallback, NULL), "could not iterate"); + checkJvmti(jvmti->IterateOverHeap(tagged ? JVMTI_HEAP_OBJECT_TAGGED : JVMTI_HEAP_OBJECT_EITHER, &heapObjectCallback, nullptr), "could not iterate"); } extern "C" JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) { diff --git a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithCurrentThread/libSuspendWithCurrentThread.cpp b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithCurrentThread/libSuspendWithCurrentThread.cpp index f6dfe86a8e9..61d41a33835 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithCurrentThread/libSuspendWithCurrentThread.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithCurrentThread/libSuspendWithCurrentThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,8 @@ extern "C" { -static jvmtiEnv* jvmti = NULL; -static jthread* threads = NULL; +static jvmtiEnv* jvmti = nullptr; +static jthread* threads = nullptr; static jsize threads_count = 0; JNIEXPORT void JNICALL @@ -51,9 +51,9 @@ Java_SuspendWithCurrentThread_registerTestedThreads(JNIEnv *jni, jclass cls, job /* This function is executed on the suspender thread which is not Main thread */ JNIEXPORT void JNICALL Java_ThreadToSuspend_suspendTestedThreads(JNIEnv *jni, jclass cls) { - jvmtiError* results = NULL; + jvmtiError* results = nullptr; jvmtiError err; - const char* tname = get_thread_name(jvmti, jni, NULL); // current thread name + const char* tname = get_thread_name(jvmti, jni, nullptr); // current thread name LOG("\nsuspendTestedThreads: started by thread: %s\n", tname); err = jvmti->Allocate((threads_count * sizeof(jvmtiError)), @@ -105,7 +105,7 @@ Java_SuspendWithCurrentThread_checkTestedThreadsSuspended(JNIEnv *jni, jclass cl JNIEXPORT void JNICALL Java_SuspendWithCurrentThread_resumeTestedThreads(JNIEnv *jni, jclass cls) { - jvmtiError* results = NULL; + jvmtiError* results = nullptr; jvmtiError err; LOG("\nresumeTestedThreads: started\n"); @@ -135,7 +135,7 @@ Java_SuspendWithCurrentThread_releaseTestedThreadsInfo(JNIEnv *jni, jclass cls) LOG("\nreleaseTestedThreadsInfo: started\n"); for (int i = 0; i < threads_count; i++) { - if (threads[i] != NULL) { + if (threads[i] != nullptr) { jni->DeleteGlobalRef(threads[i]); } } diff --git a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithObjectMonitorEnter/libSuspendWithObjectMonitorEnter.cpp b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithObjectMonitorEnter/libSuspendWithObjectMonitorEnter.cpp index cfdbed1c6e1..f449a4e6b92 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithObjectMonitorEnter/libSuspendWithObjectMonitorEnter.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithObjectMonitorEnter/libSuspendWithObjectMonitorEnter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ extern "C" { -static jvmtiEnv* jvmti = NULL; +static jvmtiEnv* jvmti = nullptr; #define LOG(...) \ do { \ diff --git a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithObjectMonitorWait/libSuspendWithObjectMonitorWait.cpp b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithObjectMonitorWait/libSuspendWithObjectMonitorWait.cpp index 926f0619b59..3706cba76dc 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithObjectMonitorWait/libSuspendWithObjectMonitorWait.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithObjectMonitorWait/libSuspendWithObjectMonitorWait.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ extern "C" { -static jvmtiEnv* jvmti = NULL; +static jvmtiEnv* jvmti = nullptr; #define LOG(...) \ do { \ diff --git a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithRawMonitorEnter/libSuspendWithRawMonitorEnter.cpp b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithRawMonitorEnter/libSuspendWithRawMonitorEnter.cpp index 476d8d67a15..9b7562d70d4 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithRawMonitorEnter/libSuspendWithRawMonitorEnter.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithRawMonitorEnter/libSuspendWithRawMonitorEnter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,8 +26,8 @@ extern "C" { -static jvmtiEnv* jvmti = NULL; -static jrawMonitorID threadLock = NULL; +static jvmtiEnv* jvmti = nullptr; +static jrawMonitorID threadLock = nullptr; static char threadLockName[] = "threadLock"; #define LOG(...) \ diff --git a/test/hotspot/jtreg/serviceability/jvmti/VMObjectAlloc/libVMObjectAlloc.cpp b/test/hotspot/jtreg/serviceability/jvmti/VMObjectAlloc/libVMObjectAlloc.cpp index fc5113f1aad..20b06c6648e 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/VMObjectAlloc/libVMObjectAlloc.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/VMObjectAlloc/libVMObjectAlloc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,8 +35,8 @@ VMObjectAlloc(jvmtiEnv *jvmti, jobject object, jclass cls, jlong size) { - char *signature = NULL; - jvmtiError err = jvmti->GetClassSignature(cls, &signature, NULL); + char *signature = nullptr; + jvmtiError err = jvmti->GetClassSignature(cls, &signature, nullptr); if (err != JVMTI_ERROR_NONE) { jni->FatalError("Failed during the GetClassSignature call"); } @@ -80,7 +80,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC , NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC , nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/Breakpoint/breakpoint01/libbreakpoint01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/Breakpoint/breakpoint01/libbreakpoint01.cpp index 38f0bbd2075..2f4917c13f9 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/Breakpoint/breakpoint01/libbreakpoint01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/Breakpoint/breakpoint01/libbreakpoint01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,7 @@ static const char *THREAD_NAME = "breakpoint01Thr"; static volatile int bpEvents[METH_NUM]; static volatile jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static volatile int callbacksEnabled = JNI_TRUE; @@ -92,7 +92,7 @@ ClassLoad(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jclass klass) { jni->FatalError("failed to obtain a class signature\n"); } - if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) { + if (sig != nullptr && (strcmp(sig, CLASS_SIG) == 0)) { LOG("ClassLoad event received for the class %s setting breakpoints ...\n", sig); setBP(jvmti, jni, klass); } @@ -116,10 +116,10 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca return; } - const char* thr_name = thr_info.name == NULL ? "NULL" : thr_info.name; + const char* thr_name = thr_info.name == nullptr ? "null" : thr_info.name; const char* thr_virtual_tag = jni->IsVirtualThread(thread) == JNI_TRUE ? "virtual" : "platform"; const char* thr_daemon_tag = thr_info.is_daemon == JNI_TRUE ? "deamon" : "user"; - if (thr_info.name == NULL || strcmp(thr_info.name, THREAD_NAME) != 0) { + if (thr_info.name == nullptr || strcmp(thr_info.name, THREAD_NAME) != 0) { result = checkStatus = STATUS_FAILED; LOG("TEST FAILED: Breakpoint event with unexpected thread info:\n"); LOG("\tname: \"%s\"\ttype: %s %s thread\n\n", thr_name, thr_virtual_tag, thr_daemon_tag); @@ -148,14 +148,14 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca LOG("TEST FAILED: unable to obtain a class signature during Breakpoint callback\n\n"); return; } - if (clsSig == NULL || strcmp(clsSig, CLASS_SIG) != 0) { + if (clsSig == nullptr || strcmp(clsSig, CLASS_SIG) != 0) { result = checkStatus = STATUS_FAILED; - LOG("TEST FAILED: Breakpoint event with unexpected class signature: %s\n\n", (clsSig == NULL) ? "NULL" : clsSig); + LOG("TEST FAILED: Breakpoint event with unexpected class signature: %s\n\n", (clsSig == nullptr) ? "null" : clsSig); } else { LOG("CHECK PASSED: class signature: \"%s\"\n", clsSig); } - err = jvmti->GetMethodName(method, &methNam, &methSig, NULL); + err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr); if (err != JVMTI_ERROR_NONE) { result = checkStatus = STATUS_FAILED; LOG("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); @@ -230,7 +230,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -268,22 +268,22 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { LOG("setting event callbacks done\nenabling JVMTI events ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr); if (err != JVMTI_ERROR_NONE) return JNI_ERR; - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); if (err != JVMTI_ERROR_NONE) return JNI_ERR; - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr); if (err != JVMTI_ERROR_NONE) return JNI_ERR; - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) return JNI_ERR; LOG("enabling the events done\n\n"); agent_lock = create_raw_monitor(jvmti, "agent_lock"); - if (agent_lock == NULL) + if (agent_lock == nullptr) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ClassLoad/classload01/libclassload01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ClassLoad/classload01/libclassload01.cpp index 6cff11b9dda..8766b2047a9 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/ClassLoad/classload01/libclassload01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ClassLoad/classload01/libclassload01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,7 +75,7 @@ static volatile int clsEvents[EXP_SIG_NUM]; static volatile int primClsEvents[UNEXP_SIG_NUM]; static jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jrawMonitorID counter_lock; @@ -91,7 +91,7 @@ static void initCounters() { static int findSig(char *sig, int expected) { for (unsigned int i = 0; i < ((expected == 1) ? EXP_SIG_NUM : UNEXP_SIG_NUM); i++) { - if (sig != NULL && + if (sig != nullptr && strcmp(((expected == 1) ? expSigs[i] : unexpSigs[i]), sig) == 0) { return i; /* the signature found, return index */ } @@ -160,7 +160,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -197,7 +197,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } LOG("setting event callbacks done\nenabling ClassLoad event ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Error in SetEventNotificationMode: %d\n", err); return JNI_ERR; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ClassPrepare/classprep01/libclassprep01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ClassPrepare/classprep01/libclassprep01.cpp index 0933fec1d00..607b1d2792f 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/ClassPrepare/classprep01/libclassprep01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ClassPrepare/classprep01/libclassprep01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,7 +45,7 @@ typedef struct { jint icount; } class_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static size_t eventsCount = 0; @@ -158,7 +158,7 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jclass cls) LOG(">>> %d methods:", inf.mcount); for (int i = 0; i < inf.mcount; i++) { if (i > 0) LOG(","); - if (methods[i] == NULL) { + if (methods[i] == nullptr) { LOG(" null"); } else { err = jvmti->GetMethodName(methods[i], &name, &sig, &generic); @@ -173,7 +173,7 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jclass cls) LOG(">>> %d fields:", inf.fcount); for (int i = 0; i < inf.fcount; i++) { if (i > 0) LOG(","); - if (fields[i] == NULL) { + if (fields[i] == nullptr) { LOG(" null"); } else { err = jvmti->GetFieldName(cls, fields[i], &name, &sig, &generic); @@ -188,7 +188,7 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jclass cls) LOG(">>> %d interfaces:", inf.icount); for (int i = 0; i < inf.icount; i++) { if (i > 0) LOG(","); - if (interfaces[i] == NULL) { + if (interfaces[i] == nullptr) { LOG(" null"); } else { err = jvmti->GetClassSignature(interfaces[i], &sig, &generic); @@ -226,7 +226,7 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jclass cls) return; } - if (inf.sig == NULL || strcmp(inf.sig, classes[eventsCount].sig) != 0) { + if (inf.sig == nullptr || strcmp(inf.sig, classes[eventsCount].sig) != 0) { LOG("(#%" PRIuPTR ") wrong class: \"%s\"", eventsCount, inf.sig); LOG(", expected: \"%s\"\n", classes[eventsCount].sig); result = STATUS_FAILED; @@ -262,7 +262,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -299,7 +299,7 @@ JNIEXPORT void JNICALL Java_classprep01_getReady(JNIEnv *jni, jclass cls, jthread thread) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return; } @@ -327,7 +327,7 @@ JNIEXPORT jint JNICALL Java_classprep01_check(JNIEnv *jni, jclass cls, jthread thread) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/Exception/exception01/libexception01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/Exception/exception01/libexception01.cpp index a044bc4387b..ebb086adcaa 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/Exception/exception01/libexception01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/Exception/exception01/libexception01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,7 +56,7 @@ typedef struct { jlocation c_loc; } exceptionInfo; -static jvmtiEnv *jvmti_env = NULL; +static jvmtiEnv *jvmti_env = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static exceptionInfo exs[] = { @@ -139,13 +139,13 @@ Exception(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, bool found = false; for (size_t i = 0; i < sizeof(exs)/sizeof(exceptionInfo); i++) { - if (ex.name != NULL && strcmp(ex.name, exs[i].name) == 0 - && ex.t_cls != NULL && strcmp(ex.t_cls, exs[i].t_cls) == 0 - && ex.t_name != NULL && strcmp(ex.t_name, exs[i].t_name) == 0 - && ex.t_sig != NULL && strcmp(ex.t_sig, exs[i].t_sig) == 0 - && ex.c_cls != NULL && strcmp(ex.c_cls, exs[i].c_cls) == 0 - && ex.c_name != NULL && strcmp(ex.c_name, exs[i].c_name) == 0 - && ex.c_sig != NULL && strcmp(ex.c_sig, exs[i].c_sig) == 0 + if (ex.name != nullptr && strcmp(ex.name, exs[i].name) == 0 + && ex.t_cls != nullptr && strcmp(ex.t_cls, exs[i].t_cls) == 0 + && ex.t_name != nullptr && strcmp(ex.t_name, exs[i].t_name) == 0 + && ex.t_sig != nullptr && strcmp(ex.t_sig, exs[i].t_sig) == 0 + && ex.c_cls != nullptr && strcmp(ex.c_cls, exs[i].c_cls) == 0 + && ex.c_name != nullptr && strcmp(ex.c_name, exs[i].c_name) == 0 + && ex.c_sig != nullptr && strcmp(ex.c_sig, exs[i].c_sig) == 0 && ex.t_loc == exs[i].t_loc && ex.c_loc == exs[i].c_loc) { jboolean isVirtual = jni->IsVirtualThread(thr); if (isVirtualExpected != isVirtual) { @@ -175,7 +175,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiCapabilities caps; res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti_env == NULL) { + if (res != JNI_OK || jvmti_env == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -217,27 +217,27 @@ Java_exception01_check(JNIEnv *jni, jclass cls) { jclass clz; jmethodID mid; - if (jvmti_env == NULL) { + if (jvmti_env == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } clz = jni->FindClass("exception01c"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Cannot find exception01c class!\n"); return STATUS_FAILED; } clz = jni->FindClass("exception01b"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Cannot find exception01b class!\n"); return STATUS_FAILED; } clz = jni->FindClass("exception01a"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Cannot find exception01a class!\n"); return STATUS_FAILED; } mid = jni->GetStaticMethodID(clz, "run", "()V"); - if (mid == NULL) { + if (mid == nullptr) { LOG("Cannot find method run!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ExceptionCatch/excatch01/libexcatch01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ExceptionCatch/excatch01/libexcatch01.cpp index bd9d263c1b2..f7d74e6f2bf 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/ExceptionCatch/excatch01/libexcatch01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ExceptionCatch/excatch01/libexcatch01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,7 +48,7 @@ typedef struct { jlocation c_loc; } exceptionInfo; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -107,10 +107,10 @@ ExceptionCatch(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jmethodID method, jloc bool found = false; for (size_t i = 0; i < sizeof(exs)/sizeof(exceptionInfo); i++) { - if (ex.name != NULL && strcmp(ex.name, exs[i].name) == 0 - && ex.c_cls != NULL && strcmp(ex.c_cls, exs[i].c_cls) == 0 - && ex.c_name != NULL && strcmp(ex.c_name, exs[i].c_name) == 0 - && ex.c_sig != NULL && strcmp(ex.c_sig, exs[i].c_sig) == 0 + if (ex.name != nullptr && strcmp(ex.name, exs[i].name) == 0 + && ex.c_cls != nullptr && strcmp(ex.c_cls, exs[i].c_cls) == 0 + && ex.c_name != nullptr && strcmp(ex.c_name, exs[i].c_name) == 0 + && ex.c_sig != nullptr && strcmp(ex.c_sig, exs[i].c_sig) == 0 && ex.c_loc == exs[i].c_loc) { jboolean isVirtual = jni->IsVirtualThread(thr); if (isVirtualExpected != isVirtual) { @@ -138,7 +138,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -180,28 +180,28 @@ Java_excatch01_check(JNIEnv *jni, jclass cls) { jmethodID mid; jthread thread; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } clz = jni->FindClass("excatch01c"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Cannot find excatch01c class!\n"); return STATUS_FAILED; } clz = jni->FindClass("excatch01b"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Cannot find excatch01b class!\n"); return STATUS_FAILED; } clz = jni->FindClass("excatch01a"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Cannot find excatch01a class!\n"); return STATUS_FAILED; } mid = jni->GetStaticMethodID(clz, "run", "()V"); - if (mid == NULL) { + if (mid == nullptr) { LOG("Cannot find method run!\n"); return STATUS_FAILED; } @@ -213,7 +213,7 @@ Java_excatch01_check(JNIEnv *jni, jclass cls) { return STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr); if (err == JVMTI_ERROR_NONE) { eventsExpected = sizeof(exs)/sizeof(exceptionInfo); } else { @@ -224,7 +224,7 @@ Java_excatch01_check(JNIEnv *jni, jclass cls) { eventsCount = 0; isVirtualExpected = jni->IsVirtualThread(thread); jni->CallStaticVoidMethod(clz, mid); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_EXCEPTION_CATCH: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc01/libfieldacc01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc01/libfieldacc01.cpp index b0ad276a1ce..cad086cb7ef 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc01/libfieldacc01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc01/libfieldacc01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,45 +65,45 @@ static volatile jboolean isVirtualExpected = JNI_FALSE; static volatile int eventsExpected = 0; static volatile int eventsCount = 0; static watch_info watches[] = { - { NULL, "Lfieldacc01a;", "run", "()I", 2, + { nullptr, "Lfieldacc01a;", "run", "()I", 2, "Lfieldacc01a;", "staticBoolean", "Z", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 6, + { nullptr, "Lfieldacc01a;", "run", "()I", 6, "Lfieldacc01a;", "instanceBoolean", "Z", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 15, + { nullptr, "Lfieldacc01a;", "run", "()I", 15, "Lfieldacc01a;", "staticByte", "B", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 19, + { nullptr, "Lfieldacc01a;", "run", "()I", 19, "Lfieldacc01a;", "instanceByte", "B", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 28, + { nullptr, "Lfieldacc01a;", "run", "()I", 28, "Lfieldacc01a;", "staticShort", "S", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 32, + { nullptr, "Lfieldacc01a;", "run", "()I", 32, "Lfieldacc01a;", "instanceShort", "S", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 41, + { nullptr, "Lfieldacc01a;", "run", "()I", 41, "Lfieldacc01a;", "staticInt", "I", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 45, + { nullptr, "Lfieldacc01a;", "run", "()I", 45, "Lfieldacc01a;", "instanceInt", "I", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 54, + { nullptr, "Lfieldacc01a;", "run", "()I", 54, "Lfieldacc01a;", "staticLong", "J", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 58, + { nullptr, "Lfieldacc01a;", "run", "()I", 58, "Lfieldacc01a;", "instanceLong", "J", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 68, + { nullptr, "Lfieldacc01a;", "run", "()I", 68, "Lfieldacc01a;", "staticFloat", "F", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 72, + { nullptr, "Lfieldacc01a;", "run", "()I", 72, "Lfieldacc01a;", "instanceFloat", "F", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 82, + { nullptr, "Lfieldacc01a;", "run", "()I", 82, "Lfieldacc01a;", "staticDouble", "D", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 86, + { nullptr, "Lfieldacc01a;", "run", "()I", 86, "Lfieldacc01a;", "instanceDouble", "D", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 96, + { nullptr, "Lfieldacc01a;", "run", "()I", 96, "Lfieldacc01a;", "staticChar", "C", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 100, + { nullptr, "Lfieldacc01a;", "run", "()I", 100, "Lfieldacc01a;", "instanceChar", "C", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 109, + { nullptr, "Lfieldacc01a;", "run", "()I", 109, "Lfieldacc01a;", "staticObject", "Ljava/lang/Object;", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 113, + { nullptr, "Lfieldacc01a;", "run", "()I", 113, "Lfieldacc01a;", "instanceObject", "Ljava/lang/Object;", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 122, + { nullptr, "Lfieldacc01a;", "run", "()I", 122, "Lfieldacc01a;", "staticArrInt", "[I", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 128, + { nullptr, "Lfieldacc01a;", "run", "()I", 128, "Lfieldacc01a;", "instanceArrInt", "[I", JNI_FALSE } }; @@ -121,7 +121,7 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, watch.fid = field; watch.loc = location; - watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE; + watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE; err = jvmti->GetMethodDeclaringClass(method, &cls); if (err != JVMTI_ERROR_NONE) { LOG("(GetMethodDeclaringClass) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -163,16 +163,16 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { if (watch.fid == watches[i].fid) { - if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) { + if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) { LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls); result = STATUS_FAILED; } - if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) { + if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name); LOG(", expected: \"%s\"\n", watches[i].m_name); result = STATUS_FAILED; } - if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) { + if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig); LOG(", expected: \"%s\"\n", watches[i].m_sig); result = STATUS_FAILED; @@ -182,12 +182,12 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc); result = STATUS_FAILED; } - if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) { + if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name); LOG(", expected: \"%s\"\n", watches[i].f_name); result = STATUS_FAILED; } - if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) { + if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig); LOG(", expected: \"%s\"\n", watches[i].f_sig); result = STATUS_FAILED; @@ -216,7 +216,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -245,7 +245,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err); return JNI_ERR; @@ -267,7 +267,7 @@ Java_fieldacc01_getReady(JNIEnv *jni, jclass klass) { LOG(">>> setting field access watches ...\n"); cls = jni->FindClass("fieldacc01a"); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find fieldacc01a class!\n"); result = STATUS_FAILED; return; @@ -289,7 +289,7 @@ Java_fieldacc01_getReady(JNIEnv *jni, jclass klass) { } else { watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig); } - if (watches[i].fid == NULL) { + if (watches[i].fid == nullptr) { LOG("Cannot find field \"%s\"!\n", watches[i].f_name); result = STATUS_FAILED; return; @@ -317,7 +317,7 @@ Java_fieldacc01_check(JNIEnv *jni, jclass klass) { } cls = jni->FindClass("fieldacc01a"); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find fieldacc01a class!\n"); result = STATUS_FAILED; return result; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc02/libfieldacc02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc02/libfieldacc02.cpp index 59d4150e4c2..c733fb1cbc7 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc02/libfieldacc02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc02/libfieldacc02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,46 +65,46 @@ static volatile jboolean isVirtualExpected = JNI_FALSE; static int eventsExpected = 0; static int eventsCount = 0; static watch_info watches[] = { - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticBoolean", "Z", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticByte", "B", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticShort", "S", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticInt", "I", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticLong", "J", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticFloat", "F", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticDouble", "D", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticChar", "C", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticObject", "Ljava/lang/Object;", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticArrInt", "[I", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceBoolean", "Z", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceByte", "B", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceShort", "S", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceInt", "I", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceLong", "J", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceFloat", "F", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceDouble", "D", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceChar", "C", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceObject", "Ljava/lang/Object;", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceArrInt", "[I", JNI_FALSE } }; @@ -121,7 +121,7 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, watch.fid = field; watch.loc = location; - watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE; + watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE; err = jvmti->GetMethodDeclaringClass(method, &cls); if (err != JVMTI_ERROR_NONE) { LOG("(GetMethodDeclaringClass) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -162,16 +162,16 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { if (watch.fid == watches[i].fid) { - if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) { + if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) { LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls); result = STATUS_FAILED; } - if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) { + if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name); LOG(", expected: \"%s\"\n", watches[i].m_name); result = STATUS_FAILED; } - if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) { + if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig); LOG(", expected: \"%s\"\n", watches[i].m_sig); result = STATUS_FAILED; @@ -181,12 +181,12 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc); result = STATUS_FAILED; } - if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) { + if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name); LOG(", expected: \"%s\"\n", watches[i].f_name); result = STATUS_FAILED; } - if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) { + if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig); LOG(", expected: \"%s\"\n", watches[i].f_sig); result = STATUS_FAILED; @@ -214,7 +214,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -243,7 +243,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err); @@ -264,7 +264,7 @@ JNIEXPORT void JNICALL Java_fieldacc02_getReady(JNIEnv *jni, jclass clz) { LOG(">>> setting field access watches ...\n"); cls = jni->FindClass("fieldacc02a"); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find fieldacc02a class!\n"); result = STATUS_FAILED; return; @@ -287,7 +287,7 @@ JNIEXPORT void JNICALL Java_fieldacc02_getReady(JNIEnv *jni, jclass clz) { } else { watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig); } - if (watches[i].fid == NULL) { + if (watches[i].fid == nullptr) { LOG("Cannot find field \"%s\"!\n", watches[i].f_name); result = STATUS_FAILED; return; @@ -313,7 +313,7 @@ Java_fieldacc02_check(JNIEnv *jni, jclass clz, jobject obj) { LOG(">>> accessing fields ...\n"); cls = jni->FindClass("fieldacc02a"); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find fieldacc02a class!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc03/libfieldacc03.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc03/libfieldacc03.cpp index 97c7d145918..769a26c9c7d 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc03/libfieldacc03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc03/libfieldacc03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,25 +65,25 @@ static volatile jboolean isVirtualExpected = JNI_FALSE; static int eventsExpected = 0; static int eventsCount = 0; static watch_info watches[] = { - { NULL, "Lfieldacc03a;", "run", "()I", 3, + { nullptr, "Lfieldacc03a;", "run", "()I", 3, "Lfieldacc03a;", "extendsBoolean", "Z", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 14, + { nullptr, "Lfieldacc03a;", "run", "()I", 14, "Lfieldacc03a;", "extendsByte", "B", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 25, + { nullptr, "Lfieldacc03a;", "run", "()I", 25, "Lfieldacc03a;", "extendsShort", "S", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 36, + { nullptr, "Lfieldacc03a;", "run", "()I", 36, "Lfieldacc03a;", "extendsInt", "I", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 47, + { nullptr, "Lfieldacc03a;", "run", "()I", 47, "Lfieldacc03a;", "extendsLong", "J", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 61, + { nullptr, "Lfieldacc03a;", "run", "()I", 61, "Lfieldacc03a;", "extendsFloat", "F", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 74, + { nullptr, "Lfieldacc03a;", "run", "()I", 74, "Lfieldacc03a;", "extendsDouble", "D", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 88, + { nullptr, "Lfieldacc03a;", "run", "()I", 88, "Lfieldacc03a;", "extendsChar", "C", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 100, + { nullptr, "Lfieldacc03a;", "run", "()I", 100, "Lfieldacc03a;", "extendsObject", "Ljava/lang/Object;", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 111, + { nullptr, "Lfieldacc03a;", "run", "()I", 111, "Lfieldacc03a;", "extendsArrInt", "[I", JNI_FALSE } }; @@ -100,7 +100,7 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, watch.fid = field; watch.loc = location; - watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE; + watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE; err = jvmti->GetMethodDeclaringClass(method, &cls); if (err != JVMTI_ERROR_NONE) { LOG("(GetMethodDeclaringClass) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -142,16 +142,16 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { if (watch.fid == watches[i].fid) { - if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) { + if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) { LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls); result = STATUS_FAILED; } - if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) { + if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name); LOG(", expected: \"%s\"\n", watches[i].m_name); result = STATUS_FAILED; } - if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) { + if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig); LOG(", expected: \"%s\"\n", watches[i].m_sig); result = STATUS_FAILED; @@ -161,12 +161,12 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc); result = STATUS_FAILED; } - if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) { + if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name); LOG(", expected: \"%s\"\n", watches[i].f_name); result = STATUS_FAILED; } - if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) { + if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig); LOG(", expected: \"%s\"\n", watches[i].f_sig); result = STATUS_FAILED; @@ -194,7 +194,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -223,7 +223,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err); return JNI_ERR; @@ -256,7 +256,7 @@ Java_fieldacc03_getReady(JNIEnv *jni, jclass klass) { for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { cls = jni->FindClass(watches[i].f_cls); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find %s class!\n", watches[i].f_cls); result = STATUS_FAILED; return; @@ -266,7 +266,7 @@ Java_fieldacc03_getReady(JNIEnv *jni, jclass klass) { } else { watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig); } - if (watches[i].fid == NULL) { + if (watches[i].fid == nullptr) { LOG("Cannot get field ID for \"%s:%s\"\n", watches[i].f_name, watches[i].f_sig); result = STATUS_FAILED; return; @@ -291,7 +291,7 @@ Java_fieldacc03_check(JNIEnv *jni, jclass clz) { } for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { jclass cls = jni->FindClass(watches[i].f_cls); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find %s class!\n", watches[i].f_cls); result = STATUS_FAILED; return result; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc04/libfieldacc04.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc04/libfieldacc04.cpp index 1b1f9df96b7..2239294c52c 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc04/libfieldacc04.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc04/libfieldacc04.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,10 +65,10 @@ static volatile jboolean isVirtualExpected = JNI_FALSE; static int eventsExpected = 0; static int eventsCount = 0; static watch_info watches[] = { - { NULL, "Lfieldacc04a;", "run", "()I", 2, + { nullptr, "Lfieldacc04a;", "run", "()I", 2, "Lfieldacc04a;", "interfaceObject", "Ljava/lang/Object;", JNI_TRUE }, - { NULL, "Lfieldacc04a;", "run", "()I", 12, + { nullptr, "Lfieldacc04a;", "run", "()I", 12, "Lfieldacc04a;", "interfaceArrInt", "[I", JNI_TRUE } }; @@ -87,7 +87,7 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, watch.fid = field; watch.loc = location; - watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE; + watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE; err = jvmti->GetMethodDeclaringClass(method, &cls); if (err != JVMTI_ERROR_NONE) { LOG("(GetMethodDeclaringClass) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -129,16 +129,16 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { if (watch.fid == watches[i].fid) { - if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) { + if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) { LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls); result = STATUS_FAILED; } - if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) { + if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name); LOG(", expected: \"%s\"\n", watches[i].m_name); result = STATUS_FAILED; } - if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) { + if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig); LOG(", expected: \"%s\"\n", watches[i].m_sig); result = STATUS_FAILED; @@ -148,12 +148,12 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc); result = STATUS_FAILED; } - if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) { + if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name); LOG(", expected: \"%s\"\n", watches[i].f_name); result = STATUS_FAILED; } - if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) { + if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig); LOG(", expected: \"%s\"\n", watches[i].f_sig); result = STATUS_FAILED; @@ -181,7 +181,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -210,7 +210,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err); return JNI_ERR; @@ -243,7 +243,7 @@ Java_fieldacc04_getReady(JNIEnv *jni, jclass klass) { for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { cls = jni->FindClass(watches[i].f_cls); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find %s class!\n", watches[i].f_cls); result = STATUS_FAILED; return; @@ -253,7 +253,7 @@ Java_fieldacc04_getReady(JNIEnv *jni, jclass klass) { } else { watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig); } - if (watches[i].fid == NULL) { + if (watches[i].fid == nullptr) { LOG("Cannot get field ID for \"%s:%s\"\n", watches[i].f_name, watches[i].f_sig); result = STATUS_FAILED; return; @@ -279,7 +279,7 @@ Java_fieldacc04_check(JNIEnv *jni, jclass clz) { } for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { jclass cls = jni->FindClass(watches[i].f_cls); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find %s class!\n", watches[i].f_cls); result = STATUS_FAILED; return result; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod01/libfieldmod01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod01/libfieldmod01.cpp index cfd53a3f861..26da8fedefb 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod01/libfieldmod01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod01/libfieldmod01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,46 +67,46 @@ static volatile jboolean isVirtualExpected = JNI_FALSE; static int eventsExpected = 0; static int eventsCount = 0; static watch_info watches[] = { - { NULL, "Lfieldmod01a;", "run", "()V", 1, + { nullptr, "Lfieldmod01a;", "run", "()V", 1, "Lfieldmod01a;", "staticBoolean", "Z", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 5, + { nullptr, "Lfieldmod01a;", "run", "()V", 5, "Lfieldmod01a;", "staticByte", "B", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 9, + { nullptr, "Lfieldmod01a;", "run", "()V", 9, "Lfieldmod01a;", "staticShort", "S", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 13, + { nullptr, "Lfieldmod01a;", "run", "()V", 13, "Lfieldmod01a;", "staticInt", "I", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 19, + { nullptr, "Lfieldmod01a;", "run", "()V", 19, "Lfieldmod01a;", "staticLong", "J", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 24, + { nullptr, "Lfieldmod01a;", "run", "()V", 24, "Lfieldmod01a;", "staticFloat", "F", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 30, + { nullptr, "Lfieldmod01a;", "run", "()V", 30, "Lfieldmod01a;", "staticDouble", "D", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 35, + { nullptr, "Lfieldmod01a;", "run", "()V", 35, "Lfieldmod01a;", "staticChar", "C", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 41, + { nullptr, "Lfieldmod01a;", "run", "()V", 41, "Lfieldmod01a;", "staticObject", "Ljava/lang/Object;", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 47, + { nullptr, "Lfieldmod01a;", "run", "()V", 47, "Lfieldmod01a;", "staticArrInt", "[I", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 52, + { nullptr, "Lfieldmod01a;", "run", "()V", 52, "Lfieldmod01a;", "instanceBoolean", "Z", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 58, + { nullptr, "Lfieldmod01a;", "run", "()V", 58, "Lfieldmod01a;", "instanceByte", "B", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 64, + { nullptr, "Lfieldmod01a;", "run", "()V", 64, "Lfieldmod01a;", "instanceShort", "S", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 70, + { nullptr, "Lfieldmod01a;", "run", "()V", 70, "Lfieldmod01a;", "instanceInt", "I", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 77, + { nullptr, "Lfieldmod01a;", "run", "()V", 77, "Lfieldmod01a;", "instanceLong", "J", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 83, + { nullptr, "Lfieldmod01a;", "run", "()V", 83, "Lfieldmod01a;", "instanceFloat", "F", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 90, + { nullptr, "Lfieldmod01a;", "run", "()V", 90, "Lfieldmod01a;", "instanceDouble", "D", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 96, + { nullptr, "Lfieldmod01a;", "run", "()V", 96, "Lfieldmod01a;", "instanceChar", "C", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 103, + { nullptr, "Lfieldmod01a;", "run", "()V", 103, "Lfieldmod01a;", "instanceObject", "Ljava/lang/Object;", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 110, + { nullptr, "Lfieldmod01a;", "run", "()V", 110, "Lfieldmod01a;", "instanceArrInt", "[I", JNI_FALSE, {} } }; @@ -187,7 +187,7 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni, watch.fid = field; watch.loc = location; watch.val = new_value; - watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE; + watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE; err = jvmti->GetMethodDeclaringClass(method, &cls); if (err != JVMTI_ERROR_NONE) { LOG("(GetMethodDeclaringClass) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -231,16 +231,16 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni, for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { if (watch.fid == watches[i].fid) { - if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) { + if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) { LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls); result = STATUS_FAILED; } - if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) { + if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name); LOG(", expected: \"%s\"\n", watches[i].m_name); result = STATUS_FAILED; } - if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) { + if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig); LOG(", expected: \"%s\"\n", watches[i].m_sig); result = STATUS_FAILED; @@ -250,12 +250,12 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni, LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc); result = STATUS_FAILED; } - if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) { + if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name); LOG(", expected: \"%s\"\n", watches[i].f_name); result = STATUS_FAILED; } - if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) { + if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig); LOG(", expected: \"%s\"\n", watches[i].f_sig); result = STATUS_FAILED; @@ -291,7 +291,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -321,7 +321,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable JVMTI_EVENT_FIELD_MODIFICATION: %s (%d)\n", TranslateError(err), err); return JNI_ERR; @@ -353,7 +353,7 @@ Java_fieldmod01_getReady(JNIEnv *jni, jclass klass, jobject obj1, jobject obj2, LOG(">>> setting field modification watches ...\n"); cls = jni->FindClass("fieldmod01a"); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find fieldmod01a class!\n"); result = STATUS_FAILED; return; @@ -364,7 +364,7 @@ Java_fieldmod01_getReady(JNIEnv *jni, jclass klass, jobject obj1, jobject obj2, } else { watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig); } - if (watches[i].fid == NULL) { + if (watches[i].fid == nullptr) { LOG("Cannot get field ID for \"%s:%s\"\n", watches[i].f_name, watches[i].f_sig); result = STATUS_FAILED; return; @@ -412,7 +412,7 @@ Java_fieldmod01_check(JNIEnv *jni, jclass clz) { } jclass cls = jni->FindClass("fieldmod01a"); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find fieldmod01a class!\n"); result = STATUS_FAILED; return result; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod02/libfieldmod02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod02/libfieldmod02.cpp index 7c0dae284eb..23e3c5f22d9 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod02/libfieldmod02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod02/libfieldmod02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,46 +67,46 @@ static volatile jboolean isVirtualExpected = JNI_FALSE; static int eventsExpected = 0; static int eventsCount = 0; static watch_info watches[] = { - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticBoolean", "Z", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticByte", "B", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticShort", "S", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticInt", "I", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticLong", "J", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticFloat", "F", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticDouble", "D", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticChar", "C", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticObject", "Ljava/lang/Object;", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticArrInt", "[I", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceBoolean", "Z", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceByte", "B", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceShort", "S", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceInt", "I", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceLong", "J", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceFloat", "F", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceDouble", "D", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceChar", "C", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceObject", "Ljava/lang/Object;", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceArrInt", "[I", JNI_FALSE, {} } }; @@ -187,7 +187,7 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni, watch.fid = field; watch.loc = location; - watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE; + watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE; watch.val = new_value; err = jvmti->GetMethodDeclaringClass(method, &cls); if (err != JVMTI_ERROR_NONE) { @@ -232,16 +232,16 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni, for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { if (watch.fid == watches[i].fid) { - if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) { + if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) { LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls); result = STATUS_FAILED; } - if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) { + if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name); LOG(", expected: \"%s\"\n", watches[i].m_name); result = STATUS_FAILED; } - if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) { + if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig); LOG(", expected: \"%s\"\n", watches[i].m_sig); result = STATUS_FAILED; @@ -251,12 +251,12 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni, LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc); result = STATUS_FAILED; } - if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) { + if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name); LOG(", expected: \"%s\"\n", watches[i].f_name); result = STATUS_FAILED; } - if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) { + if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig); LOG(", expected: \"%s\"\n", watches[i].f_sig); result = STATUS_FAILED; @@ -292,7 +292,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -321,7 +321,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable JVMTI_EVENT_FIELD_MODIFICATION: %s (%d)\n", TranslateError(err), err); return JNI_ERR; @@ -356,7 +356,7 @@ Java_fieldmod02_getReady(JNIEnv *jni, jclass clz) { LOG(">>> setting field modification watches ...\n"); cls = jni->FindClass("fieldmod02a"); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find fieldmod02a class!\n"); result = STATUS_FAILED; return; @@ -367,7 +367,7 @@ Java_fieldmod02_getReady(JNIEnv *jni, jclass clz) { } else { watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig); } - if (watches[i].fid == NULL) { + if (watches[i].fid == nullptr) { LOG("Cannot get field ID for \"%s:%s\"\n", watches[i].f_name, watches[i].f_sig); result = STATUS_FAILED; return; @@ -422,7 +422,7 @@ Java_fieldmod02_check(JNIEnv *jni, jclass clz, jobject obj) { cls = jni->FindClass("fieldmod02a"); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find fieldmod02a class!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop01/libframepop01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop01/libframepop01.cpp index d757e2eff4c..04eb17d6d4c 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop01/libframepop01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop01/libframepop01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ typedef struct { jlocation loc; } pop_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static volatile jboolean isVirtualExpected = JNI_FALSE; @@ -111,17 +111,17 @@ void JNICALL FramePop(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread_obj, jmethodI LOG(">>> ... done\n"); if (eventsCount < sizeof(pops)/sizeof(pop_info)) { - if (cls_sig == NULL || strcmp(cls_sig, pops[eventsCount].cls_sig) != 0) { + if (cls_sig == nullptr || strcmp(cls_sig, pops[eventsCount].cls_sig) != 0) { LOG("(pop#%" PRIuPTR ") wrong class: \"%s\"", eventsCount, cls_sig); LOG(", expected: \"%s\"\n", pops[eventsCount].cls_sig); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, pops[eventsCount].name) != 0) { + if (name == nullptr || strcmp(name, pops[eventsCount].name) != 0) { LOG("(pop#%" PRIuPTR ") wrong method name: \"%s\"", eventsCount, name); LOG(", expected: \"%s\"\n", pops[eventsCount].name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, pops[eventsCount].sig) != 0) { + if (sig == nullptr || strcmp(sig, pops[eventsCount].sig) != 0) { LOG("(pop#%" PRIuPTR ") wrong method sig: \"%s\"", eventsCount, sig); LOG(", expected: \"%s\"\n", pops[eventsCount].sig); result = STATUS_FAILED; @@ -152,7 +152,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -203,7 +203,7 @@ Java_framepop01_check(JNIEnv *jni, jclass cls) { return STATUS_FAILED; } - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -218,19 +218,19 @@ Java_framepop01_check(JNIEnv *jni, jclass cls) { LOG("Failed to SetBreakpoint: %s (%d)\n", TranslateError(err), err); return STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable JVMTI_EVENT_FRAME_POP event: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; } clz = jni->FindClass("framepop01a"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Cannot find framepop01a class!\n"); result = STATUS_FAILED; return STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp index bc8f36114a2..21e8f4e7e06 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,7 +45,7 @@ typedef struct thr { item_t tos; } thr; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jrawMonitorID event_lock; static jboolean printdump = JNI_TRUE; @@ -116,7 +116,7 @@ void pop(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jmethodID method, int depth) fatal(jni, "Unknown thread:\n"); } - if (threads[i].tos == NULL) { + if (threads[i].tos == nullptr) { watch_events = JNI_FALSE; printInfo(jni, jvmti, thr, method, depth); fatal(jni, "Stack underflow:\n"); @@ -131,7 +131,7 @@ void pop(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jmethodID method, int depth) return; } free(old); - } while (threads[i].tos != NULL); + } while (threads[i].tos != nullptr); watch_events = JNI_FALSE; printInfo(jni, jvmti, thr, method, depth); @@ -155,11 +155,11 @@ void push(JNIEnv *jni, jthread thr, jmethodID method, int depth) { fatal(jni, "Out of threads\n"); } threads[i].thread = jni->NewGlobalRef(thr); - threads[i].tos = NULL; + threads[i].tos = nullptr; } new_item = (item_t)malloc(sizeof(item)); - if (new_item == NULL) { + if (new_item == nullptr) { fatal(jni, "Out of memory\n"); } @@ -246,7 +246,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -280,11 +280,11 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { LOG("(SetEventCallbacks) unexpected error: %s (%d)\n", TranslateError(err), err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } @@ -295,18 +295,18 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { } JNIEXPORT void JNICALL Java_framepop02_getReady(JNIEnv *jni, jclass cls) { - check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL), + check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr), "Error in SetEventNotificationMode"); - check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL), + check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr), "Error in SetEventNotificationMode"); watch_events = JNI_TRUE; } JNIEXPORT void JNICALL Java_framepop02_check(JNIEnv *jni, jclass cls) { watch_events = JNI_FALSE; - check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL), + check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, nullptr), "Error in SetEventNotificationMode"); - check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL), + check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr), "Error in SetEventNotificationMode"); if (printdump == JNI_TRUE) { diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry01/libmentry01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry01/libmentry01.cpp index 780438d02f5..b5dec318029 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry01/libmentry01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry01/libmentry01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,7 +45,7 @@ typedef struct { const jlocation loc; } entry_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -78,7 +78,7 @@ void JNICALL MethodEntry(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread_obj, jmeth result = STATUS_FAILED; return; } - if (cls_sig != NULL && strcmp(cls_sig, "Lmentry01;") == 0) { + if (cls_sig != nullptr && strcmp(cls_sig, "Lmentry01;") == 0) { LOG(">>> retrieving method entry info ...\n"); err = jvmti->GetMethodName(method, &entry.name, &entry.sig, &generic); @@ -100,12 +100,12 @@ void JNICALL MethodEntry(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread_obj, jmeth LOG(">>> ... done\n"); if (eventsCount < sizeof(entries)/sizeof(entry_info)) { - if (entry.name == NULL || strcmp(entry.name, entries[eventsCount].name) != 0) { + if (entry.name == nullptr || strcmp(entry.name, entries[eventsCount].name) != 0) { LOG("(entry#%" PRIuPTR ") wrong method name: \"%s\"", eventsCount, entry.name); LOG(", expected: \"%s\"\n", entries[eventsCount].name); result = STATUS_FAILED; } - if (entry.sig == NULL || strcmp(entry.sig, entries[eventsCount].sig) != 0) { + if (entry.sig == nullptr || strcmp(entry.sig, entries[eventsCount].sig) != 0) { LOG("(entry#%" PRIuPTR ") wrong method sig: \"%s\"", eventsCount, entry.sig); LOG(", expected: \"%s\"\n", entries[eventsCount].sig); result = STATUS_FAILED; @@ -137,7 +137,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -176,7 +176,7 @@ JNIEXPORT void JNICALL Java_mentry01_enable(JNIEnv *jni, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { return; } @@ -188,7 +188,7 @@ Java_mentry01_enable(JNIEnv *jni, jclass cls) { } isVirtualExpected = jni->IsVirtualThread(thread); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr); if (err == JVMTI_ERROR_NONE) { eventsExpected = sizeof(entries)/sizeof(entry_info); eventsCount = 0; @@ -202,7 +202,7 @@ JNIEXPORT jint JNICALL Java_mentry01_check(JNIEnv *jni, jclass cls) { jmethodID mid = jni->GetStaticMethodID(cls, "dummy", "()V"); - if (mid == NULL) { + if (mid == nullptr) { LOG("Cannot find metod \"dummy()\"!\n"); return STATUS_FAILED; } @@ -219,13 +219,13 @@ JNIEXPORT void JNICALL Java_mentry01_chain(JNIEnv *jni, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; } - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_METHOD_ENTRY event: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry02/libmentry02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry02/libmentry02.cpp index 90b62dcee7a..43202de0ad7 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry02/libmentry02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry02/libmentry02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean isVirtualExpected = JNI_FALSE; @@ -40,7 +40,7 @@ static int MethodEntriesExpected = 0; static int MethodExitsExpected = 0; static int MethodEntriesCount = 0; static int MethodExitsCount = 0; -static jmethodID mid = NULL; +static jmethodID mid = nullptr; void JNICALL MethodEntry(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread_obj, jmethodID method) { @@ -75,7 +75,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -116,7 +116,7 @@ JNIEXPORT void JNICALL Java_mentry02_getReady(JNIEnv *jni, jclass cls, jint i) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return; } @@ -130,13 +130,13 @@ Java_mentry02_getReady(JNIEnv *jni, jclass cls, jint i) { isVirtualExpected = jni->IsVirtualThread(thread); mid = jni->GetStaticMethodID(cls, "emptyMethod", "()V"); - if (mid == NULL) { + if (mid == nullptr) { LOG("Cannot find Method ID for emptyMethod\n"); result = STATUS_FAILED; return; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr); if (err == JVMTI_ERROR_NONE) { MethodEntriesCount = 0; MethodEntriesExpected = i; @@ -145,7 +145,7 @@ Java_mentry02_getReady(JNIEnv *jni, jclass cls, jint i) { result = STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, nullptr); if (err == JVMTI_ERROR_NONE) { MethodExitsCount = 0; MethodExitsExpected = i; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit01/libmexit01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit01/libmexit01.cpp index 616b599a59b..c6980f10484 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit01/libmexit01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit01/libmexit01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ typedef struct { jlocation loc; } method_location_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean isVirtualExpected = JNI_FALSE; @@ -73,7 +73,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti, JNIEnv *jni, result = STATUS_FAILED; return; } - if (cls_sig != NULL && strcmp(cls_sig, "Lmexit01a;") == 0) { + if (cls_sig != nullptr && strcmp(cls_sig, "Lmexit01a;") == 0) { LOG(">>> retrieving method exit info ...\n"); err = jvmti->GetMethodName(method, &name, &sig, &generic); @@ -95,17 +95,17 @@ void JNICALL MethodExit(jvmtiEnv *jvmti, JNIEnv *jni, LOG(">>> ... done\n"); if (eventsCount < sizeof(exits) / sizeof(method_location_info)) { - if (cls_sig == NULL || strcmp(cls_sig, exits[eventsCount].cls_sig) != 0) { + if (cls_sig == nullptr || strcmp(cls_sig, exits[eventsCount].cls_sig) != 0) { LOG("(exit#%" PRIuPTR ") wrong class: \"%s\"", eventsCount, cls_sig); LOG(", expected: \"%s\"\n", exits[eventsCount].cls_sig); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, exits[eventsCount].name) != 0) { + if (name == nullptr || strcmp(name, exits[eventsCount].name) != 0) { LOG("(exit#%" PRIuPTR ") wrong method name: \"%s\"", eventsCount, name); LOG(", expected: \"%s\"\n", exits[eventsCount].name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, exits[eventsCount].sig) != 0) { + if (sig == nullptr || strcmp(sig, exits[eventsCount].sig) != 0) { LOG("(exit#%" PRIuPTR ") wrong method sig: \"%s\"", eventsCount, sig); LOG(", expected: \"%s\"\n", exits[eventsCount].sig); result = STATUS_FAILED; @@ -137,7 +137,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -177,12 +177,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT jint JNICALL Java_mexit01_init0(JNIEnv *jni, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, nullptr); if (err == JVMTI_ERROR_NONE) { eventsExpected = sizeof(exits)/sizeof(method_location_info); eventsCount = 0; @@ -200,7 +200,7 @@ Java_mexit01_check(JNIEnv *jni, jclass cls) { jclass clz; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -214,20 +214,20 @@ Java_mexit01_check(JNIEnv *jni, jclass cls) { isVirtualExpected = jni->IsVirtualThread(thread); clz = jni->FindClass("mexit01a"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Cannot find MethodExit.mexit01a class!\n"); return STATUS_FAILED; } mid = jni->GetStaticMethodID(clz, "dummy", "()V"); - if (mid == NULL) { + if (mid == nullptr) { LOG("Cannot find metod \"dummy()\"!\n"); return STATUS_FAILED; } jni->CallStaticVoidMethod(clz, mid); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_EXIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_EXIT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_METHOD_EXIT event: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit02/libmexit02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit02/libmexit02.cpp index 140a9932c14..d7d24a3f4e6 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit02/libmexit02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit02/libmexit02.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ typedef struct { jlocation loc; } method_location_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean isVirtualExpected = JNI_FALSE; @@ -73,7 +73,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti, JNIEnv *jni, result = STATUS_FAILED; return; } - if (cls_sig != NULL && strcmp(cls_sig, "Lmexit02a;") == 0) { + if (cls_sig != nullptr && strcmp(cls_sig, "Lmexit02a;") == 0) { LOG(">>> retrieving method exit info ...\n"); err = jvmti->GetMethodName(method, &name, &sig, &generic); @@ -100,17 +100,17 @@ void JNICALL MethodExit(jvmtiEnv *jvmti, JNIEnv *jni, } if (eventsCount < sizeof(exits)/sizeof(method_location_info)) { - if (cls_sig == NULL || strcmp(cls_sig, exits[eventsCount].cls_sig) != 0) { + if (cls_sig == nullptr || strcmp(cls_sig, exits[eventsCount].cls_sig) != 0) { LOG("(exit#%" PRIuPTR ") wrong class: \"%s\"", eventsCount, cls_sig); LOG(", expected: \"%s\"\n", exits[eventsCount].cls_sig); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, exits[eventsCount].name) != 0) { + if (name == nullptr || strcmp(name, exits[eventsCount].name) != 0) { LOG("(exit#%" PRIuPTR ") wrong method name: \"%s\"", eventsCount, name); LOG(", expected: \"%s\"\n", exits[eventsCount].name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, exits[eventsCount].sig) != 0) { + if (sig == nullptr || strcmp(sig, exits[eventsCount].sig) != 0) { LOG("(exit#%" PRIuPTR ") wrong method sig: \"%s\"", eventsCount, sig); LOG(", expected: \"%s\"\n", exits[eventsCount].sig); result = STATUS_FAILED; @@ -137,7 +137,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -178,7 +178,7 @@ Java_mexit02_check(JNIEnv *jni, jclass cls) { jclass clz; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -192,18 +192,18 @@ Java_mexit02_check(JNIEnv *jni, jclass cls) { isVirtualExpected = jni->IsVirtualThread(thread); clz = jni->FindClass("mexit02a"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Failed to find class \"mexit02a\"!\n"); return STATUS_FAILED; } mid = jni->GetStaticMethodID(clz, "dummy", "()V"); - if (mid == NULL) { + if (mid == nullptr) { LOG("Failed to get method \"dummy\"!\n"); return STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, nullptr); if (err == JVMTI_ERROR_NONE) { eventsExpected = sizeof(exits)/sizeof(method_location_info); eventsCount = 0; @@ -214,7 +214,7 @@ Java_mexit02_check(JNIEnv *jni, jclass cls) { jni->CallStaticVoidMethod(clz, mid); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_EXIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_EXIT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_METHOD_EXIT event: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEnter/mcontenter01/libmcontenter01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEnter/mcontenter01/libmcontenter01.cpp index 023cb075a88..77ea808dc23 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEnter/mcontenter01/libmcontenter01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEnter/mcontenter01/libmcontenter01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,13 +35,13 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread expected_thread = NULL; -static jobject expected_object = NULL; +static jthread expected_thread = nullptr; +static jobject expected_object = nullptr; static volatile int eventsCount = 0; /* ========================================================================== */ @@ -53,12 +53,12 @@ MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj) { print_thread_info(jvmti, jni, thr); - if (expected_thread == NULL) { - jni->FatalError("expected_thread is NULL."); + if (expected_thread == nullptr) { + jni->FatalError("expected_thread is null."); } - if (expected_object == NULL) { - jni->FatalError("expected_object is NULL."); + if (expected_object == nullptr) { + jni->FatalError("expected_object is null."); } /* check if event is for tested thread and for tested object */ @@ -72,7 +72,7 @@ MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj) { /* ========================================================================== */ static int prepare() { - jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL); + jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr); if (err != JVMTI_ERROR_NONE) { jni->FatalError("Error enabling JVMTI_EVENT_MONITOR_CONTENDED_ENTER."); } @@ -82,7 +82,7 @@ static int prepare() { static int clean() { LOG("Disabling events\n"); /* disable MonitorContendedEnter event */ - jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL); + jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr); if (err != JVMTI_ERROR_NONE) { set_agent_fail_status(); } @@ -139,7 +139,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { LOG("Timeout: %d msc\n", (int) timeout); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -177,7 +177,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - set_agent_proc(agentProc, NULL); + set_agent_proc(agentProc, nullptr); return JNI_OK; } @@ -190,13 +190,13 @@ JNIEXPORT void JNICALL Java_mcontenter01_setExpected(JNIEnv *jni, jobject clz, j LOG("Remembering global reference for monitor object is %p\n", obj); /* make object accessible for a long time */ expected_object = jni->NewGlobalRef(obj); - if (expected_object == NULL) { + if (expected_object == nullptr) { jni->FatalError("Error saving global reference to monitor.\n"); } /* make thread accessable for a long time */ expected_thread = jni->NewGlobalRef(thread); - if (thread == NULL) { + if (thread == nullptr) { jni->FatalError("Error saving global reference to thread.\n"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEntered/mcontentered01/libmcontentered01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEntered/mcontentered01/libmcontentered01.cpp index 6589f5dabd7..c46ccac6933 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEntered/mcontentered01/libmcontentered01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEntered/mcontentered01/libmcontentered01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,13 +32,13 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread expected_thread = NULL; -static jobject expected_object = NULL; +static jthread expected_thread = nullptr; +static jobject expected_object = nullptr; static volatile int eventsCount = 0; @@ -51,12 +51,12 @@ MonitorContendedEntered(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj) print_thread_info(jvmti, jni, thr); - if (expected_thread == NULL) { - jni->FatalError("expected_thread is NULL."); + if (expected_thread == nullptr) { + jni->FatalError("expected_thread is null."); } - if (expected_object == NULL) { - jni->FatalError("expected_object is NULL."); + if (expected_object == nullptr) { + jni->FatalError("expected_object is null."); } /* check if event is for tested thread and for tested object */ @@ -73,12 +73,12 @@ MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj) { LOG("MonitorContendedEnter event:\n\tthread: %p, object: %p, expected object: %p\n",thr, obj, expected_object); print_thread_info(jvmti, jni, thr); - if (expected_thread == NULL) { - jni->FatalError("expected_thread is NULL."); + if (expected_thread == nullptr) { + jni->FatalError("expected_thread is null."); } - if (expected_object == NULL) { - jni->FatalError("expected_object is NULL."); + if (expected_object == nullptr) { + jni->FatalError("expected_object is null."); } /* check if event is for tested thread and for tested object */ @@ -97,14 +97,14 @@ static int prepare() { LOG("Prepare: find tested thread\n"); /* enable MonitorContendedEntered event */ - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Prepare: 11\n"); return JNI_FALSE; } /* enable MonitorContendedEnter event */ - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Prepare: 11\n"); return JNI_FALSE; @@ -116,7 +116,7 @@ static int prepare() { static int clean() { jvmtiError err; /* disable MonitorContendedEntered event */ - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE,JVMTI_EVENT_MONITOR_CONTENDED_ENTERED,NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE,JVMTI_EVENT_MONITOR_CONTENDED_ENTERED,nullptr); if (err != JVMTI_ERROR_NONE) { set_agent_fail_status(); } @@ -173,7 +173,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { LOG("Timeout: %d msc\n", (int) timeout); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -214,7 +214,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - set_agent_proc(agentProc, NULL); + set_agent_proc(agentProc, nullptr); return JNI_OK; } @@ -227,13 +227,13 @@ JNIEXPORT void JNICALL Java_mcontentered01_setExpected(JNIEnv *jni, jobject clz, LOG("Remembering global reference for monitor object is %p\n", obj); /* make object accessible for a long time */ expected_object = jni->NewGlobalRef(obj); - if (expected_object == NULL) { + if (expected_object == nullptr) { jni->FatalError("Error saving global reference to monitor.\n"); } /* make thread accessable for a long time */ expected_thread = jni->NewGlobalRef(thread); - if (thread == NULL) { + if (thread == nullptr) { jni->FatalError("Error saving global reference to thread.\n"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWait/monitorwait01/libmonitorwait01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWait/monitorwait01/libmonitorwait01.cpp index 6467a6b3dcb..b85fa20ca16 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWait/monitorwait01/libmonitorwait01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWait/monitorwait01/libmonitorwait01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,13 +31,13 @@ extern "C" { /* scaffold objects */ -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread expected_thread = NULL; -static jobject expected_object = NULL; +static jthread expected_thread = nullptr; +static jobject expected_object = nullptr; static volatile int eventsCount = 0; void JNICALL @@ -47,12 +47,12 @@ MonitorWait(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj, jlong tout) print_thread_info(jvmti, jni, thr); - if (expected_thread == NULL) { - jni->FatalError("expected_thread is NULL."); + if (expected_thread == nullptr) { + jni->FatalError("expected_thread is null."); } - if (expected_object == NULL) { - jni->FatalError("expected_object is NULL."); + if (expected_object == nullptr) { + jni->FatalError("expected_object is null."); } /* check if event is for tested thread and for tested object */ @@ -70,7 +70,7 @@ MonitorWait(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj, jlong tout) static int prepare() { /* enable MonitorWait event */ - jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL); + jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Prepare: 11\n"); return JNI_FALSE; @@ -80,7 +80,7 @@ static int prepare() { static int clean() { /* disable MonitorWait event */ - jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, NULL); + jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr); if (err != JVMTI_ERROR_NONE) { set_agent_fail_status(); } @@ -135,7 +135,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { LOG("Timeout: %d msc\n", (int) timeout); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -173,7 +173,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - set_agent_proc(agentProc, NULL); + set_agent_proc(agentProc, nullptr); return JNI_OK; } @@ -182,13 +182,13 @@ JNIEXPORT void JNICALL Java_monitorwait01_setExpected(JNIEnv *jni, jobject clz, LOG("Remembering global reference for monitor object is %p\n", obj); /* make object accessible for a long time */ expected_object = jni->NewGlobalRef(obj); - if (expected_object == NULL) { + if (expected_object == nullptr) { jni->FatalError("Error saving global reference to monitor.\n"); } /* make thread accessable for a long time */ expected_thread = jni->NewGlobalRef(thread); - if (thread == NULL) { + if (thread == nullptr) { jni->FatalError("Error saving global reference to thread.\n"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWaited/monitorwaited01/libmonitorwaited01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWaited/monitorwaited01/libmonitorwaited01.cpp index 2eaeefce2fc..013dbd66d81 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWaited/monitorwaited01/libmonitorwaited01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWaited/monitorwaited01/libmonitorwaited01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,13 +31,13 @@ extern "C" { /* scaffold objects */ -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread expected_thread = NULL; -static jobject expected_object = NULL; +static jthread expected_thread = nullptr; +static jobject expected_object = nullptr; static volatile int eventsCount = 0; void JNICALL @@ -48,12 +48,12 @@ MonitorWaited(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj, jboolean t print_thread_info(jvmti, jni, thr); - if (expected_thread == NULL) { - jni->FatalError("expected_thread is NULL."); + if (expected_thread == nullptr) { + jni->FatalError("expected_thread is null."); } - if (expected_object == NULL) { - jni->FatalError("expected_object is NULL."); + if (expected_object == nullptr) { + jni->FatalError("expected_object is null."); } /* check if event is for tested thread and for tested object */ @@ -71,7 +71,7 @@ MonitorWaited(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj, jboolean t static int prepare() { /* enable MonitorWait event */ - jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL); + jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Prepare: 11\n"); return JNI_FALSE; @@ -81,7 +81,7 @@ static int prepare() { static int clean() { /* disable MonitorWaited event */ - jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, NULL); + jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr); if (err != JVMTI_ERROR_NONE) { set_agent_fail_status(); } @@ -136,7 +136,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { LOG("Timeout: %d msc\n", (int) timeout); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -176,7 +176,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - set_agent_proc(agentProc, NULL); + set_agent_proc(agentProc, nullptr); return JNI_OK; } @@ -185,13 +185,13 @@ JNIEXPORT void JNICALL Java_monitorwaited01_setExpected(JNIEnv *jni, jobject clz LOG("Remembering global reference for monitor object is %p\n", obj); /* make object accessible for a long time */ expected_object = jni->NewGlobalRef(obj); - if (expected_object == NULL) { + if (expected_object == nullptr) { jni->FatalError("Error saving global reference to monitor.\n"); } /* make thread accessable for a long time */ expected_thread = jni->NewGlobalRef(thread); - if (thread == NULL) { + if (thread == nullptr) { jni->FatalError("Error saving global reference to thread.\n"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind01/libnativemethbind01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind01/libnativemethbind01.cpp index e363de01b02..c0f7261b38f 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind01/libnativemethbind01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind01/libnativemethbind01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,7 +49,7 @@ static const char *CLASS_SIG = "Lnativemethbind01$TestedClass;"; static volatile jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jrawMonitorID counter_lock; @@ -76,7 +76,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, return; } - err = jvmti->GetMethodName(method, &methNam, &methSig, NULL); + err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; LOG("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n"); @@ -118,7 +118,7 @@ anotherNativeMethod(JNIEnv *jni, jobject obj) { /* dummy method used only to provoke NativeMethodBind event */ JNIEXPORT void JNICALL Java_nativemethbind01_nativeMethod(JNIEnv *jni, jobject obj, jboolean registerNative) { - jclass testedCls = NULL; + jclass testedCls = nullptr; JNINativeMethod meth; LOG("Inside the nativeMethod()\n"); @@ -126,7 +126,7 @@ Java_nativemethbind01_nativeMethod(JNIEnv *jni, jobject obj, jboolean registerNa if (registerNative == JNI_TRUE) { LOG("Finding class \"%s\" ...\n", CLASS_SIG); testedCls = jni->FindClass(CLASS_SIG); - if (testedCls == NULL) { + if (testedCls == nullptr) { result = STATUS_FAILED; COMPLAIN("TEST FAILURE: unable to find class \"%s\"\n\n", CLASS_SIG); return; @@ -168,7 +168,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -203,7 +203,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; LOG("setting event callbacks done\nenabling JVMTI events ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr); if (err != JVMTI_ERROR_NONE){ return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind02/libnativemethbind02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind02/libnativemethbind02.cpp index 2d5dcefe557..747952d4a10 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind02/libnativemethbind02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind02/libnativemethbind02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ extern "C" { static volatile int wrongBindEv = 0; static volatile jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jrawMonitorID counter_lock; @@ -46,7 +46,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, void *addr, void **new_addr) { jvmtiPhase phase; jvmtiError err; - char *methNam = NULL, *methSig = NULL; + char *methNam = nullptr, *methSig = nullptr; RawMonitorLocker rml(jvmti, jni, counter_lock); err = jvmti->GetPhase(&phase); @@ -60,7 +60,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, return; } - err = jvmti->GetMethodName(method, &methNam, &methSig, NULL); + err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; @@ -70,7 +70,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, LOG("NativeMethodBind received for \"%s %s\"\n", methNam, methSig); } - if (methNam != NULL) { + if (methNam != nullptr) { err = jvmti->Deallocate((unsigned char *) methNam); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; @@ -78,7 +78,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, } } - if (methSig != NULL) { + if (methSig != nullptr) { err = jvmti->Deallocate((unsigned char *) methSig); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; @@ -116,7 +116,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -150,11 +150,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; LOG("setting event callbacks done\nenabling JVMTI events ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind03/libnativemethbind03.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind03/libnativemethbind03.cpp index 19d94f560c8..d637f7dc713 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind03/libnativemethbind03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind03/libnativemethbind03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,7 @@ static const char *CLASS_SIG = "Lnativemethbind03$TestedClass;"; static volatile jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jrawMonitorID counter_lock; @@ -72,7 +72,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, return; } - err = jvmti->GetMethodName(method, &methNam, &methSig, NULL); + err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; COMPLAIN("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n"); @@ -84,7 +84,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, LOG("\tmethod: \"%s %s\"\n", methNam, methSig); } - if (methNam != NULL) { + if (methNam != nullptr) { err = jvmti->Deallocate((unsigned char *) methNam); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; @@ -92,7 +92,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, } } - if (methSig != NULL) { + if (methSig != nullptr) { err = jvmti->Deallocate((unsigned char *) methSig); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; @@ -133,13 +133,13 @@ nativeMethod(JNIEnv *jni, jobject obj) { /* dummy method used only to provoke NativeMethodBind event */ JNIEXPORT void JNICALL Java_nativemethbind03_registerNative(JNIEnv *jni, jobject obj) { - jclass testedCls = NULL; + jclass testedCls = nullptr; JNINativeMethod meth; LOG("Inside the registerNative()\n" "Finding class \"%s\" ...\n", CLASS_SIG); testedCls = jni->FindClass(CLASS_SIG); - if (testedCls == NULL) { + if (testedCls == nullptr) { result = STATUS_FAILED; COMPLAIN("TEST FAILURE: unable to find class \"%s\"\n\n", CLASS_SIG); return; @@ -171,7 +171,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -207,11 +207,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; LOG("setting event callbacks done\nenabling JVMTI events ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind04/libnativemethbind04.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind04/libnativemethbind04.cpp index 174084d0494..871028423ef 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind04/libnativemethbind04.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind04/libnativemethbind04.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ static volatile int origCalls = 0; static volatile int redirCalls = 0; static volatile jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jrawMonitorID counter_lock; @@ -84,7 +84,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, return; } - err = jvmti->GetMethodName(method, &methNam, &methSig, NULL); + err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; LOG("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n"); @@ -97,7 +97,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, *new_addr = (void *) redirNativeMethod; } - if (methNam != NULL) { + if (methNam != nullptr) { err = jvmti->Deallocate((unsigned char *) methNam); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; @@ -105,7 +105,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, } } - if (methSig != NULL) { + if (methSig != nullptr) { err = jvmti->Deallocate((unsigned char *) methSig); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; @@ -146,7 +146,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -179,7 +179,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; LOG("setting event callbacks done\nenabling JVMTI events ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep01/libsinglestep01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep01/libsinglestep01.cpp index 003cc55e425..7c4d6ef2ea7 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep01/libsinglestep01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep01/libsinglestep01.cpp @@ -50,7 +50,7 @@ static const char *CLASS_SIG = "Lsinglestep01;"; static volatile jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static volatile jboolean isVirtualExpected = JNI_FALSE; @@ -62,7 +62,7 @@ static void setBP(jvmtiEnv *jvmti, JNIEnv *jni, jclass klass) { jvmtiError err; mid = jni->GetMethodID(klass, METHODS[0], METHOD_SIGS[0]); - if (mid == NULL) { + if (mid == nullptr) { jni->FatalError("failed to get ID for the java method\n"); } @@ -86,7 +86,7 @@ ClassLoad(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jclass klass) { if (err != JVMTI_ERROR_NONE) { jni->FatalError("failed to obtain a class signature\n"); } - if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) { + if (sig != nullptr && (strcmp(sig, CLASS_SIG) == 0)) { LOG("ClassLoad event received for the class \"%s\"\n" "\tsetting breakpoint ...\n", sig); setBP(jvmti, jni, klass); @@ -117,7 +117,7 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jmethodID method, jlocatio jni->FatalError("Breakpoint: failed to obtain a class signature\n"); } - if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) { + if (sig != nullptr && (strcmp(sig, CLASS_SIG) == 0)) { LOG("method declaring class \"%s\"\n\tenabling SingleStep events ...\n", sig); err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thr); if (err != JVMTI_ERROR_NONE) { @@ -145,7 +145,7 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca print_thread_info(jvmti, jni, thread); - err = jvmti->GetMethodName(method, &methNam, &methSig, NULL); + err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; COMPLAIN("TEST FAILED: unable to get method name during SingleStep callback\n\n"); @@ -166,7 +166,7 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca return; } - if (sig != NULL) { + if (sig != nullptr) { LOG("\tmethod name: \"%s\"\n" "\tsignature: \"%s\"\n" "\tmethod declaring class: \"%s\"\n", @@ -244,7 +244,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -284,19 +284,19 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } LOG("setting event callbacks done\nenabling JVMTI events ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep02/libsinglestep02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep02/libsinglestep02.cpp index e80903ac243..f5437de1f3d 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep02/libsinglestep02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep02/libsinglestep02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ extern "C" { static volatile jint result = PASSED; static volatile long wrongStepEv = 0; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; /** callback functions **/ void JNICALL @@ -78,7 +78,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -113,11 +113,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } LOG("setting event callbacks done\nenabling JVMTI events ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep03/libsinglestep03.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep03/libsinglestep03.cpp index e8455006590..51ac700efad 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep03/libsinglestep03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep03/libsinglestep03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ static const char *CLASS_SIG = "Lsinglestep03;"; static volatile jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static volatile int callbacksEnabled = JNI_FALSE; @@ -64,7 +64,7 @@ static void setBP(jvmtiEnv *jvmti, JNIEnv *jni, jclass klass) { jvmtiError err; mid = jni->GetMethodID(klass, METHODS[0][0], METHODS[0][1]); - if (mid == NULL) { + if (mid == nullptr) { jni->FatalError("failed to get ID for the java method\n"); } @@ -91,7 +91,7 @@ ClassLoad(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jclass klass) { jni->FatalError("failed to obtain a class signature\n"); } - if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) { + if (sig != nullptr && (strcmp(sig, CLASS_SIG) == 0)) { LOG("ClassLoad event received for the class \"%s\"\n" "\tsetting breakpoint ...\n", sig); setBP(jvmti, jni, klass); @@ -133,7 +133,7 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jmethodID method, jlocatio jni->FatalError("Breakpoint: failed to obtain a class signature\n"); } - if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) { + if (sig != nullptr && (strcmp(sig, CLASS_SIG) == 0)) { LOG("method declaring class \"%s\"\n\tenabling SingleStep events ...\n", sig); err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thr); if (err != JVMTI_ERROR_NONE) { @@ -159,7 +159,7 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca LOG(">>>> SingleStep event received\n"); - err = jvmti->GetMethodName(method, &methNam, &methSig, NULL); + err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; COMPLAIN("TEST FAILED: unable to get method name during SingleStep callback\n\n"); @@ -180,7 +180,7 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca return; } - if (sig != NULL) { + if (sig != nullptr) { if (stepEv[METH_NUM - 1][0] == 1) { result = STATUS_FAILED; COMPLAIN("TEST FAILED: SingleStep event received after disabling the event generation\n\n"); @@ -272,7 +272,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -310,19 +310,19 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } LOG("setting event callbacks done\nenabling JVMTI events ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend01/libthreadend01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend01/libthreadend01.cpp index 6cfb057902b..b39276eeb00 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend01/libthreadend01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend01/libthreadend01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,12 +34,12 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static int eventsCount = 0; static int eventsExpected = 0; -static const char *prefix = NULL; +static const char *prefix = nullptr; void JNICALL ThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { jvmtiError err; @@ -54,10 +54,10 @@ void JNICALL ThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { print_thread_info(jvmti, jni, thread); - if (inf.name != NULL && strstr(inf.name, prefix) == inf.name) { + if (inf.name != nullptr && strstr(inf.name, prefix) == inf.name) { eventsCount++; snprintf(name, sizeof(name), "%s%d", prefix, eventsCount); - if (inf.name == NULL || strcmp(name, inf.name) != 0) { + if (inf.name == nullptr || strcmp(name, inf.name) != 0) { LOG("(#%d) wrong thread name: \"%s\"",eventsCount, inf.name); LOG(", expected: \"%s\"\n", name); result = STATUS_FAILED; @@ -70,7 +70,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -89,19 +89,19 @@ JNIEXPORT void JNICALL Java_threadend01_getReady(JNIEnv *jni, jclass cls, jint i, jstring name) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return; } - prefix = jni->GetStringUTFChars(name, NULL); - if (prefix == NULL) { + prefix = jni->GetStringUTFChars(name, nullptr); + if (prefix == nullptr) { LOG("Failed to copy UTF-8 string!\n"); result = STATUS_FAILED; return; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, nullptr); if (err == JVMTI_ERROR_NONE) { eventsExpected = i; } else { @@ -112,12 +112,12 @@ Java_threadend01_getReady(JNIEnv *jni, jclass cls, jint i, jstring name) { JNIEXPORT jint JNICALL Java_threadend01_check(JNIEnv *jni, jclass cls) { - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } -jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, NULL); +jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_THREAD_END: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend02/libthreadend02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend02/libthreadend02.cpp index 1d2cfe36de3..2ffc67d3d8e 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend02/libthreadend02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend02/libthreadend02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; static int eventCount = 0; @@ -52,7 +52,7 @@ enableEvent(jvmtiEventMode enable, jvmtiEvent event) { LOG("disabling %s\n", TranslateEvent(event)); } - err = jvmti->SetEventNotificationMode(enable, event, NULL); + err = jvmti->SetEventNotificationMode(enable, event, nullptr); if (err != JVMTI_ERROR_NONE) { set_agent_fail_status(); return JNI_FALSE; @@ -129,7 +129,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = 60 * 1000; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -150,7 +150,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - set_agent_proc(agentProc, NULL); + set_agent_proc(agentProc, nullptr); return JNI_OK; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart01/libthreadstart01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart01/libthreadstart01.cpp index 935f4fc1002..2ebaf2d9f0f 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart01/libthreadstart01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart01/libthreadstart01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,12 +34,12 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static int eventsCount = 0; static int eventsExpected = 0; -static const char *prefix = NULL; +static const char *prefix = nullptr; void JNICALL ThreadStart(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { @@ -54,7 +54,7 @@ ThreadStart(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { LOG(">>> %s\n", inf.name); - if (inf.name != NULL && strstr(inf.name, prefix) == inf.name) { + if (inf.name != nullptr && strstr(inf.name, prefix) == inf.name) { snprintf(name, sizeof(name), "%s%d", prefix, eventsCount); if (strcmp(name, inf.name) != 0) { LOG("(#%d) wrong thread name: \"%s\"", eventsCount, inf.name); @@ -70,7 +70,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -89,19 +89,19 @@ JNIEXPORT void JNICALL Java_threadstart01_getReady(JNIEnv *jni, jclass cls, jint i, jstring name) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return; } - prefix = jni->GetStringUTFChars(name, NULL); - if (prefix == NULL) { + prefix = jni->GetStringUTFChars(name, nullptr); + if (prefix == nullptr) { LOG("Failed to copy UTF-8 string!\n"); result = STATUS_FAILED; return; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); if (err == JVMTI_ERROR_NONE) { eventsExpected = i; } else { @@ -114,12 +114,12 @@ JNIEXPORT jint JNICALL Java_threadstart01_check(JNIEnv *jni, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart02/libthreadstart02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart02/libthreadstart02.cpp index e5ae8be3107..1ab67b64603 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart02/libthreadstart02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart02/libthreadstart02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,16 +33,16 @@ extern "C" { #define STATUS_FAILED 2 #define WAIT_TIME 20000 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; /* volatile variables */ static jrawMonitorID agent_start_lock, thr_start_lock, thr_resume_lock, thr_event_lock; -static volatile jthread agent_thread = NULL; +static volatile jthread agent_thread = nullptr; static volatile jboolean terminate_debug_agent = JNI_FALSE; static volatile jboolean debug_agent_timed_out = JNI_FALSE; static volatile jboolean debug_agent_started = JNI_FALSE; -static volatile jthread next_thread = NULL; +static volatile jthread next_thread = nullptr; static jvmtiThreadInfo inf; static volatile int eventsCount = 0; static volatile jint result = PASSED; @@ -128,12 +128,12 @@ debug_agent(jvmtiEnv *jvmti, JNIEnv *jni, void *p) { RawMonitorLocker thr_start_locker(jvmti, jni, thr_start_lock); while (terminate_debug_agent != JNI_TRUE) { - if (next_thread == NULL) { + if (next_thread == nullptr) { /* wait till new thread will be created and started */ thr_start_locker.wait(); } - if (next_thread != NULL) { + if (next_thread != nullptr) { /* hmm, why NewGlobalRef is called one more time??? * next_thread = env->NewGlobalRef(next_thread); */ @@ -160,7 +160,7 @@ debug_agent(jvmtiEnv *jvmti, JNIEnv *jni, void *p) { } jni->DeleteGlobalRef(next_thread); - next_thread = NULL; + next_thread = nullptr; /* Notify ThreadStart callback that thread has been resumed */ @@ -267,38 +267,38 @@ void JNICALL ThreadStart(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { } void JNICALL VMInit(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr) { - jclass cls = NULL; - jmethodID mid = NULL; + jclass cls = nullptr; + jmethodID mid = nullptr; LOG(">>> VMInit event: start\n"); - check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL), + check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr), "Failed to enable JVMTI_EVENT_THREAD_START"); /* Start agent thread */ cls = jni->FindClass("java/lang/Thread"); - if (cls == NULL) { + if (cls == nullptr) { result = STATUS_FAILED; COMPLAIN("TEST FAILED: Cannot start agent thread: FindClass() failed\n"); return; } mid = jni->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { result = STATUS_FAILED; COMPLAIN("TEST FAILED: Cannot start agent thread: GetMethodID() failed\n"); return; } agent_thread = jni->NewObject(cls, mid); - if (agent_thread == NULL) { + if (agent_thread == nullptr) { result = STATUS_FAILED; COMPLAIN("Cannot start agent thread: NewObject() failed\n"); return; } agent_thread = (jthread) jni->NewGlobalRef(agent_thread); - if (agent_thread == NULL) { + if (agent_thread == nullptr) { result = STATUS_FAILED; COMPLAIN("Cannot create global reference for agent_thread\n"); return; @@ -311,7 +311,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr) { RawMonitorLocker agent_start_locker(jvmti, jni, agent_start_lock); - check_jvmti_status(jni, jvmti->RunAgentThread(agent_thread, debug_agent, NULL, JVMTI_THREAD_NORM_PRIORITY), + check_jvmti_status(jni, jvmti->RunAgentThread(agent_thread, debug_agent, nullptr, JVMTI_THREAD_NORM_PRIORITY), "Failed to RunAgentThread"); agent_start_locker.wait(); LOG(">>> VMInit event: end\n"); @@ -327,7 +327,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -366,14 +366,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_THREAD_END: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart03/libthreadstart03.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart03/libthreadstart03.cpp index a14fa1dbdb3..6373f8df19c 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart03/libthreadstart03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart03/libthreadstart03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,11 +35,11 @@ extern "C" { #define STATUS_FAILED 2 #define WAIT_TIME 1000 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jrawMonitorID wait_lock; -static const char *threadName = NULL; +static const char *threadName = nullptr; static int startsCount = 0; static int startsExpected = 0; static int endsCount = 0; @@ -57,7 +57,7 @@ void JNICALL ThreadStart(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { LOG(">>> start: %s\n", inf.name); - if (inf.name != NULL && strcmp(inf.name, threadName) == 0) { + if (inf.name != nullptr && strcmp(inf.name, threadName) == 0) { startsCount++; } } @@ -74,7 +74,7 @@ void JNICALL ThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { LOG(">>> end: %s\n", inf.name); - if (inf.name != NULL && strcmp(inf.name, threadName) == 0) { + if (inf.name != nullptr && strcmp(inf.name, threadName) == 0) { endsCount++; } } @@ -84,7 +84,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -110,20 +110,20 @@ JNIEXPORT jint JNICALL Java_threadstart03_check(JNIEnv *jni, jclass cls, jthread thr, jstring name) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } - threadName = jni->GetStringUTFChars(name, NULL); - if (threadName == NULL) { + threadName = jni->GetStringUTFChars(name, nullptr); + if (threadName == nullptr) { LOG("Failed to copy UTF-8 string!\n"); return STATUS_FAILED; } wait_lock = create_raw_monitor(jvmti, "_wait_lock"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); if (err == JVMTI_ERROR_NONE) { startsExpected = 1; } else { @@ -131,7 +131,7 @@ Java_threadstart03_check(JNIEnv *jni, jclass cls, jthread thr, jstring name) { result = STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, nullptr); if (err == JVMTI_ERROR_NONE) { endsExpected = 1; } else { @@ -143,7 +143,7 @@ Java_threadstart03_check(JNIEnv *jni, jclass cls, jthread thr, jstring name) { { RawMonitorLocker wait_locker(jvmti, jni, wait_lock); - err = jvmti->RunAgentThread(thr, threadProc, NULL, JVMTI_THREAD_MAX_PRIORITY); + err = jvmti->RunAgentThread(thr, threadProc, nullptr, JVMTI_THREAD_MAX_PRIORITY); if (err != JVMTI_ERROR_NONE) { LOG("(RunAgentThread) unexpected error: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; @@ -164,13 +164,13 @@ Java_threadstart03_check(JNIEnv *jni, jclass cls, jthread thr, jstring name) { } - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_THREAD_END: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/VMObjectAlloc/vmobjalloc01/libvmobjalloc01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/VMObjectAlloc/vmobjalloc01/libvmobjalloc01.cpp index 24cef0250c5..46006b00ad4 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/VMObjectAlloc/vmobjalloc01/libvmobjalloc01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/VMObjectAlloc/vmobjalloc01/libvmobjalloc01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,10 +65,10 @@ VMObjectAlloc(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jobject object, jcla LOG("VMObjectAlloc: \"%s\", size=%ld\n", signature, (long)size); - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); - if (generic != NULL) + if (generic != nullptr) jvmti->Deallocate((unsigned char*)generic); } @@ -92,7 +92,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; jvmtiError err; @@ -103,7 +103,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -127,12 +127,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* enable VMObjectAlloc event */ - if (jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL) != JVMTI_ERROR_NONE) { + if (jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, nullptr) != JVMTI_ERROR_NONE) { return JNI_ERR; } /* register agent proc and arg */ - set_agent_proc(agentProc, NULL); + set_agent_proc(agentProc, nullptr); return JNI_OK; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/GetAllThreadsNullTest/libGetAllThreadsNullTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/GetAllThreadsNullTest/libGetAllThreadsNullTest.cpp index 2c665df4f27..1231a9e1ce1 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/GetAllThreadsNullTest/libGetAllThreadsNullTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/GetAllThreadsNullTest/libGetAllThreadsNullTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,12 +28,12 @@ extern "C" { -static jvmtiEnv *jvmti_env = NULL; +static jvmtiEnv *jvmti_env = nullptr; JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti_env == NULL) { + if (res != JNI_OK || jvmti_env == nullptr) { LOG("Wrong test_passed of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -48,14 +48,14 @@ Java_GetAllThreadsNullTest_check(JNIEnv *env, jclass cls) { jthread *threadsPtr; jboolean test_passed = JNI_TRUE; - if (jvmti_env == NULL) { + if (jvmti_env == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return JNI_FALSE; } LOG(">>> (threadsCountPtr) null pointer check ...\n"); - err = jvmti_env->GetAllThreads(NULL, &threadsPtr); + err = jvmti_env->GetAllThreads(nullptr, &threadsPtr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("(threadsCountPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); LOG(" got: %s (%d)\n", TranslateError(err), err); @@ -64,14 +64,14 @@ Java_GetAllThreadsNullTest_check(JNIEnv *env, jclass cls) { LOG(">>> (threadsPtr) null pointer check ...\n"); - err = jvmti_env->GetAllThreads(&threadsCountPtr, NULL); + err = jvmti_env->GetAllThreads(&threadsCountPtr, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("(threadsPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); LOG(" got: %s (%d)\n", TranslateError(err), err); test_passed = JNI_FALSE; } - err = jvmti_env->GetAllThreads(NULL, NULL); + err = jvmti_env->GetAllThreads(nullptr, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("(threadsPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); LOG(" got: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/contmon03/libcontmon03.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/contmon03/libcontmon03.cpp index 35e6f859afd..f9188a371ff 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/contmon03/libcontmon03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/contmon03/libcontmon03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; JNIEXPORT jint JNICALL @@ -42,7 +42,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiCapabilities caps; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -64,7 +64,7 @@ Java_contmon03_check(JNIEnv *env, jclass cls, jthread thread) { jvmtiError err; jobject monitor; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -80,7 +80,7 @@ Java_contmon03_check(JNIEnv *env, jclass cls, jthread thread) { LOG(">>> null pointer check ...\n"); - err = jvmti->GetCurrentContendedMonitor(thread, NULL); + err = jvmti->GetCurrentContendedMonitor(thread, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); LOG(" got: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt02/libframecnt02.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt02/libframecnt02.cpp index f8d76a2f882..0b4286991f7 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt02/libframecnt02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt02/libframecnt02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; JNIEXPORT jint JNICALL @@ -40,7 +40,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -54,7 +54,7 @@ Java_framecnt02_checkFrames(JNIEnv *env, jclass cls, jthread thr, jint thr_num) jint frameCount; if (thr_num == 0) { - err = jvmti->GetFrameCount(thr, NULL); + err = jvmti->GetFrameCount(thr, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("Error expected: JVMTI_ERROR_NULL_POINTER, got: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt03/libframecnt03.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt03/libframecnt03.cpp index 74769bb29f5..b72c7b87ab1 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt03/libframecnt03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt03/libframecnt03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; JNIEXPORT jint JNICALL @@ -40,7 +40,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -53,7 +53,7 @@ Java_framecnt03_check(JNIEnv *env, jclass cls) { jvmtiError err; jint countPtr; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/frameloc03/libframeloc03.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/frameloc03/libframeloc03.cpp index 631ad8d383f..b763d0433ee 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/frameloc03/libframeloc03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/frameloc03/libframeloc03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -43,12 +43,12 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -84,7 +84,7 @@ Java_frameloc03_check(JNIEnv *env, jclass cls, jthread thr) { jmethodID mid; jlocation loc; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -123,7 +123,7 @@ Java_frameloc03_check(JNIEnv *env, jclass cls, jthread thr) { if (printdump == JNI_TRUE) { LOG(">>> (methodPtr) null pointer check ...\n"); } - err = jvmti->GetFrameLocation(thr, 0, NULL, &loc); + err = jvmti->GetFrameLocation(thr, 0, nullptr, &loc); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); LOG(" actual: %s (%d)\n", TranslateError(err), err); @@ -133,7 +133,7 @@ Java_frameloc03_check(JNIEnv *env, jclass cls, jthread thr) { if (printdump == JNI_TRUE) { LOG(">>> (locationPtr) null pointer check ...\n"); } - err = jvmti->GetFrameLocation(thr, 0, &mid, NULL); + err = jvmti->GetFrameLocation(thr, 0, &mid, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); LOG(" actual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr02/libgetstacktr02.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr02/libgetstacktr02.cpp index 061b717af37..b12b322bba4 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr02/libgetstacktr02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr02/libgetstacktr02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -40,12 +40,12 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -59,7 +59,7 @@ Java_getstacktr02_check(JNIEnv *env, jclass cls, jthread thread) { jvmtiFrameInfo frame; jint count; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -85,7 +85,7 @@ Java_getstacktr02_check(JNIEnv *env, jclass cls, jthread thread) { if (printdump == JNI_TRUE) { LOG(">>> (stack_buffer) null pointer check ...\n"); } - err = jvmti->GetStackTrace(thread, 0, 1, NULL, &count); + err = jvmti->GetStackTrace(thread, 0, 1, nullptr, &count); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("(stack_buffer) error expected: JVMTI_ERROR_NULL_POINTER,"); LOG(" got: %s (%d)\n", TranslateError(err), err); @@ -95,7 +95,7 @@ Java_getstacktr02_check(JNIEnv *env, jclass cls, jthread thread) { if (printdump == JNI_TRUE) { LOG(">>> (count_ptr) null pointer check ...\n"); } - err = jvmti->GetStackTrace(thread, 0, 1, &frame, NULL); + err = jvmti->GetStackTrace(thread, 0, 1, &frame, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("(count_ptr) error expected: JVMTI_ERROR_NULL_POINTER,"); LOG(" got: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr09/libgetstacktr09.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr09/libgetstacktr09.cpp index f9b6e4dd077..bdac7128c3b 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr09/libgetstacktr09.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr09/libgetstacktr09.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -40,12 +40,12 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -59,7 +59,7 @@ Java_getstacktr09_check(JNIEnv *env, jclass cls, jthread thread1, jthread thread jvmtiFrameInfo frame; jint count; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/thrinfo02/libthrinfo02.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/thrinfo02/libthrinfo02.cpp index 8c47aaa7f4b..6ab0c456704 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/thrinfo02/libthrinfo02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/thrinfo02/libthrinfo02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -40,12 +40,12 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -58,7 +58,7 @@ Java_thrinfo02_check(JNIEnv *env, jclass cls, jthread thr, jthreadGroup group) { jvmtiError err; jvmtiThreadInfo inf; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -66,14 +66,14 @@ Java_thrinfo02_check(JNIEnv *env, jclass cls, jthread thr, jthreadGroup group) { if (printdump == JNI_TRUE) { LOG(">>> invalid thread check ...\n"); } - err = jvmti->GetThreadInfo(NULL, &inf); + err = jvmti->GetThreadInfo(nullptr, &inf); if (err != JVMTI_ERROR_NONE) { LOG("Error expected: JVMTI_ERROR_NONE,\n"); LOG(" got: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; } - if (inf.name == NULL || strcmp(inf.name, "main")) { + if (inf.name == nullptr || strcmp(inf.name, "main")) { LOG("Thread %s: incorrect name: %s\n", "main", inf.name); result = STATUS_FAILED; } @@ -93,7 +93,7 @@ Java_thrinfo02_check(JNIEnv *env, jclass cls, jthread thr, jthreadGroup group) { if (printdump == JNI_TRUE) { LOG(">>> null pointer check ...\n"); } - err = jvmti->GetThreadInfo(thr, NULL); + err = jvmti->GetThreadInfo(thr, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); LOG(" got: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/thrstat04/libthrstat04.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/thrstat04/libthrstat04.cpp index 05baab36d51..b63e84d0c49 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/thrstat04/libthrstat04.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/thrstat04/libthrstat04.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -40,12 +40,12 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -58,7 +58,7 @@ Java_thrstat04_check(JNIEnv *env, jclass cls, jthread thr) { jvmtiError err; jint thrState; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -66,7 +66,7 @@ Java_thrstat04_check(JNIEnv *env, jclass cls, jthread thr) { if (printdump == JNI_TRUE) { LOG(">>> (threadStatePtr) null pointer check ...\n"); } - err = jvmti->GetThreadState(thr, NULL); + err = jvmti->GetThreadState(thr, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("(threadStatePtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); LOG(" got: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/NotSuspended/libGetStackTraceNotSuspendedStress.cpp b/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/NotSuspended/libGetStackTraceNotSuspendedStress.cpp index 12e685b3714..ee2dc9d2859 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/NotSuspended/libGetStackTraceNotSuspendedStress.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/NotSuspended/libGetStackTraceNotSuspendedStress.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ const char CONTINUATION_METHOD_NAME[] = "enter"; static void test_stack_trace(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) { jvmtiFrameInfo frames[MAX_FRAME_COUNT]; jint count = -1; - jmethodID method = NULL; + jmethodID method = nullptr; jvmtiError err; err = jvmti->GetStackTrace(vthread, 0, MAX_FRAME_COUNT, frames, &count); @@ -78,7 +78,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { LOG("Agent: started\n"); while (true) { - jthread *threads = NULL; + jthread *threads = nullptr; jint count = 0; jvmtiError err; @@ -90,7 +90,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { } check_jvmti_status(jni, err, "Error in JVMTI GetAllThreads"); for (int i = 0; i < count; i++) { - jthread tested_thread = NULL; + jthread tested_thread = nullptr; err = GetVirtualThread(jvmti, jni, threads[i], &tested_thread); if (err == JVMTI_ERROR_THREAD_NOT_ALIVE) { @@ -100,7 +100,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { return; } check_jvmti_status(jni, err, "Error in JVMTI extension GetVirtualThread"); - if (tested_thread != NULL) { + if (tested_thread != nullptr) { test_stack_trace(jvmti, jni, tested_thread); } } @@ -132,7 +132,7 @@ extern JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *res return JNI_ERR; } - if (set_agent_proc(agentProc, NULL) != JNI_TRUE) { + if (set_agent_proc(agentProc, nullptr) != JNI_TRUE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/Suspended/libGetStackTraceSuspendedStress.cpp b/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/Suspended/libGetStackTraceSuspendedStress.cpp index 65e79fb33f2..639b40d4839 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/Suspended/libGetStackTraceSuspendedStress.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/Suspended/libGetStackTraceSuspendedStress.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,13 +31,13 @@ static const char CONTINUATION_CLASS_NAME[] = "jdk/internal/vm/Continuation"; static const char CONTINUATION_METHOD_NAME[] = "enter"; -static jrawMonitorID event_mon = NULL; +static jrawMonitorID event_mon = nullptr; static void test_stack_trace(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) { jvmtiFrameInfo frames[MAX_FRAME_COUNT]; jint count = -1; - jmethodID method = NULL; + jmethodID method = nullptr; jvmtiError err; err = jvmti->GetStackTrace(vthread, 0, MAX_FRAME_COUNT, frames, &count); @@ -93,7 +93,7 @@ check_link_consistency(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) { fatal(jni, "Carrier thread is NOT expected to be suspended"); } - if (cthread != NULL) { + if (cthread != nullptr) { jthread cthread_to_vthread = get_virtual_thread(jvmti, jni, cthread); if (!jni->IsSameObject(vthread, cthread_to_vthread)) { @@ -118,12 +118,12 @@ check_vthread_consistency_suspended(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthrea jni->FatalError("Agent: check_vthread_consistency_suspended: vthread is expected to be virtual"); } jthread cthread = get_carrier_thread(jvmti, jni, vthread); - //const char* cname = (cthread == NULL) ? "" : get_thread_name(jvmti, jni, cthread); + //const char* cname = (cthread == nullptr) ? "" : get_thread_name(jvmti, jni, cthread); err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, vthread); check_jvmti_status(jni, err, "Error in JVMTI SetEventNotificationMode: enable SINGLE_STEP"); - if (cthread != NULL) { // pre-condition for reliable testing + if (cthread != nullptr) { // pre-condition for reliable testing test_stack_trace(jvmti, jni, vthread); check_link_consistency(jvmti, jni, vthread); } @@ -145,7 +145,7 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, print_stack_trace(jvmti, jni, thread); jthread cthread = get_carrier_thread(jvmti, jni, thread); - if (cthread != NULL) { + if (cthread != nullptr) { print_stack_trace(jvmti, jni, cthread); } @@ -170,7 +170,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { int iter = 0; while (true) { - jthread *threads = NULL; + jthread *threads = nullptr; jint count = 0; jvmtiError err; @@ -182,7 +182,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { for (int i = 0; i < count; i++) { jthread cthread = threads[i]; - jthread vthread = NULL; + jthread vthread = nullptr; err = GetVirtualThread(jvmti, jni, cthread, &vthread); if (err == JVMTI_ERROR_THREAD_NOT_ALIVE) { @@ -192,7 +192,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { return; } check_jvmti_status(jni, err, "Error in GetVirtualThread"); - if (iter > 50 && vthread != NULL) { + if (iter > 50 && vthread != nullptr) { // char* cname = get_thread_name(jvmti, jni, cthread); // char* vname = get_thread_name(jvmti, jni, vthread); @@ -256,7 +256,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (set_agent_proc(agentProc, NULL) != JNI_TRUE) { + if (set_agent_proc(agentProc, nullptr) != JNI_TRUE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/stress/ThreadLocalStorage/SetGetThreadLocalStorageStressTest/libSetGetThreadLocalStorageStress.cpp b/test/hotspot/jtreg/serviceability/jvmti/stress/ThreadLocalStorage/SetGetThreadLocalStorageStressTest/libSetGetThreadLocalStorageStress.cpp index 43ddccc84a4..1c09fac92ba 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/stress/ThreadLocalStorage/SetGetThreadLocalStorageStressTest/libSetGetThreadLocalStorageStress.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/stress/ThreadLocalStorage/SetGetThreadLocalStorageStressTest/libSetGetThreadLocalStorageStress.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,15 +48,15 @@ StorageStructure* check_tls(jvmtiEnv * jvmti, JNIEnv * jni, jthread thread, cons jvmtiError err = jvmti->GetThreadLocalStorage(thread, (void **) &storage); if (err == JVMTI_ERROR_THREAD_NOT_ALIVE) { - return NULL; + return nullptr; } check_jvmti_status(jni, err, "Error in GetThreadLocalStorage"); LOG("Check %s with %p in %s\n", thread_info.name, storage, source); - if (storage == NULL) { + if (storage == nullptr) { // Might be not set - return NULL; + return nullptr; } if (storage->self_pointer != storage || (strcmp(thread_info.name, storage->data) != 0)) { @@ -71,12 +71,12 @@ StorageStructure* check_tls(jvmtiEnv * jvmti, JNIEnv * jni, jthread thread, cons void check_delete_tls(jvmtiEnv * jvmti, JNIEnv * jni, jthread thread, const char* source) { StorageStructure *storage = check_tls(jvmti, jni, thread, source); - if (storage == NULL) { + if (storage == nullptr) { return; } check_jvmti_status(jni, jvmti->Deallocate((unsigned char *)storage), "Deallocation failed."); - jvmtiError err = jvmti->SetThreadLocalStorage(thread, NULL); + jvmtiError err = jvmti->SetThreadLocalStorage(thread, nullptr); if (err == JVMTI_ERROR_THREAD_NOT_ALIVE) { return; } @@ -125,7 +125,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { LOG("Started.....\n"); while (true) { - jthread *threads = NULL; + jthread *threads = nullptr; jint count = 0; sleep_ms(10); @@ -136,7 +136,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { } check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), "Error in GetAllThreads"); for (int i = 0; i < count; i++) { - jthread testedThread = NULL; + jthread testedThread = nullptr; jvmtiError err; err = GetVirtualThread(jvmti, jni, threads[i], &testedThread); @@ -145,7 +145,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { } check_jvmti_status(jni, err, "Error in GetVirtualThread"); - if (testedThread == NULL) { + if (testedThread == nullptr) { testedThread = threads[i]; continue; } @@ -205,7 +205,7 @@ VirtualThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv * jvmti = NULL; + jvmtiEnv * jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -213,7 +213,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -250,19 +250,19 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL); - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_END, NULL); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, nullptr); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_END, nullptr); err = init_agent_data(jvmti, &agent_data); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - if (set_agent_proc(agentProc, NULL) != JNI_TRUE) { + if (set_agent_proc(agentProc, nullptr) != JNI_TRUE) { return JNI_ERR; } return JNI_OK; diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetAllThreads/allthr01/liballthr01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetAllThreads/allthr01/liballthr01.cpp index 1b3079c6e30..11ad6440928 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetAllThreads/allthr01/liballthr01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetAllThreads/allthr01/liballthr01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -93,7 +93,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti_env == NULL) { + if (res != JNI_OK || jvmti_env == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -162,7 +162,7 @@ JNIEXPORT void Java_allthr01_startAgentThread(JNIEnv *jni) { RawMonitorLocker rml1 = RawMonitorLocker(jvmti_env, jni, starting_agent_thread_lock); jvmtiError err = jvmti_env->RunAgentThread(create_jthread(jni), - sys_thread, NULL,JVMTI_THREAD_NORM_PRIORITY); + sys_thread, nullptr,JVMTI_THREAD_NORM_PRIORITY); check_jvmti_status(jni, err, "Failed to run AgentThread"); rml1.wait(); LOG("Started Agent Thread\n"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon01/libcontmon01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon01/libcontmon01.cpp index 4e9ef9a9c91..e3d95e113a0 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon01/libcontmon01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon01/libcontmon01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,13 +29,13 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -54,7 +54,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_contmon01_checkMonitor(JNIEnv *jni, jclass cls, jint point, jthread thread, jobject lock) { - jobject monitor = NULL; + jobject monitor = nullptr; jvmtiError err = jvmti->GetCurrentContendedMonitor(thread, &monitor); if (err == JVMTI_ERROR_THREAD_NOT_ALIVE && point == 5) { diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon02/libcontmon02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon02/libcontmon02.cpp index dbbc63c57cd..65a2211a004 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon02/libcontmon02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon02/libcontmon02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -56,7 +56,7 @@ Java_contmon02_checkMonitor(JNIEnv *jni, jclass cls, jint point, jthread thread) jobject monitor; jvmtiError err = jvmti->GetCurrentContendedMonitor(thread, &monitor); check_jvmti_status(jni, err, "Error in GetCurrentContendedMonitor"); - if (monitor != NULL) { + if (monitor != nullptr) { LOG("(#%d) unexpected monitor object: 0x%p\n", point, monitor); fatal(jni, "GetCurrentContendedMonitor return unexpected monitor."); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameCount/framecnt01/libframecnt01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameCount/framecnt01/libframecnt01.cpp index fc5319fa9c7..c9dd399138a 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameCount/framecnt01/libframecnt01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameCount/framecnt01/libframecnt01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ extern "C" { -static jvmtiEnv *jvmti_env = NULL; +static jvmtiEnv *jvmti_env = nullptr; JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { @@ -35,7 +35,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti_env == NULL) { + if (res != JNI_OK || jvmti_env == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc01/libframeloc01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc01/libframeloc01.cpp index bc4a81e8ab1..89855a8d66e 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc01/libframeloc01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc01/libframeloc01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti_env = NULL; +static jvmtiEnv *jvmti_env = nullptr; static jint result = PASSED; static jmethodID mid1; @@ -40,7 +40,7 @@ static jmethodID mid1; jboolean checkFrame(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thr, jmethodID exp_mid, jlocation exp_loc, jlocation exp_loc_alternative, jboolean mustPass) { jvmtiError err; - jmethodID mid = NULL; + jmethodID mid = nullptr; jlocation loc = -1; char *meth, *sig, *generic; jboolean isOk = JNI_FALSE; @@ -88,7 +88,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti_env == NULL) { + if (res != JNI_OK || jvmti_env == nullptr) { LOG("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -115,13 +115,13 @@ JNIEXPORT void JNICALL Java_frameloc01_getReady(JNIEnv *jni, jclass cls, jclass klass) { jvmtiError err; mid1 = jni->GetMethodID(klass, "meth01", "(I)V"); - if (mid1 == NULL) { + if (mid1 == nullptr) { LOG("Cannot get jmethodID for method \"meth01\"\n"); result = STATUS_FAILED; return; } - err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL); + err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; @@ -134,7 +134,7 @@ Java_frameloc01_checkFrame01(JNIEnv *jni, jclass cls, jthread thr, jclass klass, jboolean isOk = JNI_FALSE; mid = jni->GetMethodID(klass, "run", "()V"); - if (mid == NULL) { + if (mid == nullptr) { LOG("Cannot get jmethodID for method \"run\"\n"); result = STATUS_FAILED; return JNI_TRUE; diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc02/libframeloc02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc02/libframeloc02.cpp index 46724b12e9f..53e9378fc8d 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc02/libframeloc02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc02/libframeloc02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ typedef struct { jlocation loc; } frame_info; -static jvmtiEnv *jvmti_env = NULL; +static jvmtiEnv *jvmti_env = nullptr; static jint result = PASSED; static frame_info fi = {"Lframeloc02;", "check", @@ -47,7 +47,7 @@ static frame_info fi = JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti_env == NULL) { + if (res != JNI_OK || jvmti_env == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -98,17 +98,17 @@ Java_frameloc02_check(JNIEnv *env, jclass cls, jthread thr) { LOG(">>> method: \"%s%s\"\n", name, sig); LOG(">>> location: %s\n", jlong_to_string(loc, buffer)); - if (cls_sig == NULL || strcmp(cls_sig, fi.cls_sig) != 0) { + if (cls_sig == nullptr || strcmp(cls_sig, fi.cls_sig) != 0) { LOG("(GetFrameLocation) wrong class: \"%s\"\n", cls_sig); LOG(", expected: \"%s\"\n", fi.cls_sig); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, fi.name) != 0) { + if (name == nullptr || strcmp(name, fi.name) != 0) { LOG("(GetFrameLocation) wrong method name: \"%s\"", name); LOG(", expected: \"%s\"\n", fi.name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, fi.sig) != 0) { + if (sig == nullptr || strcmp(sig, fi.sig) != 0) { LOG("(GetFrameLocation) wrong method signature: \"%s\"", sig); LOG(", expected: \"%s\"\n", fi.sig); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceAndRetransformTest/libGetStackTraceAndRetransformTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceAndRetransformTest/libGetStackTraceAndRetransformTest.cpp index 3be6dcf824f..8968a6cc57d 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceAndRetransformTest/libGetStackTraceAndRetransformTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceAndRetransformTest/libGetStackTraceAndRetransformTest.cpp @@ -30,14 +30,14 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; -static jmethodID* ids = NULL; +static jvmtiEnv *jvmti = nullptr; +static jmethodID* ids = nullptr; static int ids_size = 0; JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -71,11 +71,11 @@ Java_GetStackTraceAndRetransformTest_check(JNIEnv *jni, jclass cls, jint expecte exit(2); } for (int i = 0; i < ids_size; i++) { - jclass rslt = NULL; - char* class_name = NULL; + jclass rslt = nullptr; + char* class_name = nullptr; jvmti->GetMethodDeclaringClass(ids[i], &rslt); - if (rslt != NULL) { - jvmti->GetClassSignature(rslt, &class_name, NULL); + if (rslt != nullptr) { + jvmti->GetClassSignature(rslt, &class_name, nullptr); } } } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceCurrentThreadTest/libGetStackTraceCurrentThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceCurrentThreadTest/libGetStackTraceCurrentThreadTest.cpp index deb494dd0aa..36e8663bb86 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceCurrentThreadTest/libGetStackTraceCurrentThreadTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceCurrentThreadTest/libGetStackTraceCurrentThreadTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static frame_info expected_virtual_frames[] = { {"LGetStackTraceCurrentThreadTest;", "check", "(Ljava/lang/Thread;)V"}, {"LGetStackTraceCurrentThreadTest;", "dummy", "()V"}, @@ -52,7 +52,7 @@ static frame_info expected_platform_frames[] = { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr03/libgetstacktr03.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr03/libgetstacktr03.cpp index dc4d75be86f..a0ae45613d2 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr03/libgetstacktr03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr03/libgetstacktr03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static frame_info expected_platform_frames[] = { {"Ljava/lang/Object;", "wait", "()V"}, {"Lgetstacktr03;", "dummy", "()V"}, @@ -55,7 +55,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr04/libgetstacktr04.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr04/libgetstacktr04.cpp index 873522ab531..9ef19122ec1 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr04/libgetstacktr04.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr04/libgetstacktr04.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jmethodID mid; static frame_info expected_platform_frames[] = { {"Lgetstacktr04$TestThread;", "checkPoint", "()V"}, @@ -80,7 +80,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -108,12 +108,12 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_getstacktr04_getReady(JNIEnv *jni, jclass cls, jclass clazz) { mid = jni->GetMethodID(clazz, "checkPoint", "()V"); - if (mid == NULL) { + if (mid == nullptr) { jni->FatalError("Cannot find Method ID for method checkPoint\n"); } check_jvmti_status(jni, jvmti->SetBreakpoint(mid, 0), "SetBreakpoint failed."); - set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, nullptr); } } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr05/libgetstacktr05.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr05/libgetstacktr05.cpp index 0cb2992b646..062e4b679e3 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr05/libgetstacktr05.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr05/libgetstacktr05.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jmethodID mid; @@ -102,7 +102,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -132,11 +132,11 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_getstacktr05_getReady(JNIEnv *jni, jclass cls, jclass clazz) { mid = jni->GetMethodID(clazz, "checkPoint", "()V"); - if (mid == NULL) { + if (mid == nullptr) { jni->FatalError("Cannot find Method ID for method checkPoint\n"); } check_jvmti_status(jni, jvmti->SetBreakpoint(mid, 0), "SetBreakpoint failed."); - set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, nullptr); } } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr06/libgetstacktr06.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr06/libgetstacktr06.cpp index 0fd52c697f4..e72dc0c171f 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr06/libgetstacktr06.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr06/libgetstacktr06.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jmethodID mid; @@ -67,7 +67,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thr, jmethodID } check_jvmti_status(jni, jvmti->ClearBreakpoint(mid, 0), "ClearBreakpoint failed."); - set_event_notification_mode(jvmti, jni, JVMTI_DISABLE,JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, jni, JVMTI_DISABLE,JVMTI_EVENT_BREAKPOINT, nullptr); set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thr); LOG(">>> popping frame ...\n"); @@ -92,7 +92,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -128,12 +128,12 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_getstacktr06_getReady(JNIEnv *jni, jclass cls, jclass clazz) { mid = jni->GetMethodID(clazz, "checkPoint", "()V"); - if (mid == NULL) { + if (mid == nullptr) { jni->FatalError("Cannot find Method ID for method checkPoint\n"); } check_jvmti_status(jni, jvmti->SetBreakpoint(mid, 0), "SetBreakpoint failed."); - set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, nullptr); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr07/libgetstacktr07.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr07/libgetstacktr07.cpp index a422fc0782f..2c3af86c5e5 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr07/libgetstacktr07.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr07/libgetstacktr07.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -73,7 +73,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread, jmetho jni->FatalError("ERROR: don't know where we get called from"); } - if (classBytes == NULL) { + if (classBytes == nullptr) { jni->FatalError("ERROR: don't have any bytes"); } @@ -83,11 +83,11 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread, jmetho class_def.klass = klass; class_def.class_byte_count = jni->GetArrayLength(classBytes); - class_def.class_bytes = (unsigned char *) jni->GetByteArrayElements(classBytes, NULL); + class_def.class_bytes = (unsigned char *) jni->GetByteArrayElements(classBytes, nullptr); check_jvmti_status(jni, jvmti->RedefineClasses(1, &class_def), "RedefineClasses failed."); jni->DeleteGlobalRef(classBytes); - classBytes = NULL; + classBytes = nullptr; frame_info *expected_frames = jni->IsVirtualThread(thread) ? expected_virtual_frames @@ -105,7 +105,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -137,12 +137,12 @@ Java_getstacktr07_getReady(JNIEnv *jni, jclass cls, jclass clazz, jbyteArray byt classBytes = (jbyteArray) jni->NewGlobalRef(bytes); mid = jni->GetMethodID(clazz, "checkPoint", "()V"); - if (mid == NULL) { + if (mid == nullptr) { jni->FatalError("Cannot find Method ID for method checkPoint\n"); } check_jvmti_status(jni, jvmti->SetBreakpoint(mid, 0), "SetBreakpoint failed."); - set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr08/libgetstacktr08.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr08/libgetstacktr08.cpp index 977bbf00b04..8b293a9e559 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr08/libgetstacktr08.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr08/libgetstacktr08.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jboolean wasFramePop = JNI_FALSE; static jmethodID mid_checkPoint, mid_chain4; @@ -116,7 +116,7 @@ void JNICALL SingleStep(jvmtiEnv *jvmti_env, JNIEnv *jni, } - if (classBytes == NULL) { + if (classBytes == nullptr) { jni->FatalError("ERROR: don't have any bytes"); } @@ -125,11 +125,11 @@ void JNICALL SingleStep(jvmtiEnv *jvmti_env, JNIEnv *jni, classDef.klass = klass; classDef.class_byte_count = jni->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) jni->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) jni->GetByteArrayElements(classBytes, nullptr); check_jvmti_status(jni, jvmti_env->RedefineClasses(1, &classDef), "RedefineClasses failed."); jni->DeleteGlobalRef(classBytes); - classBytes = NULL; + classBytes = nullptr; if (!compare_stack_trace(jvmti_env, jni, thread, 2)) { jni->ThrowNew(jni->FindClass("java/lang/RuntimeException"), "Stacktrace differs from expected."); } @@ -140,7 +140,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -176,12 +176,12 @@ Java_getstacktr08_getReady(JNIEnv *jni, jclass cls, jclass clazz, jbyteArray byt mid_chain4 = jni->GetStaticMethodID(clazz, "chain4", "()V"); check_jvmti_status(jni, jvmti->SetBreakpoint(mid_checkPoint, 0), "SetBreakpoint failed."); - set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); } JNIEXPORT void JNICALL Java_getstacktr08_nativeChain(JNIEnv *jni, jclass cls, jclass clazz) { - if (mid_chain4 != NULL) { + if (mid_chain4 != nullptr) { jni->CallStaticVoidMethod(clazz, mid_chain4); } if (!compare_stack_trace(jvmti, jni, get_current_thread(jvmti, jni), 3)) { diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadInfo/thrinfo01/libthrinfo01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadInfo/thrinfo01/libthrinfo01.cpp index 53f10cb7d5c..e040b88ba88 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadInfo/thrinfo01/libthrinfo01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadInfo/thrinfo01/libthrinfo01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ typedef struct { jboolean is_daemon; } info; -static jvmtiEnv *jvmti_env = NULL; +static jvmtiEnv *jvmti_env = nullptr; static info expected_info_array[] = { {"main", JNI_TRUE,JVMTI_THREAD_NORM_PRIORITY, JNI_FALSE}, {"thread1",JNI_TRUE,JVMTI_THREAD_MIN_PRIORITY + 2, JNI_TRUE}, @@ -49,7 +49,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiCapabilities caps; res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti_env == NULL) { + if (res != JNI_OK || jvmti_env == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -75,8 +75,8 @@ Java_thrinfo01_checkInfo0(JNIEnv *jni, jclass cls, jthread thread, jthreadGroup info expected_info = expected_info_array[expected_idx]; check_jvmti_status(jni, jvmti_env->GetThreadInfo(thread, &inf), "Error in GetThreadInfo."); - if (inf.name == NULL) { - LOG("Thread %s: incorrect name in NULL\n", expected_info.name); + if (inf.name == nullptr) { + LOG("Thread %s: incorrect name in null\n", expected_info.name); result = JNI_FALSE; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat01/libthrstat01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat01/libthrstat01.cpp index 825ac1ffd75..4d54648a73f 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat01/libthrstat01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat01/libthrstat01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,11 +31,11 @@ extern "C" { #define WAIT_START 100 #define WAIT_TIME (2*60*1000) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jrawMonitorID access_lock; static jrawMonitorID wait_lock; -static jthread tested_thread_thr1 = NULL; +static jthread tested_thread_thr1 = nullptr; static jint state[] = { JVMTI_THREAD_STATE_RUNNABLE, @@ -45,9 +45,9 @@ static jint state[] = { void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thr) { - jvmtiError err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); + jvmtiError err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); check_jvmti_status(jni, err, "Error in SetEventNotificationMode"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); check_jvmti_status(jni, err, "Error in SetEventNotificationMode"); } @@ -58,7 +58,7 @@ ThreadStart(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread) { jvmtiThreadInfo thread_info = get_thread_info(jvmti, jni, thread); LOG(">>> ThreadStart: \"%s\"\n", thread_info.name); - if (thread_info.name != NULL && strcmp(thread_info.name, "tested_thread_thr1") == 0) { + if (thread_info.name != nullptr && strcmp(thread_info.name, "tested_thread_thr1") == 0) { tested_thread_thr1 = jni->NewGlobalRef(thread); LOG(">>> ThreadStart: \"%s\", 0x%p\n", thread_info.name, tested_thread_thr1); } @@ -72,7 +72,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { LOG("Agent_OnLoad started\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -101,7 +101,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); return JNI_ERR; @@ -117,7 +117,7 @@ Java_thrstat01_checkStatus0(JNIEnv *jni, jclass cls, jint stat_ind) { LOG("native method checkStatus started\n"); - if (tested_thread_thr1 == NULL) { + if (tested_thread_thr1 == nullptr) { LOG("Missing thread \"tested_thread_thr1\" start event\n"); return JNI_FALSE; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat02/libthrstat02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat02/libthrstat02.cpp index 0de51f8e5cf..588b2268f6d 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat02/libthrstat02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat02/libthrstat02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,9 +30,9 @@ extern "C" { #define WAIT_START 100 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jrawMonitorID access_lock, wait_lock; -static jthread thr_ptr = NULL; +static jthread thr_ptr = nullptr; static jint wait_time = 0; static jint state[] = { JVMTI_THREAD_STATE_RUNNABLE, @@ -55,7 +55,7 @@ void printStateFlags(jint flags) { void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thr) { - jvmtiError err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); + jvmtiError err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); check_jvmti_status(jni, err, "Failed to enable THREAD_START event"); } @@ -63,7 +63,7 @@ void JNICALL ThreadStart(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread) { RawMonitorLocker rml = RawMonitorLocker(jvmti, jni, access_lock); jvmtiThreadInfo thread_info = get_thread_info(jvmti_env, jni, thread); - if (thread_info.name != NULL && strcmp(thread_info.name, "tested_thread_thr1") == 0) { + if (thread_info.name != nullptr && strcmp(thread_info.name, "tested_thread_thr1") == 0) { thr_ptr = jni->NewGlobalRef(thread); LOG(">>> ThreadStart: \"%s\", 0x%p\n", thread_info.name, thr_ptr); } @@ -77,7 +77,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -103,7 +103,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable VM_INIT event: %s (%d)\n", TranslateError(err), err); return JNI_ERR; @@ -135,12 +135,12 @@ Java_thrstat02_checkStatus0(JNIEnv *jni, jclass cls, jint statInd, jboolean susp jboolean timeout_is_reached; unsigned int waited_millis; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return JNI_FALSE; } - if (thr_ptr == NULL) { + if (thr_ptr == nullptr) { LOG("Missing thread \"tested_thread_thr1\" start event\n"); return JNI_FALSE; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat03/libthrstat03.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat03/libthrstat03.cpp index 632d4136e35..36a632ff32c 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat03/libthrstat03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat03/libthrstat03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ extern "C" { #define WAIT_START 100 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint wait_time = 0; static jint state[] = { 0, /* JVMTI_THREAD_STATUS_NOT_STARTED, */ @@ -46,7 +46,7 @@ Java_thrstat03_init(JNIEnv *env, jclass cls, jint waitTime) { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -59,7 +59,7 @@ Java_thrstat03_check(JNIEnv *jni, jclass cls, jthread thread, jint statInd) { jrawMonitorID wait_lock; jint thr_state = 0; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return JNI_FALSE; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat05/libthrstat05.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat05/libthrstat05.cpp index e96dd665f59..3fd9b535de4 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat05/libthrstat05.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat05/libthrstat05.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,7 +66,7 @@ static int g_ThreadState[] = { | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT, /* TS_RUN_WAIT_SLEEPING */ }; -static jvmtiEnv *jvmti_env = NULL; +static jvmtiEnv *jvmti_env = nullptr; static int g_wait_time = 1000; jrawMonitorID wait_lock; /* Monitor is used just for sleeping */ @@ -75,7 +75,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1); if (res != JNI_OK || !jvmti_env) { - LOG("Agent_OnLoad: Error: GetEnv returned error or NULL\n"); + LOG("Agent_OnLoad: Error: GetEnv returned error or null\n"); return JNI_ERR; } wait_lock = create_raw_monitor(jvmti_env, "beast"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd01/libresumethrd01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd01/libresumethrd01.cpp index 3e07b2aee4c..d3b2f5745b5 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd01/libresumethrd01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd01/libresumethrd01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,11 +48,11 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { /* perform testing */ { - jthread testedThread = NULL; + jthread testedThread = nullptr; LOG("Find thread: %s\n", THREAD_NAME); testedThread = find_thread_by_name(jvmti, jni, THREAD_NAME); - if (testedThread == NULL) { + if (testedThread == nullptr) { return; } LOG(" ... found thread: %p\n", (void *) testedThread); @@ -100,13 +100,13 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; timeout = 60 * 1000; LOG("Agent_OnLoad started\n"); jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -122,7 +122,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!set_agent_proc(agentProc, NULL)) { + if (!set_agent_proc(agentProc, nullptr)) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd02/libresumethrd02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd02/libresumethrd02.cpp index c9de5e4ee0d..665c1a4da93 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd02/libresumethrd02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd02/libresumethrd02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { }; static volatile int eventsReceived = 0; -static jthread testedThread = NULL; +static jthread testedThread = nullptr; /* ============================================================================= */ @@ -59,14 +59,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { LOG("Find thread: %s\n", THREAD_NAME); testedThread = find_thread_by_name(jvmti, jni,THREAD_NAME); - if (testedThread == NULL) { + if (testedThread == nullptr) { return; } LOG(" ... found thread: %p\n", (void*)testedThread); eventsReceived = 0; LOG("Enable event: %s\n", "THREAD_END"); - enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL); + enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr); LOG("Suspend thread: %p\n", (void*)testedThread); jvmtiError err = jvmti->SuspendThread(testedThread); @@ -102,7 +102,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } LOG("Disable event: %s\n", "THREAD_END"); - enable_events_notifications(jvmti, jni,JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL); + enable_events_notifications(jvmti, jni,JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr); LOG("Wait for thread to finish\n"); if (!agent_wait_for_sync(timeout)) @@ -123,7 +123,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { JNIEXPORT void JNICALL callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ - if (thread != NULL && jni->IsSameObject(testedThread, thread)) { + if (thread != nullptr && jni->IsSameObject(testedThread, thread)) { LOG(" ... received THREAD_END event for tested thread: %p\n", (void*)thread); eventsReceived++; } else { @@ -136,12 +136,12 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /** Agent library initialization. */ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; timeout = 60 * 1000; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -173,7 +173,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!set_agent_proc(agentProc, NULL)) { + if (!set_agent_proc(agentProc, nullptr)) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst01/libresumethrdlst01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst01/libresumethrdlst01.cpp index 5784ae79978..42c4a4579fe 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst01/libresumethrdlst01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst01/libresumethrdlst01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,8 +52,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthread* threads = NULL; - jvmtiError* results = NULL; + jthread* threads = nullptr; + jvmtiError* results = nullptr; LOG("Allocate threads array: %d threads\n", THREADS_COUNT); check_jvmti_status(jni, jvmti->Allocate((THREADS_COUNT * sizeof(jthread)), (unsigned char**)&threads), ""); @@ -123,7 +123,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { LOG("Delete threads references\n"); for (int i = 0; i < THREADS_COUNT; i++) { - if (threads[i] != NULL) + if (threads[i] != nullptr) jni->DeleteGlobalRef(threads[i]); } @@ -143,13 +143,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, const char name[], int foundCount, jthread foundThreads[]) { jint count = 0; - jthread* threads = NULL; + jthread* threads = nullptr; size_t len = strlen(name); int found = 0; for (int i = 0; i < foundCount; i++) { - foundThreads[i] = NULL; + foundThreads[i] = nullptr; } check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), "Error in GetAllThreads"); @@ -159,7 +159,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, jvmtiThreadInfo info; check_jvmti_status(jni, jvmti->GetThreadInfo(threads[i], &info), ""); - if (info.name != NULL && strncmp(name, info.name, len) == 0) { + if (info.name != nullptr && strncmp(name, info.name, len) == 0) { LOG(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name); if (found < foundCount) foundThreads[found] = threads[i]; @@ -182,7 +182,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, LOG("Make global references for threads: %d threads\n", foundCount); for (int i = 0; i < foundCount; i++) { foundThreads[i] = (jthread) jni->NewGlobalRef(foundThreads[i]); - if ( foundThreads[i] == NULL) { + if ( foundThreads[i] == nullptr) { set_agent_fail_status(); return JNI_FALSE; } @@ -194,12 +194,12 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; timeout = 60 * 1000; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -219,7 +219,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!set_agent_proc(agentProc, NULL)) { + if (!set_agent_proc(agentProc, nullptr)) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst02/libresumethrdlst02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst02/libresumethrdlst02.cpp index 8345a56d352..5d622b926db 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst02/libresumethrdlst02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst02/libresumethrdlst02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { }; static const int THREADS_COUNT = 10; -static jthread* threads = NULL; +static jthread* threads = nullptr; static volatile int eventsReceived = 0; static jrawMonitorID eventsReceivedMtx = 0; @@ -65,7 +65,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jvmtiError* results = NULL; + jvmtiError* results = nullptr; LOG("Allocate threads array: %d threads\n", THREADS_COUNT); check_jvmti_status(jni, jvmti->Allocate((THREADS_COUNT * sizeof(jthread)), (unsigned char**)&threads), ""); @@ -98,7 +98,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { eventsReceived = 0; LOG("Enable event: %s\n", "THREAD_END"); - enable_events_notifications(jvmti, jni,JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL); + enable_events_notifications(jvmti, jni,JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr); LOG("Let threads to run and finish\n"); if (!agent_resume_sync()) @@ -136,7 +136,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } LOG("Disable event: %s\n", "THREAD_END"); - enable_events_notifications(jvmti, jni, JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL); + enable_events_notifications(jvmti, jni, JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr); LOG("Wait for thread to finish\n"); if (!agent_wait_for_sync(timeout)) @@ -144,7 +144,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { LOG("Delete threads references\n"); for (int i = 0; i < THREADS_COUNT; i++) { - if (threads[i] != NULL) + if (threads[i] != nullptr) jni->DeleteGlobalRef(threads[i]); } @@ -164,13 +164,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, const char name[], int foundCount, jthread foundThreads[]) { jint count = 0; - jthread* threads = NULL; + jthread* threads = nullptr; size_t len = strlen(name); int found = 0; for (int i = 0; i < foundCount; i++) { - foundThreads[i] = NULL; + foundThreads[i] = nullptr; } check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), "Error in GetAllThreads"); @@ -180,7 +180,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, jvmtiThreadInfo info; check_jvmti_status(jni, jvmti->GetThreadInfo(threads[i], &info), ""); - if (info.name != NULL && strncmp(name, info.name, len) == 0) { + if (info.name != nullptr && strncmp(name, info.name, len) == 0) { LOG(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name); if (found < foundCount) foundThreads[found] = threads[i]; @@ -203,7 +203,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, LOG("Make global references for threads: %d threads\n", foundCount); for (int i = 0; i < foundCount; i++) { foundThreads[i] = (jthread) jni->NewGlobalRef(foundThreads[i]); - if ( foundThreads[i] == NULL) { + if ( foundThreads[i] == nullptr) { set_agent_fail_status(); return JNI_FALSE; } @@ -221,7 +221,7 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ for (int i = 0; i < THREADS_COUNT; i++) { - if (thread != NULL && jni->IsSameObject(threads[i], thread)) { + if (thread != nullptr && jni->IsSameObject(threads[i], thread)) { LOG(" ... received THREAD_END event for thread #%d: %p\n", i, (void*)thread); eventsReceived++; jvmti->RawMonitorExit(eventsReceivedMtx); @@ -234,12 +234,12 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; timeout = 60 * 1000; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -273,7 +273,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!set_agent_proc(agentProc, NULL)) { + if (!set_agent_proc(agentProc, nullptr)) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd01/libsuspendthrd01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd01/libsuspendthrd01.cpp index 0df18a09f2d..300a479d4ce 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd01/libsuspendthrd01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd01/libsuspendthrd01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { { LOG("Find thread: %s\n", THREAD_NAME); jthread tested_thread = find_thread_by_name(jvmti, jni, THREAD_NAME); - if (tested_thread == NULL) { + if (tested_thread == nullptr) { return; } LOG(" ... found thread: %p\n", (void *) tested_thread); @@ -97,12 +97,12 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; timeout = 60 * 1000; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -122,7 +122,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!set_agent_proc(agentProc, NULL)) { + if (!set_agent_proc(agentProc, nullptr)) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd02/libsuspendthrd02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd02/libsuspendthrd02.cpp index 9f3e59e6a88..9ab8e053a51 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd02/libsuspendthrd02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd02/libsuspendthrd02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { }; static volatile int eventsReceived = 0; -static jthread testedThread = NULL; +static jthread testedThread = nullptr; /** Agent algorithm. */ static void JNICALL @@ -61,14 +61,14 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { { LOG("Find thread: %s\n", THREAD_NAME); testedThread = find_thread_by_name(jvmti, jni, THREAD_NAME); - if (testedThread == NULL) { + if (testedThread == nullptr) { return; } LOG(" ... found thread: %p\n", (void *) testedThread); eventsReceived = 0; LOG("Enable event: %s\n", "THREAD_END"); - enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL); + enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr); LOG("Suspend thread: %p\n", (void *) testedThread); err = jvmti->SuspendThread(testedThread); @@ -96,7 +96,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { } LOG("Disable event: %s\n", "THREAD_END"); - enable_events_notifications(jvmti, jni, JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL); + enable_events_notifications(jvmti, jni, JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr); LOG("Resume thread: %p\n", (void *) testedThread); err = jvmti->ResumeThread(testedThread); @@ -122,7 +122,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { JNIEXPORT void JNICALL callbackThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { /* check if event is for tested thread */ - if (thread != NULL && jni->IsSameObject(testedThread, thread)) { + if (thread != nullptr && jni->IsSameObject(testedThread, thread)) { LOG(" ... received THREAD_END event for tested thread: %p\n", (void *) thread); eventsReceived++; } else { @@ -132,12 +132,12 @@ callbackThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; timeout = 60 * 1000; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -168,7 +168,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } /* register agent proc and arg */ - if (!set_agent_proc(agentProc, NULL)) { + if (!set_agent_proc(agentProc, nullptr)) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst01/libsuspendthrdlst01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst01/libsuspendthrdlst01.cpp index 19bb8e0cadb..30fb104beff 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst01/libsuspendthrdlst01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst01/libsuspendthrdlst01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,8 +54,8 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { /* perform testing */ { - jthread *threads = NULL; - jvmtiError *results = NULL; + jthread *threads = nullptr; + jvmtiError *results = nullptr; LOG("Allocate threads array: %d threads\n", THREADS_COUNT); check_jvmti_status(jni, jvmti->Allocate((THREADS_COUNT * sizeof(jthread)), @@ -120,7 +120,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { LOG("Delete threads references\n"); for (int i = 0; i < THREADS_COUNT; i++) { - if (threads[i] != NULL) + if (threads[i] != nullptr) jni->DeleteGlobalRef(threads[i]); } @@ -141,13 +141,13 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { /** Find threads whose name starts with specified name prefix. */ static int find_threads_by_name(jvmtiEnv *jvmti, JNIEnv *jni, const char *name, int found_count, jthread *found_threads) { jint count = 0; - jthread *threads = NULL; + jthread *threads = nullptr; size_t len = strlen(name); int found = 0; for (int i = 0; i < found_count; i++) { - found_threads[i] = NULL; + found_threads[i] = nullptr; } check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), "Error in GetAllThreads"); @@ -158,7 +158,7 @@ static int find_threads_by_name(jvmtiEnv *jvmti, JNIEnv *jni, const char *name, check_jvmti_status(jni, jvmti->GetThreadInfo(threads[i], &info), ""); - if (info.name != NULL && strncmp(name, info.name, len) == 0) { + if (info.name != nullptr && strncmp(name, info.name, len) == 0) { LOG(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name); if (found < found_count) found_threads[found] = threads[i]; @@ -182,7 +182,7 @@ static int find_threads_by_name(jvmtiEnv *jvmti, JNIEnv *jni, const char *name, LOG("Make global references for threads: %d threads\n", found_count); for (int i = 0; i < found_count; i++) { found_threads[i] = (jthread) jni->NewGlobalRef(found_threads[i]); - if (found_threads[i] == NULL) { + if (found_threads[i] == nullptr) { set_agent_fail_status(); return JNI_FALSE; } @@ -194,12 +194,12 @@ static int find_threads_by_name(jvmtiEnv *jvmti, JNIEnv *jni, const char *name, JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; timeout = 60 * 1000; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -216,7 +216,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } /* register agent proc and arg */ - if (!set_agent_proc(agentProc, NULL)) { + if (!set_agent_proc(agentProc, nullptr)) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst02/libsuspendthrdlst02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst02/libsuspendthrdlst02.cpp index 5fb6c80af98..2ccc96c2596 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst02/libsuspendthrdlst02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst02/libsuspendthrdlst02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,7 +49,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { JVMTI_EVENT_THREAD_END }; -static jthread* threads = NULL; +static jthread* threads = nullptr; static volatile int eventsReceived = 0; @@ -66,7 +66,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jvmtiError* results = NULL; + jvmtiError* results = nullptr; LOG("Allocate threads array: %d threads\n", THREADS_COUNT); check_jvmti_status(jni, jvmti->Allocate((THREADS_COUNT * sizeof(jthread)), @@ -100,7 +100,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { eventsReceived = 0; LOG("Enable event: %s\n", "THREAD_END"); - enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL); + enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr); LOG("Let threads to run and finish\n"); if (!agent_resume_sync()) @@ -121,7 +121,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } LOG("Disable event: %s\n", "THREAD_END"); - enable_events_notifications(jvmti, jni,JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL); + enable_events_notifications(jvmti, jni,JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr); LOG("Resume threads list\n"); err = jvmti->ResumeThreadList(THREADS_COUNT, threads, results); @@ -137,7 +137,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { LOG("Delete threads references\n"); for (int i = 0; i < THREADS_COUNT; i++) { - if (threads[i] != NULL) { + if (threads[i] != nullptr) { jni->DeleteGlobalRef(threads[i]); } } @@ -159,12 +159,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, const char name[], int foundCount, jthread foundThreads[]) { jint count = 0; - jthread* threads = NULL; + jthread* threads = nullptr; size_t len = strlen(name); int found = 0; for (int i = 0; i < foundCount; i++) { - foundThreads[i] = NULL; + foundThreads[i] = nullptr; } check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), ""); @@ -174,7 +174,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, jvmtiThreadInfo info; check_jvmti_status(jni, jvmti->GetThreadInfo(threads[i], &info), ""); - if (info.name != NULL && strncmp(name, info.name, len) == 0) { + if (info.name != nullptr && strncmp(name, info.name, len) == 0) { LOG(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name); if (found < foundCount) { foundThreads[found] = threads[i]; @@ -198,7 +198,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, LOG("Make global references for threads: %d threads\n", foundCount); for (int i = 0; i < foundCount; i++) { foundThreads[i] = (jthread) jni->NewGlobalRef(foundThreads[i]); - if (foundThreads[i] == NULL) { + if (foundThreads[i] == nullptr) { set_agent_fail_status(); return JNI_FALSE; } @@ -213,7 +213,7 @@ JNIEXPORT void JNICALL callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ for (int i = 0; i < THREADS_COUNT; i++) { - if (thread != NULL && jni->IsSameObject(threads[i], thread)) { + if (thread != nullptr && jni->IsSameObject(threads[i], thread)) { LOG(" ... received THREAD_END event for thread #%d: %p\n", i, (void*)thread); eventsReceived++; return; @@ -224,12 +224,12 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; timeout = 60 * 1000; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -261,7 +261,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!set_agent_proc(agentProc, NULL)) { + if (!set_agent_proc(agentProc, nullptr)) { return JNI_ERR; } return JNI_OK; diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/BreakpointInYieldTest/libBreakpointInYieldTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/BreakpointInYieldTest/libBreakpointInYieldTest.cpp index 01b1f2f93dc..aa9f3bbd52a 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/BreakpointInYieldTest/libBreakpointInYieldTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/BreakpointInYieldTest/libBreakpointInYieldTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; -static jrawMonitorID event_mon = NULL; +static jvmtiEnv *jvmti = nullptr; +static jrawMonitorID event_mon = nullptr; static int method_entry_count = 0; static int method_exit_count = 0; static int breakpoint_count = 0; @@ -63,7 +63,7 @@ set_breakpoint(JNIEnv *jni, jclass klass, const char *mname) jlocation location = (jlocation)0L; jvmtiError err; - if (method == NULL) { + if (method == nullptr) { jni->FatalError("Error in set_breakpoint: not found method"); } err = jvmti->SetBreakpoint(method, location); @@ -131,13 +131,13 @@ VirtualThreadMount(jvmtiEnv *jvmti, ...) { if (done) { return; // defence against JVMTI_ERROR_WRONG_PHASE failures } - jmethodID method = NULL; + jmethodID method = nullptr; jlocation loc = 0L; jvmtiError err; va_list ap; - JNIEnv* jni = NULL; - jthread thread = NULL; + JNIEnv* jni = nullptr; + jthread thread = nullptr; va_start(ap, jvmti); jni = va_arg(ap, JNIEnv*); @@ -162,13 +162,13 @@ VirtualThreadUnmount(jvmtiEnv *jvmti, ...) { if (done) { return; // defence against JVMTI_ERROR_WRONG_PHASE failures } - jmethodID method = NULL; + jmethodID method = nullptr; jlocation loc = 0L; jvmtiError err; va_list ap; - JNIEnv* jni = NULL; - jthread thread = NULL; + JNIEnv* jni = nullptr; + jthread thread = nullptr; va_start(ap, jvmti); jni = va_arg(ap, JNIEnv*); @@ -239,24 +239,24 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_UNMOUNT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_UNMOUNT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); return JNI_ERR; @@ -276,16 +276,16 @@ Java_BreakpointInYieldTest_enableEvents(JNIEnv *jni, jclass klass, jthread threa LOG("enableEvents: started\n"); - jclass k1 = find_class(jvmti, jni, NULL, "Ljava/lang/VirtualThread;"); - jclass k2 = find_class(jvmti, jni, NULL, "Ljdk/internal/vm/Continuation;"); - if (k1 == NULL || k2 == NULL) { + jclass k1 = find_class(jvmti, jni, nullptr, "Ljava/lang/VirtualThread;"); + jclass k2 = find_class(jvmti, jni, nullptr, "Ljdk/internal/vm/Continuation;"); + if (k1 == nullptr || k2 == nullptr) { jni->FatalError("Did not find one of the classes by name: VirtualThread or Continuation"); } set_breakpoint(jni, k1, "run"); set_breakpoint(jni, k2, "yield"); // Enable Breakpoint events globally - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); check_jvmti_status(jni, err, "enableEvents: error in JVMTI SetEventNotificationMode: enable BREAKPOINT"); LOG("enableEvents: finished\n"); @@ -297,19 +297,19 @@ Java_BreakpointInYieldTest_check(JNIEnv *jni, jclass cls) { jvmtiError err; done = true; // defence against JVMTI_ERROR_WRONG_PHASE failures - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, nullptr); check_jvmti_status(jni, err, "check: error in JVMTI SetEventNotificationMode: disable THREAD_START"); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); check_jvmti_status(jni, err, "check: error in JVMTI SetEventNotificationMode: disable VIRTUAL_THREAD_START"); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, nullptr); check_jvmti_status(jni, err, "check: error in JVMTI SetEventNotificationMode: disable VIRTUAL_THREAD_MOUNT"); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, EXT_EVENT_VIRTUAL_THREAD_UNMOUNT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, EXT_EVENT_VIRTUAL_THREAD_UNMOUNT, nullptr); check_jvmti_status(jni, err, "check: error in JVMTI SetEventNotificationMode: disable VIRTUAL_THREAD_UNMOUNT"); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_BREAKPOINT, nullptr); check_jvmti_status(jni, err, "check: error in JVMTI SetEventNotificationMode: disable BREAKPOINT"); LOG("\n"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContFramePopTest/libContFramePopTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContFramePopTest/libContFramePopTest.cpp index 191d47585e9..1840b6ccac7 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContFramePopTest/libContFramePopTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContFramePopTest/libContFramePopTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,9 +29,9 @@ extern "C" { #define MAX_FRAME_COUNT 20 -static jvmtiEnv *jvmti = NULL; -static jthread exp_thread = NULL; -static jrawMonitorID event_mon = NULL; +static jvmtiEnv *jvmti = nullptr; +static jthread exp_thread = nullptr; +static jrawMonitorID event_mon = nullptr; static int method_entry_count = 0; static int method_exit_count = 0; static int frame_pop_count = 0; @@ -40,11 +40,11 @@ static void print_frame_event_info(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID method, const char* event_name) { char* tname = get_thread_name(jvmti, jni, thread); char* cname = get_method_class_name(jvmti, jni, method); - char* mname = NULL; - char* msign = NULL; + char* mname = nullptr; + char* msign = nullptr; jvmtiError err; - err = jvmti->GetMethodName(method, &mname, &msign, NULL); + err = jvmti->GetMethodName(method, &mname, &msign, nullptr); check_jvmti_status(jni, err, "event handler: error in JVMTI GetMethodName call"); if (strcmp(event_name, "MethodEntry") == 0) { diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContStackDepthTest/libContStackDepthTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContStackDepthTest/libContStackDepthTest.cpp index f0b6fcaa254..9bafe3bd5d0 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContStackDepthTest/libContStackDepthTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContStackDepthTest/libContStackDepthTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,9 +28,9 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; -static jthread exp_thread = NULL; -static jrawMonitorID event_mon = NULL; +static jvmtiEnv *jvmti = nullptr; +static jthread exp_thread = nullptr; +static jrawMonitorID event_mon = nullptr; static int breakpoint_count = 0; static int frame_pop_count = 0; static int method_entry_count = 0; @@ -42,11 +42,11 @@ print_frame_event_info(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID m const char* event_name, int event_count) { char* tname = get_thread_name(jvmti, jni, thread); char* cname = get_method_class_name(jvmti, jni, method); - char* mname = NULL; - char* msign = NULL; + char* mname = nullptr; + char* msign = nullptr; jvmtiError err; - err = jvmti->GetMethodName(method, &mname, &msign, NULL); + err = jvmti->GetMethodName(method, &mname, &msign, nullptr); check_jvmti_status(jni, err, "event handler: error in JVMTI GetMethodName call"); LOG("\n%s event #%d: thread: %s, method: %s: %s%s\n", @@ -181,10 +181,10 @@ FramePop(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, print_frame_event_info(jvmti, jni, thread, method, "FramePop", ++frame_pop_count); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, nullptr); check_jvmti_status(jni, err, "FramePop: error in JVMTI SetEventNotificationMode: disable SINGLE_STEP"); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, nullptr); check_jvmti_status(jni, err, "FramePop: error in JVMTI SetEventNotificationMode: disable FRAME_POP"); deallocate(jvmti, jni, (void*)mname); @@ -236,8 +236,8 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_ContStackDepthTest_enableEvents(JNIEnv *jni, jclass klass, jthread thread) { jint method_count = 0; - jmethodID* methods = NULL; - jmethodID method = NULL; + jmethodID* methods = nullptr; + jmethodID method = nullptr; jlocation location = (jlocation)0L; jvmtiError err; @@ -259,7 +259,7 @@ Java_ContStackDepthTest_enableEvents(JNIEnv *jni, jclass klass, jthread thread) } deallocate(jvmti, jni, (void*)mname); } - if (method == NULL) { + if (method == nullptr) { jni->FatalError("Error in enableEvents: not found method fibTest()"); } @@ -267,7 +267,7 @@ Java_ContStackDepthTest_enableEvents(JNIEnv *jni, jclass klass, jthread thread) check_jvmti_status(jni, err, "enableEvents: error in JVMTI SetBreakpoint"); // Enable Breakpoint events globally - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); check_jvmti_status(jni, err, "enableEvents: error in JVMTI SetEventNotificationMode: enable BREAKPOINT"); LOG("enableEvents: finished\n"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContYieldBreakPointTest/libContYieldBreakPointTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContYieldBreakPointTest/libContYieldBreakPointTest.cpp index b4f3da42e4a..e8ac3886461 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContYieldBreakPointTest/libContYieldBreakPointTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContYieldBreakPointTest/libContYieldBreakPointTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,9 +28,9 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; -static jthread exp_thread = NULL; -static jrawMonitorID event_mon = NULL; +static jvmtiEnv *jvmti = nullptr; +static jthread exp_thread = nullptr; +static jrawMonitorID event_mon = nullptr; static int breakpoint_count = 0; static int single_step_count = 0; @@ -39,11 +39,11 @@ print_frame_event_info(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID m const char* event_name, int event_count) { char* tname = get_thread_name(jvmti, jni, thread); char* cname = get_method_class_name(jvmti, jni, method); - char* mname = NULL; - char* msign = NULL; + char* mname = nullptr; + char* msign = nullptr; jvmtiError err; - err = jvmti->GetMethodName(method, &mname, &msign, NULL); + err = jvmti->GetMethodName(method, &mname, &msign, nullptr); check_jvmti_status(jni, err, "event handler: error in JVMTI GetMethodName call"); LOG("\n%s event #%d: thread: %s, method: %s: %s%s\n", @@ -150,8 +150,8 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_ContYieldBreakPointTest_enableEvents(JNIEnv *jni, jclass klass, jthread thread, jclass contKlass) { jint method_count = 0; - jmethodID* methods = NULL; - jmethodID method = NULL; + jmethodID* methods = nullptr; + jmethodID method = nullptr; jlocation location = (jlocation)0L; jvmtiError err; @@ -172,7 +172,7 @@ Java_ContYieldBreakPointTest_enableEvents(JNIEnv *jni, jclass klass, jthread thr } deallocate(jvmti, jni, (void*)mname); } - if (method == NULL) { + if (method == nullptr) { jni->FatalError("Error in enableEvents: not found method fibTest()"); } @@ -180,7 +180,7 @@ Java_ContYieldBreakPointTest_enableEvents(JNIEnv *jni, jclass klass, jthread thr check_jvmti_status(jni, err, "enableEvents: error in JVMTI SetBreakpoint"); // Enable Breakpoint events globally - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); check_jvmti_status(jni, err, "enableEvents: error in JVMTI SetEventNotificationMode: enable BREAKPOINT"); LOG("enableEvents: finished\n"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContinuationTest/libContinuationTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContinuationTest/libContinuationTest.cpp index c2bc14887b0..81cc1368ad8 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContinuationTest/libContinuationTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContinuationTest/libContinuationTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,9 +30,9 @@ extern "C" { #define MAX_FRAME_COUNT 20 #define FRAMES_TO_NOTIFY_POP 7 -static jvmtiEnv *jvmti = NULL; -static jthread exp_thread = NULL; -static jrawMonitorID event_mon = NULL; +static jvmtiEnv *jvmti = nullptr; +static jthread exp_thread = nullptr; +static jrawMonitorID event_mon = nullptr; static int method_entry_count = 0; static int frame_pop_count = 0; @@ -40,13 +40,13 @@ static void print_frame_event_info(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID method, const char* event_name) { char* tname = get_thread_name(jvmti, jni, thread); char* cname = get_method_class_name(jvmti, jni, method); - char* mname = NULL; - char* msign = NULL; + char* mname = nullptr; + char* msign = nullptr; jboolean is_virtual = jni->IsVirtualThread(thread); const char* virt = is_virtual ? "virtual" : "carrier"; jvmtiError err; - err = jvmti->GetMethodName(method, &mname, &msign, NULL); + err = jvmti->GetMethodName(method, &mname, &msign, nullptr); check_jvmti_status(jni, err, "event handler: error in JVMTI GetMethodName call"); if (strcmp(event_name, "MethodEntry") == 0) { @@ -78,7 +78,7 @@ MethodEntry(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID method) { // Request FramePop notifications for all continuation frames. // They all are expected to be cleared as a part of yield protocol. for (jint depth = 0; depth < FRAMES_TO_NOTIFY_POP; depth++) { - jmethodID frame_method = NULL; + jmethodID frame_method = nullptr; jlocation location = 0LL; err = jvmti->NotifyFramePop(thread, depth); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ForceEarlyReturnTest/libForceEarlyReturnTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ForceEarlyReturnTest/libForceEarlyReturnTest.cpp index 86cdf781f7f..4407c5d074d 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ForceEarlyReturnTest/libForceEarlyReturnTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ForceEarlyReturnTest/libForceEarlyReturnTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,9 +28,9 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; -static jmethodID mid_B = NULL; -static jrawMonitorID monitor = NULL; +static jvmtiEnv *jvmti = nullptr; +static jmethodID mid_B = nullptr; +static jrawMonitorID monitor = nullptr; static volatile bool bp_sync_reached = false; static void JNICALL @@ -55,7 +55,7 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, check_jvmti_status(jni, err, "Breakpoint: Failed in JVMTI GetLocalInt"); if (force_return != 0) { - jobject ret_obj = NULL; + jobject ret_obj = nullptr; err = jvmti->ClearBreakpoint(mid_B, 0); check_jvmti_status(jni, err, "Breakpoint: Failed in JVMTI ClearBreakpoint"); @@ -79,7 +79,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { LOG("Agent init\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Agent init: Failed in GetEnv!\n"); return JNI_ERR; } @@ -124,17 +124,17 @@ Java_ForceEarlyReturnTest_prepareAgent(JNIEnv *jni, jclass cls, jclass task_claz LOG("Main: prepareAgent started\n"); - if (jvmti == NULL) { + if (jvmti == nullptr) { fatal(jni, "prepareAgent: Failed as JVMTI client was not properly loaded!\n"); } mid_B = jni->GetStaticMethodID(task_clazz, "B", "(ZLjava/lang/String;)Ljava/lang/String;"); - if (mid_B == NULL) { + if (mid_B == nullptr) { fatal(jni, "prepareAgent: Failed to find Method ID for method: TestTask.B()\n"); } err = jvmti->SetBreakpoint(mid_B, 0); // location: 0 check_jvmti_status(jni, err, "prepareAgent: Failed in JVMTI SetBreakpoint"); - set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); LOG("Main: prepareAgent finished\n"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/GetSetLocalTest/libGetSetLocalTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/GetSetLocalTest/libGetSetLocalTest.cpp index c127e9fff9b..20b2edb1e9d 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/GetSetLocalTest/libGetSetLocalTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/GetSetLocalTest/libGetSetLocalTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,7 @@ typedef struct Values { } Values; static const int MAX_EVENTS_TO_PROCESS = 20; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static volatile jboolean completed = JNI_FALSE; static void @@ -60,7 +60,7 @@ set_breakpoint(JNIEnv *jni, jclass klass, const char *mname, jlocation location) jmethodID method = find_method(jvmti, jni, klass, mname); jvmtiError err; - if (method == NULL) { + if (method == nullptr) { LOG("set_breakpoint: Failed to find method %s()\n", mname); fatal(jni, "set_breakpoint: not found method"); } @@ -88,10 +88,10 @@ find_method_depth(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *mna for (int depth = 0; depth < count; depth++) { jmethodID method = frames[depth].method; - char* name = NULL; - char* sign = NULL; + char* name = nullptr; + char* sign = nullptr; - err = jvmti->GetMethodName(method, &name, &sign, NULL); + err = jvmti->GetMethodName(method, &name, &sign, nullptr); if (err == JVMTI_ERROR_WRONG_PHASE || err == JVMTI_ERROR_THREAD_NOT_ALIVE) { return -1; // VM or target thread completed its work } @@ -107,15 +107,15 @@ find_method_depth(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *mna static void test_GetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, int depth, int frame_count, Values *exp_values) { - jobject msg = NULL; - jobject tt = NULL; + jobject msg = nullptr; + jobject tt = nullptr; jint ii = 0; jlong ll = 0L; jfloat ff = 0.0; jdouble dd = 0.0; jvmtiError err; - LOG("test_GetLocal: mounted: %d depth: %d fcount: %d\n", cthread != NULL, depth, frame_count); + LOG("test_GetLocal: mounted: %d depth: %d fcount: %d\n", cthread != nullptr, depth, frame_count); int dep = find_method_depth(jvmti, jni, vthread, "producer"); if (dep == -1) { @@ -126,7 +126,7 @@ test_GetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, } // #0: Test JVMTI GetLocalInstance function for carrier thread - if (cthread != NULL) { + if (cthread != nullptr) { suspend_thread(jvmti, jni, cthread); err = jvmti->GetLocalInstance(cthread, 3, &msg); @@ -165,18 +165,18 @@ test_GetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, " to return JVMTI_ERROR_INVALID_SLOT or JVMTI_ERROR_TYPE_MISMATCH"); } - // #5: Test JVMTI GetLocalObject function with NULL value_ptr - err = jvmti->GetLocalObject(vthread, depth, SlotString, NULL); + // #5: Test JVMTI GetLocalObject function with nullptr value_ptr + err = jvmti->GetLocalObject(vthread, depth, SlotString, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { - LOG("JVMTI GetLocalObject with NULL value_ptr returned error: %d\n", err); - fatal(jni, "JVMTI GetLocalObject with NULL value_ptr failed to return JVMTI_ERROR_NULL_POINTER"); + LOG("JVMTI GetLocalObject with null value_ptr returned error: %d\n", err); + fatal(jni, "JVMTI GetLocalObject with null value_ptr failed to return JVMTI_ERROR_NULL_POINTER"); } // #6: Test JVMTI GetLocal functions with a good vthread err = jvmti->GetLocalObject(vthread, depth, SlotString, &msg); check_jvmti_status(jni, err, "error in JVMTI GetLocalObject with good vthread"); - const char* str = jni->GetStringUTFChars((jstring)msg, NULL); + const char* str = jni->GetStringUTFChars((jstring)msg, nullptr); LOG(" local String value at slot %d: %s\n", SlotString, str); const char* exp_str = "msg: ..."; if (strncmp(str, exp_str, 5) != 0) { @@ -189,7 +189,7 @@ test_GetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, check_jvmti_status(jni, err, "error in JVMTI GetLocalObject with good vthread"); LOG(" local Thread value at slot %d: %p\n", SlotThread, (void*)tt); - if (exp_values->tt != NULL && !jni->IsSameObject(tt, exp_values->tt)) { + if (exp_values->tt != nullptr && !jni->IsSameObject(tt, exp_values->tt)) { LOG(" Failed: Expected local Thread value: %p, got: %p\n", exp_values->tt, tt); fatal(jni, "JVMTI GetLocalObject returned unexpected local Thread value"); } @@ -239,7 +239,7 @@ test_SetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, int depth, int frame_count, Values *values, bool at_event) { jvmtiError err; - LOG("test_SetLocal: mounted: %d depth: %d fcount: %d\n", cthread != NULL, depth, frame_count); + LOG("test_SetLocal: mounted: %d depth: %d fcount: %d\n", cthread != nullptr, depth, frame_count); // #1: Test JVMTI SetLocalObject function with negative frame depth err = jvmti->SetLocalObject(vthread, -1, SlotString, values->tt); @@ -257,7 +257,7 @@ test_SetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, // #3: Test JVMTI SetLocalObject function with invalid slot -1 err = jvmti->SetLocalObject(vthread, depth, SlotInvalid0, values->tt); - if (depth > 0 || cthread == NULL) { + if (depth > 0 || cthread == nullptr) { // JVMTI_ERROR_OPAQUE_FRAME can be returned for unmouted vthread or depth > 0 if (err != JVMTI_ERROR_OPAQUE_FRAME) { LOG("JVMTI SetLocalObject for unmounted vthread or depth > 0 failed to return JVMTI_ERROR_OPAQUE_FRAME: %d\n", err); @@ -271,14 +271,14 @@ test_SetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, // #4: Test JVMTI SetLocalObject function with unaligned slot 4 err = jvmti->SetLocalObject(vthread, depth, SlotUnaligned, values->tt); - if (depth > 0 || cthread == NULL) { + if (depth > 0 || cthread == nullptr) { // JVMTI_ERROR_OPAQUE_FRAME can be returned for unmouted vthread or depth > 0 if (err != JVMTI_ERROR_OPAQUE_FRAME) { LOG("JVMTI SetLocalObject for unmounted vthread or depth > 0 failed to return JVMTI_ERROR_OPAQUE_FRAME: %d\n", err); fatal(jni, "JVMTI SetLocalObject for unmounted vthread or depth > 0 failed to return JVMTI_ERROR_OPAQUE_FRAME"); } } - else if (cthread != NULL && err != JVMTI_ERROR_INVALID_SLOT && err != JVMTI_ERROR_TYPE_MISMATCH) { + else if (cthread != nullptr && err != JVMTI_ERROR_INVALID_SLOT && err != JVMTI_ERROR_TYPE_MISMATCH) { LOG("JVMTI SetLocalObject with unaligned slot 4 returned error: %d\n", err); fatal(jni, "JVMTI SetLocalObject with unaligned slot 4 failed" " to return JVMTI_ERROR_INVALID_SLOT or JVMTI_ERROR_TYPE_MISMATCH"); @@ -286,7 +286,7 @@ test_SetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, // #6: Test JVMTI SetLocal functions with a good vthread err = jvmti->SetLocalObject(vthread, depth, SlotThread, values->tt); - if (depth > 0 || cthread == NULL) { + if (depth > 0 || cthread == nullptr) { if (err != JVMTI_ERROR_OPAQUE_FRAME) { LOG("JVMTI SetLocalObject for unmounted vthread or depth > 0 failed to return JVMTI_ERROR_OPAQUE_FRAME: %d\n", err); fatal(jni, "JVMTI SetLocalObject for unmounted vthread pr depth > 0failed to return JVMTI_ERROR_OPAQUE_FRAME"); @@ -314,8 +314,8 @@ test_SetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, static void test_GetSetLocal(jvmtiEnv *jvmti, JNIEnv* jni, jthread vthread, int depth, int frame_count, bool at_event) { - Values values0 = { NULL, NULL, 1, 2L, (jfloat)3.2F, (jdouble)4.500000047683716 }; - Values values1 = { NULL, NULL, 2, 3L, (jfloat)4.2F, (jdouble)5.500000047683716 }; + Values values0 = { nullptr, nullptr, 1, 2L, (jfloat)3.2F, (jdouble)4.500000047683716 }; + Values values1 = { nullptr, nullptr, 2, 3L, (jfloat)4.2F, (jdouble)5.500000047683716 }; jthread cthread = get_carrier_thread(jvmti, jni, vthread); values0.tt = vthread; @@ -329,7 +329,7 @@ test_GetSetLocal(jvmtiEnv *jvmti, JNIEnv* jni, jthread vthread, int depth, int f if (!success) { goto End; // skip testing for compiled frame that can't be deoptimized } - if (depth > 0 || cthread == NULL) { + if (depth > 0 || cthread == nullptr) { // No values are expected to be set by SetLocal above as // unmounted virtual thread case is not supported. // So, we expect local values to remain the same. @@ -368,8 +368,8 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv* jni, jthread vthread, test_GetSetLocal(jvmti, jni, vthread, depth, frame_count, true /* at_event */); // vthread passed to callback has to refer to current thread, - // so we can also test with NULL in place of vthread. - test_GetSetLocal(jvmti, jni, NULL, depth, frame_count, true /* at_event */); + // so we can also test with nullptr in place of vthread. + test_GetSetLocal(jvmti, jni, nullptr, depth, frame_count, true /* at_event */); } deallocate(jvmti, jni, (void*)mname); deallocate(jvmti, jni, (void*)tname); @@ -439,7 +439,7 @@ Java_GetSetLocalTest_testSuspendedVirtualThreads(JNIEnv *jni, jclass klass, jthr // Test each of these cases only once: unmounted, positive depth, frame count 0. while (iter++ < 50 && (!seen_depth_0 || !seen_depth_positive || !seen_unmounted)) { - jmethodID method = NULL; + jmethodID method = nullptr; jlocation location = 0; sleep_ms(1); @@ -460,7 +460,7 @@ Java_GetSetLocalTest_testSuspendedVirtualThreads(JNIEnv *jni, jclass klass, jthr } bool case_0 = !seen_depth_0 && depth == 0 && (int)location >= 30; bool case_1 = !seen_depth_positive && depth > 0 && (int)location >= 30; - bool case_2 = !seen_unmounted && depth >= 0 && cthread == NULL; + bool case_2 = !seen_unmounted && depth >= 0 && cthread == nullptr; if (case_0) { LOG("testSuspendedVirtualThreads: DEPTH == 0\n"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/InterruptThreadTest/libInterruptThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/InterruptThreadTest/libInterruptThreadTest.cpp index f601aa15e3f..6be49bfb456 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/InterruptThreadTest/libInterruptThreadTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/InterruptThreadTest/libInterruptThreadTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static void JNICALL agent_proc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/MethodExitTest/libMethodExitTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/MethodExitTest/libMethodExitTest.cpp index 9676d583206..fb6b0bab587 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/MethodExitTest/libMethodExitTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/MethodExitTest/libMethodExitTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,9 +27,9 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; -static jthread exp_thread = NULL; -static jrawMonitorID event_mon = NULL; +static jvmtiEnv *jvmti = nullptr; +static jthread exp_thread = nullptr; +static jrawMonitorID event_mon = nullptr; static int vthread_mounted_count = 0; static int vthread_unmounted_count = 0; static int breakpoint_count = 0; @@ -41,9 +41,9 @@ static jboolean received_method_exit_event = JNI_FALSE; static jboolean passed = JNI_TRUE; static bool done = false; -static jmethodID *test_methods = NULL; +static jmethodID *test_methods = nullptr; jint test_method_count = 0; -jclass test_class = NULL; +jclass test_class = nullptr; static void print_frame_event_info(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID method, @@ -79,7 +79,7 @@ set_or_clear_breakpoint(JNIEnv *jni, jboolean set, const char *methodName, jclass klass, jmethodID methods[], int method_count) { jlocation location = (jlocation)0L; - jmethodID method = NULL; + jmethodID method = nullptr; jvmtiError err; // Find the jmethodID of the specified method @@ -93,7 +93,7 @@ set_or_clear_breakpoint(JNIEnv *jni, jboolean set, const char *methodName, } deallocate(jvmti, jni, (void*)mname); } - if (method == NULL) { + if (method == nullptr) { LOG("setupBreakpoint: not found method %s() to %s a breakpoint\n", methodName, set ? "set" : "clear"); jni->FatalError("Error in setupBreakpoint: not found method"); @@ -131,7 +131,7 @@ breakpoint_hit1(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jthread cthread, jboolean is_virtual, char* mname) { char* tname = get_thread_name(jvmti, jni, cthread); - jthread vthread = NULL; + jthread vthread = nullptr; jvmtiError err; // Test GetVirtualThread for carrier thread. @@ -161,10 +161,10 @@ breakpoint_hit1(jvmtiEnv *jvmti, JNIEnv* jni, LOG("GetThreadLocalStorage for carrier thread returned value %p as expected\n\n", tls_data); } { - jmethodID method = NULL; + jmethodID method = nullptr; jlocation loc = 0L; - char* mname1 = NULL; - char* cname1 = NULL; + char* mname1 = nullptr; + char* cname1 = nullptr; err = jvmti->GetFrameLocation(cthread, 0, &method, &loc); check_jvmti_status(jni, err, "Breakpoint: error in JVMTI GetFrameLocation"); @@ -252,7 +252,7 @@ breakpoint_hit3(jvmtiEnv *jvmti, JNIEnv* jni, // Disable breakpoint events. clear_breakpoint(jni, "brkpt", test_class, test_methods, test_method_count); - set_event_notification_mode(jvmti, jni, JVMTI_DISABLE, JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, jni, JVMTI_DISABLE, JVMTI_EVENT_BREAKPOINT, nullptr); // Disable METHOD_EXIT events on the vthread. LOG("Hit #3: Breakpoint: %s: disabling MethodExit events on virtual thread: %p\n", mname, (void*)thread); @@ -279,7 +279,7 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, if (done) { return; // avoid failures with JVMTI_ERROR_WRONG_PHASE } - jthread cthread = NULL; + jthread cthread = nullptr; char* mname = get_method_name(jvmti, jni, method); jboolean is_virtual = jni->IsVirtualThread(thread); @@ -347,7 +347,7 @@ MethodExit(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID method, } // print_frame_event_info(jvmti, jni, thread, method, "MethodExit", method_exit_count); - if (strstr(mname, "brkpt") != NULL) { // event IS in the "brkpt" method + if (strstr(mname, "brkpt") != nullptr) { // event IS in the "brkpt" method LOG("Hit #%d: MethodExit #%d: method: %s on thread: %p\n", brkptBreakpointHit, method_exit_count, mname, (void*)thread); received_method_exit_event = JNI_TRUE; // set it for brkpt method only if brkptBreakpointHit > 1 @@ -433,15 +433,15 @@ VirtualThreadMount(jvmtiEnv *jvmti, ...) { if (done) { return; // avoid failures with JVMTI_ERROR_WRONG_PHASE } - jmethodID method = NULL; + jmethodID method = nullptr; jlocation loc = 0L; - char* mname = NULL; - char* cname = NULL; + char* mname = nullptr; + char* cname = nullptr; jvmtiError err; va_list ap; - JNIEnv* jni = NULL; - jthread thread = NULL; + JNIEnv* jni = nullptr; + jthread thread = nullptr; va_start(ap, jvmti); jni = va_arg(ap, JNIEnv*); @@ -478,15 +478,15 @@ VirtualThreadUnmount(jvmtiEnv *jvmti, ...) { if (done) { return; // avoid failures with JVMTI_ERROR_WRONG_PHASE } - jmethodID method = NULL; + jmethodID method = nullptr; jlocation loc = 0L; - char* mname = NULL; - char* cname = NULL; + char* mname = nullptr; + char* cname = nullptr; jvmtiError err; va_list ap; - JNIEnv* jni = NULL; - jthread thread = NULL; + JNIEnv* jni = nullptr; + jthread thread = nullptr; va_start(ap, jvmti); jni = va_arg(ap, JNIEnv*); @@ -562,9 +562,9 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { LOG("Agent_OnLoad: Error in JVMTI SetEventCallbacks: %d\n", err); return JNI_ERR; } - set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL); - set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); - set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr); + set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); + set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); event_mon = create_raw_monitor(jvmti, "Events Monitor"); @@ -585,7 +585,7 @@ Java_MethodExitTest_enableEvents(JNIEnv *jni, jclass klass, jthread thread, jcla set_breakpoint(jni, "brkpt", testKlass, test_methods, test_method_count); // Enable Breakpoint events globally - set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); LOG("enableEvents: finished\n"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/NullAsCurrentThreadTest/libNullAsCurrentThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/NullAsCurrentThreadTest/libNullAsCurrentThreadTest.cpp index 140375d4cb5..82c51dfed75 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/NullAsCurrentThreadTest/libNullAsCurrentThreadTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/NullAsCurrentThreadTest/libNullAsCurrentThreadTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ extern "C" { static const jint MAX_FRAME_CNT = 30; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static int vt_support_enabled = 0; static jboolean failed_status = JNI_FALSE; @@ -49,16 +49,16 @@ checkStackTraces(jvmtiEnv* jvmti, JNIEnv* jni, jvmtiFrameInfo* frames0, jvmtiFra for (int idx = 0; idx < cnt; idx++) { jmethodID method0 = frames0[idx].method; jmethodID method1 = frames1[idx].method; - char* name0 = NULL; - char* name1 = NULL; - char* sign0 = NULL; - char* sign1 = NULL; + char* name0 = nullptr; + char* name1 = nullptr; + char* sign0 = nullptr; + char* sign1 = nullptr; - err = jvmti->GetMethodName(method0, &name0, &sign0, NULL); + err = jvmti->GetMethodName(method0, &name0, &sign0, nullptr); check_jvmti_status(jni, err, "GetMethodName"); if (method0 != method1) { - err = jvmti->GetMethodName(method1, &name1, &sign1, NULL); + err = jvmti->GetMethodName(method1, &name1, &sign1, nullptr); check_jvmti_status(jni, err, "GetMethodName"); failed_status = JNI_TRUE; @@ -80,13 +80,13 @@ testGetThreadInfo(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { jvmtiThreadInfo inf0; jvmtiThreadInfo inf1; - err = jvmti->GetThreadInfo(NULL, &inf0); + err = jvmti->GetThreadInfo(nullptr, &inf0); check(jni, "GetThreadInfo", err); err = jvmti->GetThreadInfo(thread, &inf1); check(jni, "GetThreadInfo", err); - const char* name = (inf0.name == NULL) ? "" : inf0.name; + const char* name = (inf0.name == nullptr) ? "" : inf0.name; LOG("Agent: GetThreadInfo: current thread: %s\n", name); if (strcmp(inf0.name, inf1.name) != 0) { @@ -121,7 +121,7 @@ testGetThreadState(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { jint state0 = 0; jint state1 = 0; - err = jvmti->GetThreadState(NULL, &state0); + err = jvmti->GetThreadState(nullptr, &state0); check_jvmti_status(jni, err, "GetThreadState"); err = jvmti->GetThreadState(thread, &state1); @@ -145,7 +145,7 @@ testGetFrameCount(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { err = jvmti->GetFrameCount(thread, &count0); check_jvmti_status(jni, err,"GetFrameCount"); - err = jvmti->GetFrameCount(NULL, &count1); + err = jvmti->GetFrameCount(nullptr, &count1); check_jvmti_status(jni, err,"GetFrameCount"); if (count0 != count1) { @@ -163,24 +163,24 @@ testGetFrameLocation(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { const jint DEPTH = 1; jlocation loc0 = 0; jlocation loc1 = 0; - jmethodID method0 = NULL; - jmethodID method1 = NULL; - char* name0 = NULL; - char* name1 = NULL; - char* sign0 = NULL; - char* sign1 = NULL; + jmethodID method0 = nullptr; + jmethodID method1 = nullptr; + char* name0 = nullptr; + char* name1 = nullptr; + char* sign0 = nullptr; + char* sign1 = nullptr; - err = jvmti->GetFrameLocation(NULL, DEPTH, &method0, &loc0); + err = jvmti->GetFrameLocation(nullptr, DEPTH, &method0, &loc0); check_jvmti_status(jni, err, "GetFrameLocation"); err = jvmti->GetFrameLocation(thread, DEPTH, &method1, &loc1); check_jvmti_status(jni, err, "GetFrameLocation"); - err = jvmti->GetMethodName(method0, &name0, &sign0, NULL); + err = jvmti->GetMethodName(method0, &name0, &sign0, nullptr); check_jvmti_status(jni, err, "GetMethodName"); if (method0 != method1) { - err = jvmti->GetMethodName(method1, &name1, &sign1, NULL); + err = jvmti->GetMethodName(method1, &name1, &sign1, nullptr); check_jvmti_status(jni, err, "GetMethodName"); failed_status = JNI_TRUE; @@ -207,7 +207,7 @@ testGetStackTrace(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { memset(frames0, 0, sizeof(frames0)); memset(frames1, 0, sizeof(frames1)); - err = jvmti->GetStackTrace(NULL, 0, MAX_FRAME_CNT, frames0, &count0); + err = jvmti->GetStackTrace(nullptr, 0, MAX_FRAME_CNT, frames0, &count0); check_jvmti_status(jni, err, "GetStackTrace"); err = jvmti->GetStackTrace(thread, 0, MAX_FRAME_CNT, frames1, &count1); @@ -226,8 +226,8 @@ testGetOwnedMonitorInfo(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { jvmtiError err; jint count0 = 0; jint count1 = 0; - jobject* monitors0 = NULL; - jobject* monitors1 = NULL; + jobject* monitors0 = nullptr; + jobject* monitors1 = nullptr; err = jvmti->GetOwnedMonitorInfo(thread, &count0, &monitors0); check_jvmti_status(jni, err, "GetOwnedMonitorInfo"); @@ -263,10 +263,10 @@ testGetOwnedMonitorStackDepthInfo(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) jvmtiError err; jint count0 = 0; jint count1 = 0; - jvmtiMonitorStackDepthInfo* inf0 = NULL; - jvmtiMonitorStackDepthInfo* inf1 = NULL; + jvmtiMonitorStackDepthInfo* inf0 = nullptr; + jvmtiMonitorStackDepthInfo* inf1 = nullptr; - err = jvmti->GetOwnedMonitorStackDepthInfo(NULL, &count0, &inf0); + err = jvmti->GetOwnedMonitorStackDepthInfo(nullptr, &count0, &inf0); check_jvmti_status(jni, err, "GetOwnedMonitorStackDepthInfo"); err = jvmti->GetOwnedMonitorStackDepthInfo(thread, &count1, &inf1); @@ -302,10 +302,10 @@ testGetOwnedMonitorStackDepthInfo(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) static void testGetCurrentContendedMonitor(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { jvmtiError err; - jobject monitor0 = NULL; - jobject monitor1 = NULL; + jobject monitor0 = nullptr; + jobject monitor1 = nullptr; - err = jvmti->GetCurrentContendedMonitor(NULL, &monitor0); + err = jvmti->GetCurrentContendedMonitor(nullptr, &monitor0); check_jvmti_status(jni, err, "GetCurrentContendedMonitor"); err = jvmti->GetCurrentContendedMonitor(thread, &monitor1); @@ -321,17 +321,17 @@ testGetCurrentContendedMonitor(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { } /* - * Execute JVMTI functions with NULL jthread and check the result is correct. + * Execute JVMTI functions with nullptr jthread and check the result is correct. */ JNIEXPORT void JNICALL Java_NullAsCurrentThreadTest_testJvmtiFunctions(JNIEnv *jni, jclass cls) { jvmtiError err; - jthread cur_thr = NULL; + jthread cur_thr = nullptr; err = jvmti->GetCurrentThread(&cur_thr); check(jni, "GetCurrentThread", err); - LOG("Testing JMTI functions accepting NULL jthread as current thread\n"); + LOG("Testing JMTI functions accepting null jthread as current thread\n"); testGetThreadInfo(jvmti, jni, cur_thr); testGetThreadState(jvmti, jni, cur_thr); @@ -395,7 +395,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { if (err != JVMTI_ERROR_NONE) { LOG("Agent_OnLoad: error in JVMTI SetEventCallbacks: %d\n", err); } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent_OnLoad: error in JVMTI SetEventNotificationMode: %d\n", err); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/PinnedTaskTest/libPinnedTaskTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/PinnedTaskTest/libPinnedTaskTest.cpp index f7f740ae9e1..d50d1ab4b8b 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/PinnedTaskTest/libPinnedTaskTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/PinnedTaskTest/libPinnedTaskTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static void JNICALL agent_proc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/PopFrameTest/libPopFrameTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/PopFrameTest/libPopFrameTest.cpp index 20e4b940649..327b7d1cb2a 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/PopFrameTest/libPopFrameTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/PopFrameTest/libPopFrameTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -69,7 +69,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { LOG("Agent init\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Agent init: Failed in GetEnv!\n"); return JNI_ERR; } @@ -114,19 +114,19 @@ Java_PopFrameTest_prepareAgent(JNIEnv *jni, jclass cls, jclass task_clazz, jbool LOG("Main: prepareAgent started\n"); - if (jvmti == NULL) { + if (jvmti == nullptr) { fatal(jni, "prepareAgent: Failed as JVMTI client was not properly loaded!\n"); } do_pop_frame = do_pop; mid_B = jni->GetStaticMethodID(task_clazz, "B", "()V"); - if (mid_B == NULL) { + if (mid_B == nullptr) { fatal(jni, "prepareAgent: Failed to find Method ID for method: TestTask.B()\n"); } err = jvmti->SetBreakpoint(mid_B, 0); check_jvmti_status(jni, err, "prepareAgent: Failed in JVMTI SetBreakpoint"); - set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); LOG("Main: prepareAgent finished\n"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/RawMonitorTest/libRawMonitorTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/RawMonitorTest/libRawMonitorTest.cpp index 89015fe4bcb..1e7c49af7a9 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/RawMonitorTest/libRawMonitorTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/RawMonitorTest/libRawMonitorTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jrawMonitorID monitor; JNIEXPORT void JNICALL diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/SelfSuspendDisablerTest/libSelfSuspendDisablerTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/SelfSuspendDisablerTest/libSelfSuspendDisablerTest.cpp index fdb8110aa57..74a1a3efc0d 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/SelfSuspendDisablerTest/libSelfSuspendDisablerTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/SelfSuspendDisablerTest/libSelfSuspendDisablerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include "jvmti.h" #include "jvmti_common.h" -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; extern "C" { @@ -50,12 +50,12 @@ Java_SelfSuspendDisablerTest_isSuspended(JNIEnv* jni, jclass cls, jthread thread JNIEXPORT void JNICALL Java_SelfSuspendDisablerTest_suspendAllVirtualThreads(JNIEnv* jni, jclass cls) { - check_jvmti_status(jni, jvmti->SuspendAllVirtualThreads(0, NULL), "Error in SuspendAllVirtualThreads"); + check_jvmti_status(jni, jvmti->SuspendAllVirtualThreads(0, nullptr), "Error in SuspendAllVirtualThreads"); } JNIEXPORT void JNICALL Java_SelfSuspendDisablerTest_resumeAllVirtualThreads(JNIEnv* jni, jclass cls) { - check_jvmti_status(jni, jvmti->ResumeAllVirtualThreads(0, NULL), "Error in ResumeAllVirtualThreads"); + check_jvmti_status(jni, jvmti->ResumeAllVirtualThreads(0, nullptr), "Error in ResumeAllVirtualThreads"); } JNIEXPORT jint JNICALL diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/StopThreadTest/libStopThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/StopThreadTest/libStopThreadTest.cpp index 9cb9bc4c5a4..ade0e7fb67c 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/StopThreadTest/libStopThreadTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/StopThreadTest/libStopThreadTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,10 +28,10 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; -static jmethodID mid_B = NULL; -static jobject exception_obj = NULL; -static jrawMonitorID monitor = NULL; +static jvmtiEnv *jvmti = nullptr; +static jmethodID mid_B = nullptr; +static jobject exception_obj = nullptr; +static jrawMonitorID monitor = nullptr; static volatile bool bp_sync_reached = false; static void JNICALL @@ -73,7 +73,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { LOG("Agent init\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Agent init: Failed in GetEnv!\n"); return JNI_ERR; } @@ -118,21 +118,21 @@ Java_StopThreadTest_prepareAgent(JNIEnv *jni, jclass cls, jclass task_clazz, job LOG("Main: prepareAgent started\n"); - if (jvmti == NULL) { + if (jvmti == nullptr) { fatal(jni, "prepareAgent: Failed as JVMTI client was not properly loaded!\n"); } exception_obj = jni->NewGlobalRef(exc_obj); - if (exception_obj == NULL) { + if (exception_obj == nullptr) { fatal(jni, "prepareAgent: Failed in JNI NewGlobalRef\n"); } mid_B = jni->GetStaticMethodID(task_clazz, "B", "()V"); - if (mid_B == NULL) { + if (mid_B == nullptr) { fatal(jni, "prepareAgent: Failed to find Method ID for method: TestTask.B()\n"); } err = jvmti->SetBreakpoint(mid_B, 0); check_jvmti_status(jni, err, "prepareAgent: Failed in JVMTI SetBreakpoint"); - set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); LOG("Main: prepareAgent finished\n"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume1/libSuspendResume1.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume1/libSuspendResume1.cpp index 78f1922f546..9854008c142 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume1/libSuspendResume1.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume1/libSuspendResume1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,8 +35,8 @@ extern "C" { static const char* CTHREAD_NAME_START = "ForkJoinPool"; static const int CTHREAD_NAME_START_LEN = (int)strlen("ForkJoinPool"); -static jvmtiEnv *jvmti = NULL; -static jrawMonitorID agent_event_lock = NULL; +static jvmtiEnv *jvmti = nullptr; +static jrawMonitorID agent_event_lock = nullptr; static jthread tested_vthreads[VTHREAD_CNT]; static int vthread_no = 0; @@ -48,7 +48,7 @@ test_get_stack_trace(JNIEnv *jni, jthread thread) { static void test_get_thread_list_stack_traces(JNIEnv *jni, bool is_virt, jint thread_cnt, jthread* thread_list) { - jvmtiStackInfo* stack_info_arr = NULL; + jvmtiStackInfo* stack_info_arr = nullptr; LOG("## Agent: test_get_thread_list_stack_traces started: is virtual: %d, count: %d\n\n", is_virt, thread_cnt); @@ -70,9 +70,9 @@ static void test_get_frame_location(JNIEnv* jni, jthread thread, char* tname) { const jint DEPTH = 1; jlocation loc = 0; - jmethodID method = NULL; - char* name = NULL; - char* sign = NULL; + jmethodID method = nullptr; + char* name = nullptr; + char* sign = nullptr; jboolean is_virtual = jni->IsVirtualThread(thread); jvmtiError err = jvmti->GetFrameLocation(thread, DEPTH, &method, &loc); @@ -84,7 +84,7 @@ test_get_frame_location(JNIEnv* jni, jthread thread, char* tname) { } return; } - err = jvmti->GetMethodName(method, &name, &sign, NULL); + err = jvmti->GetMethodName(method, &name, &sign, nullptr); check_jvmti_status(jni, err, "test_get_frame_location: error in JVMTI GetMethodName"); LOG("Agent: GetFrameLocation: frame for current thread %s: method: %s%s, loc: %lld\n", @@ -93,7 +93,7 @@ test_get_frame_location(JNIEnv* jni, jthread thread, char* tname) { static jint get_cthreads(JNIEnv* jni, jthread** cthreads_p) { - jthread* tested_cthreads = NULL; + jthread* tested_cthreads = nullptr; jint all_cnt = 0; jint ct_cnt = 0; @@ -313,7 +313,7 @@ test_jvmti_functions_for_threads(JNIEnv* jni, bool is_virt, jint thread_cnt, jth JNIEXPORT void JNICALL Java_SuspendResume1_TestSuspendResume(JNIEnv* jni, jclass cls) { - jthread* tested_cthreads = NULL; + jthread* tested_cthreads = nullptr; jint cthread_cnt = 0; LOG("\n## TestSuspendResume: Test carrier threads\n"); @@ -395,7 +395,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume2/libSuspendResume2.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume2/libSuspendResume2.cpp index 56faa994be5..97cae4f0f0c 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume2/libSuspendResume2.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume2/libSuspendResume2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,16 +35,16 @@ extern "C" { static const char* CTHREAD_NAME_START = "ForkJoinPool"; static const int CTHREAD_NAME_START_LEN = (int)strlen("ForkJoinPool"); -static jvmtiEnv *jvmti = NULL; -static jrawMonitorID agent_event_lock = NULL; -static volatile jthread agent_thread = NULL; +static jvmtiEnv *jvmti = nullptr; +static jrawMonitorID agent_event_lock = nullptr; +static volatile jthread agent_thread = nullptr; static jthread tested_vthreads[VTHREAD_CNT]; static int vthread_no = 0; static jint get_cthreads(JNIEnv* jni, jthread** cthreads_p) { - jthread* tested_cthreads = NULL; + jthread* tested_cthreads = nullptr; jint all_cnt = 0; jint ct_cnt = 0; @@ -106,7 +106,7 @@ test_vthread_suspend_all(JNIEnv* jni, const jthread* thread_list, int suspend_ma LOG("\n## Agent: test_vthread_suspend_all started\n"); const jint EXCLUDE_CNT = 2; - jthread exclude_list[EXCLUDE_CNT] = { NULL, NULL }; + jthread exclude_list[EXCLUDE_CNT] = { nullptr, nullptr }; for (int idx = 0; idx < EXCLUDE_CNT; idx++) { exclude_list[idx] = thread_list[idx]; } @@ -138,7 +138,7 @@ test_vthread_resume_all(JNIEnv* jni, const jthread* thread_list, int suspend_mas LOG("\n## Agent: test_vthread_resume_all started\n"); const jint EXCLUDE_CNT = 2; - jthread exclude_list[EXCLUDE_CNT] = { NULL, NULL }; + jthread exclude_list[EXCLUDE_CNT] = { nullptr, nullptr }; for (int idx = 0; idx < EXCLUDE_CNT; idx++) { exclude_list[idx] = thread_list[idx]; } @@ -224,7 +224,7 @@ check_threads_resumed_state(JNIEnv* jni, const jthread* thread_list, int thread_ JNIEXPORT void JNICALL Java_SuspendResume2_TestSuspendResume(JNIEnv* jni, jclass cls) { - jthread* tested_cthreads = NULL; + jthread* tested_cthreads = nullptr; LOG("\n## TestSuspendResume: started\n"); @@ -310,7 +310,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResumeAll/libSuspendResumeAll.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResumeAll/libSuspendResumeAll.cpp index 7270d237d74..4aef71c8737 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResumeAll/libSuspendResumeAll.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResumeAll/libSuspendResumeAll.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,21 +35,21 @@ extern "C" { static const char* CTHREAD_NAME_START = "ForkJoinPool"; static const int CTHREAD_NAME_START_LEN = (int)strlen("ForkJoinPool"); -static jvmtiEnv *jvmti = NULL; -static jrawMonitorID agent_event_lock = NULL; -static volatile jthread agent_thread = NULL; +static jvmtiEnv *jvmti = nullptr; +static jrawMonitorID agent_event_lock = nullptr; +static volatile jthread agent_thread = nullptr; static jthread tested_vthreads[VTHREAD_CNT]; static int vthread_no = 0; -static jmethodID *test_methods = NULL; +static jmethodID *test_methods = nullptr; jint test_method_count = 0; -jclass test_class = NULL; +jclass test_class = nullptr; static void set_or_clear_breakpoint(JNIEnv *jni, jboolean set, const char *methodName, jclass klass, jmethodID methods[], int method_count) { jlocation location = (jlocation)0L; - jmethodID method = NULL; + jmethodID method = nullptr; jvmtiError err; // Find the jmethodID of the specified method @@ -63,7 +63,7 @@ set_or_clear_breakpoint(JNIEnv *jni, jboolean set, const char *methodName, } deallocate(jvmti, jni, (void*)mname); } - if (method == NULL) { + if (method == nullptr) { LOG("setupBreakpoint: not found method %s() to %s a breakpoint\n", methodName, set ? "set" : "clear"); jni->FatalError("Error in setupBreakpoint: not found method"); @@ -109,7 +109,7 @@ Java_SuspendResumeAll_setBreakpoint(JNIEnv *jni, jclass klass, jclass testKlass) static jint get_cthreads(JNIEnv* jni, jthread** cthreads_p) { - jthread* tested_cthreads = NULL; + jthread* tested_cthreads = nullptr; jint all_cnt = 0; jint ct_cnt = 0; @@ -171,7 +171,7 @@ test_vthread_suspend_all(JNIEnv* jni, const jthread* thread_list, int suspend_ma LOG("\n## Agent: test_vthread_suspend_all started\n"); const jint EXCLUDE_CNT = 2; - jthread exclude_list[EXCLUDE_CNT] = { NULL, NULL }; + jthread exclude_list[EXCLUDE_CNT] = { nullptr, nullptr }; for (int idx = 0; idx < EXCLUDE_CNT; idx++) { exclude_list[idx] = thread_list[idx]; } @@ -204,7 +204,7 @@ test_vthread_resume_all(JNIEnv* jni, const jthread* thread_list, int suspend_mas LOG("\n## Agent: test_vthread_resume_all started\n"); const jint EXCLUDE_CNT = 2; - jthread exclude_list[EXCLUDE_CNT] = { NULL, NULL }; + jthread exclude_list[EXCLUDE_CNT] = { nullptr, nullptr }; for (int idx = 0; idx < EXCLUDE_CNT; idx++) { exclude_list[idx] = thread_list[idx]; // Enable Breakpoint events on excluded thread @@ -264,7 +264,7 @@ check_threads_resumed_state(JNIEnv* jni, const jthread* thread_list, int thread_ JNIEXPORT void JNICALL Java_SuspendResumeAll_TestSuspendResume(JNIEnv* jni, jclass cls) { - jthread* tested_cthreads = NULL; + jthread* tested_cthreads = nullptr; jint cthread_cnt = get_cthreads(jni, &tested_cthreads); LOG("\n## TestSuspendResume: started\n"); @@ -368,7 +368,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/libThreadListStackTracesTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/libThreadListStackTracesTest.cpp index 7441343ac40..3edb2871cc2 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/libThreadListStackTracesTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/libThreadListStackTracesTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { JNIEXPORT jint JNICALL Java_ThreadListStackTracesTest_getStateSingle(JNIEnv* jni, jclass clazz, jthread vthread) { - jvmtiStackInfo* info = NULL; + jvmtiStackInfo* info = nullptr; jvmtiError err = jvmti->GetThreadListStackTraces(1, &vthread, MAX_FRAME_COUNT, &info); check_jvmti_status(jni, err, "getStateSingle: error in JVMTI GetThreadListStackTraces"); @@ -45,7 +45,7 @@ Java_ThreadListStackTracesTest_getStateSingle(JNIEnv* jni, jclass clazz, jthread JNIEXPORT jint JNICALL Java_ThreadListStackTracesTest_getStateMultiple(JNIEnv* jni, jclass clazz, jthread vhread, jthread other) { jthread threads[2] = { vhread, other }; - jvmtiStackInfo* info = NULL; + jvmtiStackInfo* info = nullptr; jvmtiError err = jvmti->GetThreadListStackTraces(2, threads, MAX_FRAME_COUNT, &info); check_jvmti_status(jni, err, "getStateMultiple: error in JVMTI GetThreadListStackTraces"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest/libThreadStateTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest/libThreadStateTest.cpp index 895a2ba198e..c07b0924cfe 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest/libThreadStateTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest/libThreadStateTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -87,7 +87,7 @@ JNIEXPORT void JNICALL Java_ThreadStateTest_testGetThreadListStackTraces(JNIEnv* jni, jclass klass, jthread vthread) { jthread cthread = get_carrier_thread(jvmti, jni, vthread); jthread threads[2] = { cthread, vthread }; - jvmtiStackInfo* stackInfo = NULL; + jvmtiStackInfo* stackInfo = nullptr; jvmtiError err = jvmti->GetThreadListStackTraces(2, threads, MAX_FRAME_COUNT, &stackInfo); check_jvmti_status(jni, err, "testGetThreadState: error in JVMTI GetThreadListStackTraces"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ToggleNotifyJvmtiTest/libToggleNotifyJvmtiTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ToggleNotifyJvmtiTest/libToggleNotifyJvmtiTest.cpp index 1cf4a06592c..9ecece684ab 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ToggleNotifyJvmtiTest/libToggleNotifyJvmtiTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ToggleNotifyJvmtiTest/libToggleNotifyJvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,13 +34,13 @@ static volatile int vthread_ended_cnt = 0; static volatile int thread_started_cnt = 0; static volatile int thread_ended_cnt = 0; -static jrawMonitorID agent_lock = NULL; +static jrawMonitorID agent_lock = nullptr; static volatile jboolean agent_started = JNI_FALSE; static void check_and_print_thread_names(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, bool is_virtual, const char* msg) { - jthread cthread = NULL; - jthread vthread = NULL; + jthread cthread = nullptr; + jthread vthread = nullptr; if (is_virtual) { vthread = thread; @@ -52,7 +52,7 @@ static void check_and_print_thread_names(jvmtiEnv *jvmti, JNIEnv* jni, jthread t cthread = thread; } char* ctname = get_thread_name(jvmti, jni, cthread); - char* vtname = vthread == NULL ? NULL : get_thread_name(jvmti, jni, vthread); + char* vtname = vthread == nullptr ? nullptr : get_thread_name(jvmti, jni, vthread); LOG("Event: %s virtual: %d ct: %s vt: %s\n", msg, is_virtual, ctname, vtname); @@ -158,22 +158,22 @@ jint agent_init(JavaVM *jvm, char *options, void *reserved) { LOG("Agent init: error in JVMTI AddCapabilities: %s (%d)\n", TranslateError(err), err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_END, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_END, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); return JNI_ERR; diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadMonitorTest/libVThreadMonitorTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadMonitorTest/libVThreadMonitorTest.cpp index 72be78078bb..c05404658fe 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadMonitorTest/libVThreadMonitorTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadMonitorTest/libVThreadMonitorTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,13 +35,13 @@ extern "C" { #define TEST_CLASS_0 "MonitorClass0" #define TEST_CLASS_2 "MonitorClass2" -static jvmtiEnv *jvmti = NULL; -static jrawMonitorID agent_monitor = NULL; +static jvmtiEnv *jvmti = nullptr; +static jrawMonitorID agent_monitor = nullptr; static volatile bool was_lock0_contended = false; static volatile bool was_lock2_contended = false; static volatile jint status = STATUS_PASSED; -static volatile jclass test_class_0 = NULL; -static volatile jclass test_class_2 = NULL; +static volatile jclass test_class_0 = nullptr; +static volatile jclass test_class_2 = nullptr; static jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved); @@ -60,7 +60,7 @@ static void ShowErrorMessage(jvmtiEnv *jvmti, jvmtiError errCode, } static jboolean CheckLockObject0(JNIEnv *jni, jobject monitor) { - if (test_class_0 == NULL) { + if (test_class_0 == nullptr) { // JNI_OnLoad has not been called yet, so can't possibly be an instance of TEST_CLASS_0. return JNI_FALSE; } @@ -68,7 +68,7 @@ static jboolean CheckLockObject0(JNIEnv *jni, jobject monitor) { } static jboolean CheckLockObject2(JNIEnv *jni, jobject monitor) { - if (test_class_2 == NULL) { + if (test_class_2 == nullptr) { // JNI_OnLoad has not been called yet, so can't possibly be an instance of TEST_CLASS_2. return JNI_FALSE; } @@ -98,7 +98,7 @@ check_contended_monitor(jvmtiEnv *jvmti, JNIEnv *jni, const char* func, jni->IsSameObject(monitor2, contended_monitor) == JNI_FALSE) { LOG("FAIL: is_vt: %d: unexpected monitor from GetCurrentContendedMonitor\n", is_vt); LOG("stack trace of current thread:\n"); - print_stack_trace(jvmti, jni, NULL); + print_stack_trace(jvmti, jni, nullptr); LOG("stack trace of target thread:\n"); print_stack_trace(jvmti, jni, thread); status = STATUS_FAILED; @@ -123,7 +123,7 @@ check_owned_monitor(jvmtiEnv *jvmti, JNIEnv *jni, const char* func, jvmtiError err; jint state = 0; jint mcount = -1; - jobject *owned_monitors = NULL; + jobject *owned_monitors = nullptr; err = jvmti->GetOwnedMonitorInfo(thread, &mcount, &owned_monitors); if (err != JVMTI_ERROR_NONE) { @@ -182,9 +182,9 @@ MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, jobject mon char* ctname = get_thread_name(jvmti, jni, cthread); check_contended_monitor(jvmti, jni, "MonitorContendedEnter", - vthread, vtname, JNI_TRUE, monitor, NULL); + vthread, vtname, JNI_TRUE, monitor, nullptr); check_contended_monitor(jvmti, jni, "MonitorContendedEnter", - cthread, ctname, JNI_FALSE, NULL, NULL); + cthread, ctname, JNI_FALSE, nullptr, nullptr); check_owned_monitor(jvmti, jni, "MonitorContendedEnter", vthread, vtname, JNI_TRUE, monitor); check_owned_monitor(jvmti, jni, "MonitorContendedEnter", @@ -204,9 +204,9 @@ MonitorContendedEntered(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, jobject m char* ctname = get_thread_name(jvmti, jni, cthread); check_contended_monitor(jvmti, jni, "MonitorContendedEntered", - vthread, vtname, JNI_TRUE, NULL, NULL); + vthread, vtname, JNI_TRUE, nullptr, nullptr); check_contended_monitor(jvmti, jni, "MonitorContendedEntered", - cthread, ctname, JNI_FALSE, NULL, NULL); + cthread, ctname, JNI_FALSE, nullptr, nullptr); deallocate(jvmti, jni, (void*)vtname); deallocate(jvmti, jni, (void*)ctname); @@ -226,7 +226,7 @@ static jclass find_test_class(JNIEnv *jni, const char* cname) { jclass k = jni->FindClass(cname); - if (k == NULL) { + if (k == nullptr) { LOG("Error: Could not find class %s!\n", cname); } else { k = (jclass)jni->NewGlobalRef(k); @@ -240,7 +240,7 @@ JNI_OnLoad(JavaVM *jvm, void *reserved) { JNIEnv *jni; res = jvm->GetEnv((void **)&jni, JNI_VERSION_9); - if (res != JNI_OK || jni == NULL) { + if (res != JNI_OK || jni == nullptr) { LOG("Error: GetEnv call failed(%d)!\n", res); return JNI_ERR; } @@ -248,7 +248,7 @@ JNI_OnLoad(JavaVM *jvm, void *reserved) { test_class_0 = find_test_class(jni, TEST_CLASS_0); test_class_2 = find_test_class(jni, TEST_CLASS_2); - if (test_class_0 == NULL || test_class_2 == NULL) { + if (test_class_0 == nullptr || test_class_2 == nullptr) { return JNI_ERR; } return JNI_VERSION_9; @@ -264,7 +264,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { LOG("Agent_OnLoad started\n"); res = jvm->GetEnv((void **)&jvmti, JVMTI_VERSION); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Error: wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -315,14 +315,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL); + JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr); if (err != JVMTI_ERROR_NONE) { ShowErrorMessage(jvmti, err, "Agent_OnLoad", "error in JVMTI SetEventNotificationMode #1"); return JNI_ERR; } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL); + JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr); if (err != JVMTI_ERROR_NONE) { ShowErrorMessage(jvmti, err, "Agent_OnLoad", "error in JVMTI SetEventNotificationMode #2"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadNotifyFramePopTest/libVThreadNotifyFramePopTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadNotifyFramePopTest/libVThreadNotifyFramePopTest.cpp index 55803e5abf5..d5254293ab1 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadNotifyFramePopTest/libVThreadNotifyFramePopTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadNotifyFramePopTest/libVThreadNotifyFramePopTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,32 +29,32 @@ extern "C" { #define MAX_FRAME_COUNT 20 -static jvmtiEnv *jvmti = NULL; -static jrawMonitorID event_mon = NULL; +static jvmtiEnv *jvmti = nullptr; +static jrawMonitorID event_mon = nullptr; static int breakpoint_count = 0; static int frame_pop_count = 0; static int brkptBreakpointHit = 0; static jboolean received_frame_pop_event = JNI_FALSE; static jboolean passed = JNI_TRUE; -static jmethodID *test_methods = NULL; +static jmethodID *test_methods = nullptr; jint test_method_count = 0; -jclass test_class = NULL; +jclass test_class = nullptr; -static jmethodID *url_methods = NULL; +static jmethodID *url_methods = nullptr; jint url_method_count = 0; -jclass url_class = NULL; +jclass url_class = nullptr; static void print_frame_event_info(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID method, const char* event_name, int event_count) { char* tname = get_thread_name(jvmti, jni, thread); char* cname = get_method_class_name(jvmti, jni, method); - char* mname = NULL; - char* msign = NULL; + char* mname = nullptr; + char* msign = nullptr; jvmtiError err; - err = jvmti->GetMethodName(method, &mname, &msign, NULL); + err = jvmti->GetMethodName(method, &mname, &msign, nullptr); check_jvmti_status(jni, err, "event handler: error in JVMTI GetMethodName call"); LOG("%s #%d: thread: %s, method: %s.%s%s\n", @@ -84,7 +84,7 @@ static void set_or_clear_breakpoint(JNIEnv *jni, jboolean set, const char *methodName, jclass klass, jmethodID methods[], int method_count) { jlocation location = (jlocation)0L; - jmethodID method = NULL; + jmethodID method = nullptr; jvmtiError err; // Find the jmethodID of the specified method @@ -98,7 +98,7 @@ set_or_clear_breakpoint(JNIEnv *jni, jboolean set, const char *methodName, } deallocate(jvmti, jni, (void*)mname); } - if (method == NULL) { + if (method == nullptr) { LOG("setupBreakpoint: not found method %s() to %s a breakpoint\n", methodName, set ? "set" : "clear"); jni->FatalError("Error in setupBreakpoint: not found method"); @@ -237,7 +237,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { LOG("Agent_OnLoad: Error in JVMTI SetEventCallbacks: %d\n", err); } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); } @@ -268,7 +268,7 @@ Java_VThreadNotifyFramePopTest_enableEvents(JNIEnv *jni, jclass klass, jthread t set_breakpoint(jni, "openStream", urlKlass, url_methods, url_method_count); // Enable Breakpoint events globally - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); check_jvmti_status(jni, err, "enableEvents: error in JVMTI SetEventNotificationMode: enable BREAKPOINT"); LOG("enableEvents: finished\n"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTest/libVThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTest/libVThreadTest.cpp index 32037f79f53..701797bcfc2 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTest/libVThreadTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTest/libVThreadTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,8 +36,8 @@ typedef struct Tinfo { } Tinfo; static const int MAX_EVENTS_TO_PROCESS = 20; -static jvmtiEnv *jvmti = NULL; -static jrawMonitorID events_monitor = NULL; +static jvmtiEnv *jvmti = nullptr; +static jrawMonitorID events_monitor = nullptr; static Tinfo tinfo[MAX_WORKER_THREADS]; static int vthread_mount_count = 0; @@ -46,13 +46,13 @@ static jboolean passed = JNI_TRUE; static Tinfo* find_tinfo(JNIEnv* jni, const char* tname) { - Tinfo* inf = NULL; + Tinfo* inf = nullptr; int idx = 0; // Find slot with named worker thread or empty slot for (; idx < MAX_WORKER_THREADS; idx++) { inf = &tinfo[idx]; - if (inf->tname == NULL) { + if (inf->tname == nullptr) { inf->tname = (char*)malloc(strlen(tname) + 1); strcpy(inf->tname, tname); break; @@ -78,10 +78,10 @@ find_method_depth(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *mna for (int depth = 0; depth < count; depth++) { jmethodID method = frames[depth].method; - char* name = NULL; - char* sign = NULL; + char* name = nullptr; + char* sign = nullptr; - err = jvmti->GetMethodName(method, &name, &sign, NULL); + err = jvmti->GetMethodName(method, &name, &sign, nullptr); check_jvmti_status(jni, err, "find_method_depth: error in JVMTI GetMethodName"); if (strcmp(name, mname) == 0) { @@ -102,7 +102,7 @@ print_vthread_event_info(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jthread v inf->just_scheduled = JNI_TRUE; } else { - if (inf->tname == NULL && strcmp(event_name, "VirtualThreadEnd") != 0) { + if (inf->tname == nullptr && strcmp(event_name, "VirtualThreadEnd") != 0) { fatal(jni, "VThread event: worker thread not found!"); } if (strcmp(event_name, "VirtualThreadUnmount") == 0) { @@ -117,19 +117,19 @@ print_vthread_event_info(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jthread v static void test_GetVirtualThread(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jthread vthread, const char *event_name) { - jobject thread_vthread = NULL; + jobject thread_vthread = nullptr; jvmtiError err; LOG("\ntest_GetVirtualThread: event: %s\n", event_name); - // #1: Test JVMTI GetVirtualThread extension function NULL thread (current) - err = GetVirtualThread(jvmti, jni, NULL, &thread_vthread); - check_jvmti_status(jni, err, "event handler: error in JVMTI GetVirtualThread with NULL thread (current)"); + // #1: Test JVMTI GetVirtualThread extension function nullptr thread (current) + err = GetVirtualThread(jvmti, jni, nullptr, &thread_vthread); + check_jvmti_status(jni, err, "event handler: error in JVMTI GetVirtualThread with null thread (current)"); - if (thread_vthread == NULL) { - fatal(jni, "event handler: JVMTI GetVirtualThread with NULL thread (current) failed to return non-NULL vthread"); + if (thread_vthread == nullptr) { + fatal(jni, "event handler: JVMTI GetVirtualThread with nullptr thread (current) failed to return non-null vthread"); } - LOG("JVMTI GetVirtualThread with NULL thread (current) returned non-NULL vthread as expected\n"); + LOG("JVMTI GetVirtualThread with nullptr thread (current) returned non-null vthread as expected\n"); // #2: Test JVMTI GetVirtualThread extension function with a bad thread err = GetVirtualThread(jvmti, jni, vthread, &thread_vthread); @@ -141,21 +141,21 @@ test_GetVirtualThread(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jthread vthr err = GetVirtualThread(jvmti, jni,thread, &thread_vthread); check_jvmti_status(jni, err, "event handler: error in JVMTI GetVirtualThread"); - if (thread_vthread == NULL) { - fatal(jni, "event handler: JVMTI GetVirtualThread with good thread failed to return non-NULL vthread"); + if (thread_vthread == nullptr) { + fatal(jni, "event handler: JVMTI GetVirtualThread with good thread failed to return non-null vthread"); } - LOG("JVMTI GetVirtualThread with good thread returned non-NULL vthread as expected\n"); + LOG("JVMTI GetVirtualThread with good thread returned non-null vthread as expected\n"); } static void test_GetCarrierThread(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jthread vthread, const char *event_name) { - jthread vthread_thread = NULL; + jthread vthread_thread = nullptr; jvmtiError err; LOG("\ntest_GetCarrierThread: event: %s\n", event_name); - // #1: Test JVMTI GetCarrierThread extension function with NULL vthread - err = GetCarrierThread(jvmti, jni, NULL, &vthread_thread); + // #1: Test JVMTI GetCarrierThread extension function with nullptr vthread + err = GetCarrierThread(jvmti, jni, nullptr, &vthread_thread); check_jvmti_status(jni, err, "event handler: error in JVMTI GetCarrierThread"); // #2: Test JVMTI GetCarrierThread extension function with a bad vthread @@ -168,10 +168,10 @@ test_GetCarrierThread(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jthread vthr err = GetCarrierThread(jvmti, jni, vthread, &vthread_thread); check_jvmti_status(jni, err, "event handler: error in JVMTI GetCarrierThread"); - if (vthread_thread == NULL) { - fatal(jni, "event handler: JVMTI GetCarrierThread with good vthread failed to return non-NULL carrier thread"); + if (vthread_thread == nullptr) { + fatal(jni, "event handler: JVMTI GetCarrierThread with good vthread failed to return non-null carrier thread"); } - LOG("JVMTI GetCarrierThread with good vthread returned non-NULL carrier thread as expected\n"); + LOG("JVMTI GetCarrierThread with good vthread returned non-null carrier thread as expected\n"); } static void @@ -180,7 +180,7 @@ test_GetThreadInfo(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *ev jvmtiThreadInfo thr_info; jvmtiThreadGroupInfo ginfo; jint class_count = -1; - jclass* classes = NULL; + jclass* classes = nullptr; jboolean found = JNI_FALSE; LOG("test_GetThreadInfo: started\n"); @@ -207,11 +207,11 @@ test_GetThreadInfo(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *ev // #4: Test the thr_info.context_class_loader has the VThreadTest class for (int idx = 0; idx < class_count; idx++) { - char* sign = NULL; - err = jvmti->GetClassSignature(classes[idx], &sign, NULL); + char* sign = nullptr; + err = jvmti->GetClassSignature(classes[idx], &sign, nullptr); check_jvmti_status(jni, err, "event handler: error in JVMTI GetClassSignature"); - if (strstr(sign, "VThreadTest") != NULL) { + if (strstr(sign, "VThreadTest") != nullptr) { found = JNI_TRUE; break; } @@ -228,11 +228,11 @@ test_GetFrameCount(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *ev jint frame_count = -1; jvmtiError err; - // #1: Test JVMTI GetFrameCount function with NULL count_ptr pointer - err = jvmti->GetFrameCount(vthread, NULL); + // #1: Test JVMTI GetFrameCount function with nullptr count_ptr pointer + err = jvmti->GetFrameCount(vthread, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { - LOG("JVMTI GetFrameCount with NULL count_ptr returned error: %d\n", err); - fatal(jni, "event handler: JVMTI GetFrameCount with NULL count_ptr pointer failed to return JVMTI_ERROR_NULL_POINTER"); + LOG("JVMTI GetFrameCount with null count_ptr returned error: %d\n", err); + fatal(jni, "event handler: JVMTI GetFrameCount with null count_ptr pointer failed to return JVMTI_ERROR_NULL_POINTER"); } // #2: Test JVMTI GetFrameCount function with a good vthread @@ -249,7 +249,7 @@ test_GetFrameCount(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *ev static void test_GetFrameLocation(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *event_name, jint frame_count) { - jmethodID method = NULL; + jmethodID method = nullptr; jlocation location = -1; jvmtiError err; @@ -260,18 +260,18 @@ test_GetFrameLocation(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char fatal(jni, "event handler: JVMTI GetFrameLocation with negative frame depth failed to return JVMTI_ERROR_ILLEGAL_ARGUMENT"); } - // #2: Test JVMTI GetFrameLocation function with NULL method_ptr - err = jvmti->GetFrameLocation(vthread, 0, NULL, &location); + // #2: Test JVMTI GetFrameLocation function with nullptr method_ptr + err = jvmti->GetFrameLocation(vthread, 0, nullptr, &location); if (err != JVMTI_ERROR_NULL_POINTER) { - LOG("JVMTI GetFrameLocation with NULL method_ptr returned error: %d\n", err); - fatal(jni, "event handler: JVMTI GetFrameLocation with NULL method_ptr failed to return JVMTI_ERROR_NULL_POINTER"); + LOG("JVMTI GetFrameLocation with null method_ptr returned error: %d\n", err); + fatal(jni, "event handler: JVMTI GetFrameLocation with null method_ptr failed to return JVMTI_ERROR_NULL_POINTER"); } - // #3: Test JVMTI GetFrameLocation function with NULL location_ptr - err = jvmti->GetFrameLocation(vthread, 0, &method, NULL); + // #3: Test JVMTI GetFrameLocation function with nullptr location_ptr + err = jvmti->GetFrameLocation(vthread, 0, &method, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { - LOG("JVMTI GetFrameCount with NULL location_ptr returned error: %d\n", err); - fatal(jni, "event handler: JVMTI GetFrameLocation with NULL location_ptr failed to return JVMTI_ERROR_NULL_POINTER"); + LOG("JVMTI GetFrameCount with null location_ptr returned error: %d\n", err); + fatal(jni, "event handler: JVMTI GetFrameLocation with null location_ptr failed to return JVMTI_ERROR_NULL_POINTER"); } // #4: Test JVMTI GetFrameLocation function with a good vthread @@ -304,7 +304,7 @@ static void test_GetStackTrace(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *event_name, jint frame_count) { jvmtiFrameInfo frames[MAX_FRAME_COUNT]; jint count = -1; - jmethodID method = NULL; + jmethodID method = nullptr; jvmtiError err; LOG("\n"); @@ -328,18 +328,18 @@ test_GetStackTrace(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *ev fatal(jni, "event handler: JVMTI GetStackTrace with negative max_frame_count failed to return JVMTI_ERROR_ILLEGAL_ARGUMENT"); } - // #3: Test JVMTI GetStackTrace function with NULL frame_buffer pointer - err = jvmti->GetStackTrace(vthread, 0, MAX_FRAME_COUNT, NULL, &count); + // #3: Test JVMTI GetStackTrace function with nullptr frame_buffer pointer + err = jvmti->GetStackTrace(vthread, 0, MAX_FRAME_COUNT, nullptr, &count); if (err != JVMTI_ERROR_NULL_POINTER) { - LOG("JVMTI GetStackTrace with NULL frame_buffer pointer returned error: %d\n", err); - fatal(jni, "event handler: JVMTI GetStackTrace witt NULL frame_buffer pointer failed to return JVMTI_ERROR_NULL_POINTER"); + LOG("JVMTI GetStackTrace with null frame_buffer pointer returned error: %d\n", err); + fatal(jni, "event handler: JVMTI GetStackTrace witt null frame_buffer pointer failed to return JVMTI_ERROR_NULL_POINTER"); } - // #4: Test JVMTI GetStackTrace function with NULL count_ptr pointer - err = jvmti->GetStackTrace(vthread, 0, MAX_FRAME_COUNT, frames, NULL); + // #4: Test JVMTI GetStackTrace function with nullptr count_ptr pointer + err = jvmti->GetStackTrace(vthread, 0, MAX_FRAME_COUNT, frames, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { - LOG("JVMTI GetStackTrace with NULL count_ptr pointer returned error: %d\n", err); - fatal(jni, "event handler: JVMTI GetStackTrace witt NULL count_ptr pointer failed to return JVMTI_ERROR_NULL_POINTER"); + LOG("JVMTI GetStackTrace with null count_ptr pointer returned error: %d\n", err); + fatal(jni, "event handler: JVMTI GetStackTrace witt null count_ptr pointer failed to return JVMTI_ERROR_NULL_POINTER"); } // #5: Test JVMTI GetStackTrace function with a good vthread @@ -364,8 +364,8 @@ enum Slots { SlotInvalid0 = -1, SlotObj = 0, SlotInt = 1, SlotLong = 2, SlotUnal static void test_GetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, const char *event_name, jint frame_count) { - jmethodID method = NULL; - jobject obj = NULL; + jmethodID method = nullptr; + jobject obj = nullptr; jint ii = 0; jlong ll = 0L; jfloat ff = 0.0; @@ -423,18 +423,18 @@ test_GetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, co " to return JVMTI_ERROR_INVALID_SLOT or JVMTI_ERROR_TYPE_MISMATCH"); } - // #5: Test JVMTI GetLocalObject function with NULL value_ptr - err = jvmti->GetLocalObject(vthread, depth, SlotObj, NULL); + // #5: Test JVMTI GetLocalObject function with null value_ptr + err = jvmti->GetLocalObject(vthread, depth, SlotObj, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { - LOG("JVMTI GetLocalObject with NULL method_ptr returned error: %d\n", err); - fatal(jni, "JVMTI GetLocalObject with NULL method_ptr failed to return JVMTI_ERROR_NULL_POINTER"); + LOG("JVMTI GetLocalObject with null method_ptr returned error: %d\n", err); + fatal(jni, "JVMTI GetLocalObject with null method_ptr failed to return JVMTI_ERROR_NULL_POINTER"); } // #6: Test JVMTI GetLocal functions with a good vthread err = jvmti->GetLocalObject(vthread, depth, SlotObj, &obj); check_jvmti_status(jni, err, "event handler: error in JVMTI GetLocalObject with good vthread"); - const char* str = jni->GetStringUTFChars((jstring)obj, NULL); + const char* str = jni->GetStringUTFChars((jstring)obj, nullptr); LOG(" local String value at slot %d: %s\n", SlotObj, str); const char* exp_str = "msg: ..."; if (strncmp(str, exp_str, 5) != 0) { @@ -500,7 +500,7 @@ processVThreadEvent(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *e deallocate(jvmti, jni, (void*)tname); if (strcmp(event_name, "VirtualThreadEnd") == 0) { - return; // skip further testing as GetVirtualThread can return NULL + return; // skip further testing as GetVirtualThread can return nullptr } test_GetVirtualThread(jvmti, jni, cthread, vthread, event_name); @@ -532,8 +532,8 @@ VirtualThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) { static void JNICALL VirtualThreadMount(jvmtiEnv *jvmti, ...) { va_list ap; - JNIEnv* jni = NULL; - jthread thread = NULL; + JNIEnv* jni = nullptr; + jthread thread = nullptr; va_start(ap, jvmti); jni = va_arg(ap, JNIEnv*); @@ -549,8 +549,8 @@ VirtualThreadMount(jvmtiEnv *jvmti, ...) { static void JNICALL VirtualThreadUnmount(jvmtiEnv *jvmti, ...) { va_list ap; - JNIEnv* jni = NULL; - jthread thread = NULL; + JNIEnv* jni = nullptr; + jthread thread = nullptr; va_start(ap, jvmti); jni = va_arg(ap, JNIEnv*); @@ -608,25 +608,25 @@ Agent_OnLoad(JavaVM *jvm, char *options, return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_END, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_END, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_UNMOUNT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_UNMOUNT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); return JNI_ERR; diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadUnsupportedTest/libVThreadUnsupportedTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadUnsupportedTest/libVThreadUnsupportedTest.cpp index 14698b6e528..5b299a46f48 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadUnsupportedTest/libVThreadUnsupportedTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadUnsupportedTest/libVThreadUnsupportedTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static std::atomic is_completed_test_in_event; @@ -68,7 +68,7 @@ test_unsupported_jvmti_functions(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) jvmtiError err; jboolean is_vthread; jvmtiCapabilities caps; - void* local_storage_data = NULL; + void* local_storage_data = nullptr; jlong nanos; LOG("test_unsupported_jvmti_functions: started\n"); @@ -98,7 +98,7 @@ test_unsupported_jvmti_functions(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) check_jvmti_error_unsupported_operation(jni, "GetCurrentThreadCpuTime", err); } - err = jvmti->RunAgentThread(vthread, agent_proc, (const void*)NULL, JVMTI_THREAD_NORM_PRIORITY); + err = jvmti->RunAgentThread(vthread, agent_proc, nullptr, JVMTI_THREAD_NORM_PRIORITY); check_jvmti_error_unsupported_operation(jni, "RunAgentThread", err); LOG("test_unsupported_jvmti_functions: finished\n"); @@ -121,8 +121,8 @@ Java_VThreadUnsupportedTest_testJvmtiFunctionsInJNICall(JNIEnv *jni, jobject obj static void JNICALL VirtualThreadMount(jvmtiEnv *jvmti, ...) { va_list ap; - JNIEnv* jni = NULL; - jthread thread = NULL; + JNIEnv* jni = nullptr; + jthread thread = nullptr; va_start(ap, jvmti); jni = va_arg(ap, JNIEnv*); @@ -175,7 +175,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); return JNI_ERR; diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualStackTraceTest/libVirtualStackTraceTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualStackTraceTest/libVirtualStackTraceTest.cpp index eb387a1f8dc..744e75ac29f 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualStackTraceTest/libVirtualStackTraceTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualStackTraceTest/libVirtualStackTraceTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,21 +40,21 @@ Java_VirtualStackTraceTest_getStackTrace(JNIEnv* jni, jclass clazz) { jobject visibleFrames[MAX_COUNT]; jvmtiFrameInfo frameInfo[MAX_COUNT]; - err = jvmti->GetStackTrace(NULL, 0, MAX_COUNT, frameInfo, &count); + err = jvmti->GetStackTrace(nullptr, 0, MAX_COUNT, frameInfo, &count); check_jvmti_status(jni, err, "event handler: error in JVMTI GetStackTrace call"); for (int idx = 0; idx < count; idx++) { - jclass declaringClass = NULL; - char *clasSignature = NULL; - char *methodName = NULL; + jclass declaringClass = nullptr; + char *clasSignature = nullptr; + char *methodName = nullptr; err = jvmti->GetMethodDeclaringClass(frameInfo[idx].method, &declaringClass); check_jvmti_status(jni, err, "event handler: error in JVMTI GetMethodDeclaringClass call"); - err = jvmti->GetClassSignature(declaringClass, &clasSignature, NULL); + err = jvmti->GetClassSignature(declaringClass, &clasSignature, nullptr); check_jvmti_status(jni, err, "event handler: error in JVMTI GetClassSignature call"); - err = jvmti->GetMethodName(frameInfo[idx].method, &methodName, NULL, NULL); + err = jvmti->GetMethodName(frameInfo[idx].method, &methodName, nullptr, nullptr); check_jvmti_status(jni, err, "event handler: error in JVMTI GetMethodName call"); if (strchr(clasSignature, '.')) { @@ -66,11 +66,11 @@ Java_VirtualStackTraceTest_getStackTrace(JNIEnv* jni, jclass clazz) { jvmti->Deallocate(reinterpret_cast(methodName)); jvmti->Deallocate(reinterpret_cast(clasSignature)); } - jobjectArray methodNames = jni->NewObjectArray(count - skipped, jni->FindClass("java/lang/String"), NULL); + jobjectArray methodNames = jni->NewObjectArray(count - skipped, jni->FindClass("java/lang/String"), nullptr); for (int idx = 0; idx < count - skipped; idx++) { jni->SetObjectArrayElement(methodNames, idx, visibleFrames[idx]); } - print_stack_trace(jvmti, jni, NULL); + print_stack_trace(jvmti, jni, nullptr); return methodNames; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualThreadStartTest/libVirtualThreadStartTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualThreadStartTest/libVirtualThreadStartTest.cpp index b4eefa992ef..262712dfb0c 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualThreadStartTest/libVirtualThreadStartTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualThreadStartTest/libVirtualThreadStartTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ extern "C" { static jvmtiEnv *jvmti; static int started_thread_cnt = 0; -static jrawMonitorID agent_event_lock = NULL; +static jrawMonitorID agent_event_lock = nullptr; static const char* TESTED_TNAME_START = "Tested-VT"; static const size_t TESTED_TNAME_START_LEN = strlen(TESTED_TNAME_START); static bool can_support_vt_enabled = false; @@ -40,7 +40,7 @@ void JNICALL ThreadStart(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) { RawMonitorLocker agent_start_locker(jvmti, jni, agent_event_lock); - if (tname != NULL && strncmp(tname, TESTED_TNAME_START, TESTED_TNAME_START_LEN) == 0) { + if (tname != nullptr && strncmp(tname, TESTED_TNAME_START, TESTED_TNAME_START_LEN) == 0) { jboolean is_virtual = jni->IsVirtualThread(thread); if (!is_virtual) { fatal(jni, "Failed: tested thread expected to be virtual"); @@ -59,7 +59,7 @@ void JNICALL VirtualThreadStart(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) { RawMonitorLocker agent_start_locker(jvmti, jni, agent_event_lock); - if (tname != NULL && strncmp(tname, TESTED_TNAME_START, TESTED_TNAME_START_LEN) == 0) { + if (tname != nullptr && strncmp(tname, TESTED_TNAME_START, TESTED_TNAME_START_LEN) == 0) { jboolean is_virtual = jni->IsVirtualThread(thread); if (!is_virtual) { fatal(jni, "Failed: tested thread expected to be virtual"); @@ -101,7 +101,7 @@ jint agent_init(JavaVM *jvm, char *options, void *reserved) { callbacks.ThreadStart = &ThreadStart; callbacks.VirtualThreadStart = &VirtualThreadStart; - if (options != NULL && strcmp(options, "can_support_virtual_threads") == 0) { + if (options != nullptr && strcmp(options, "can_support_virtual_threads") == 0) { can_support_vt_enabled = true; caps.can_support_virtual_threads = 1; @@ -110,13 +110,13 @@ jint agent_init(JavaVM *jvm, char *options, void *reserved) { LOG("Agent init: error in JVMTI AddCapabilities: %s (%d)\n", TranslateError(err), err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); return JNI_ERR; } } else { - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); return JNI_ERR; diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/WaitNotifySuspendedVThreadTest/libWaitNotifySuspendedVThread.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/WaitNotifySuspendedVThreadTest/libWaitNotifySuspendedVThread.cpp index e6ad883944a..44b931c0ff9 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/WaitNotifySuspendedVThreadTest/libWaitNotifySuspendedVThread.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/WaitNotifySuspendedVThreadTest/libWaitNotifySuspendedVThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ set_breakpoint(JNIEnv *jni, jclass klass, const char *mname) { jmethodID method = find_method(jvmti_env, jni, klass, mname); jvmtiError err; - if (method == NULL) { + if (method == nullptr) { jni->FatalError("Error in set_breakpoint: not found method"); } err = jvmti_env->SetBreakpoint(method, location); @@ -56,7 +56,7 @@ Java_WaitNotifySuspendedVThreadTask_setBreakpoint(JNIEnv *jni, jclass klass) { set_breakpoint(jni, klass, "methBreakpoint"); // Enable Breakpoint events globally - err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); check_jvmti_status(jni, err, "enableEvents: error in JVMTI SetEventNotificationMode: enable BREAKPOINT"); LOG("setBreakpoint: finished\n"); @@ -137,7 +137,7 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv * jvmti = NULL; + jvmtiEnv * jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -145,7 +145,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/monitoring/ThreadInfo/GetLockOwnerName/libGetLockOwnerName.cpp b/test/hotspot/jtreg/serviceability/monitoring/ThreadInfo/GetLockOwnerName/libGetLockOwnerName.cpp index ee4fb5c6d8a..cc377667093 100644 --- a/test/hotspot/jtreg/serviceability/monitoring/ThreadInfo/GetLockOwnerName/libGetLockOwnerName.cpp +++ b/test/hotspot/jtreg/serviceability/monitoring/ThreadInfo/GetLockOwnerName/libGetLockOwnerName.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ extern "C" { -static jvmtiEnv* jvmti = NULL; +static jvmtiEnv* jvmti = nullptr; #define LOG(...) \ do { \ @@ -53,7 +53,7 @@ Java_GetLockOwnerName_wait4ContendedEnter(JNIEnv *jni, jclass cls, jthread thr) if (err != JVMTI_ERROR_NONE) { return err; } - if (monitor_ptr != NULL) { + if (monitor_ptr != nullptr) { break; } } diff --git a/test/hotspot/jtreg/testlibrary/jvmti/libJvmtiUtils.cpp b/test/hotspot/jtreg/testlibrary/jvmti/libJvmtiUtils.cpp index 0e7f1eba383..28afafda3a7 100644 --- a/test/hotspot/jtreg/testlibrary/jvmti/libJvmtiUtils.cpp +++ b/test/hotspot/jtreg/testlibrary/jvmti/libJvmtiUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ extern "C" { -static jvmtiEnv* jvmti = NULL; +static jvmtiEnv* jvmti = nullptr; JNIEXPORT jint JNICALL Java_jvmti_JVMTIUtils_init(JNIEnv *jni, jclass cls) { diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/libdefine.cpp b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/libdefine.cpp index 157ea1f92a7..e1b16107e12 100644 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/libdefine.cpp +++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/libdefine.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,14 +44,14 @@ extern "C" { JNIEXPORT jclass JNICALL Java_gc_g1_unloading_classloaders_JNIClassloader_loadThroughJNI0 (JNIEnv * env, jclass clazz, jstring className, jobject classLoader, jbyteArray bytecode) { - const char * classNameChar = env->GetStringUTFChars(className, NULL); - jbyte * arrayContent = env->GetByteArrayElements(bytecode, NULL); + const char * classNameChar = env->GetStringUTFChars(className, nullptr); + jbyte * arrayContent = env->GetByteArrayElements(bytecode, nullptr); jsize bytecodeLength = env->GetArrayLength(bytecode); jclass returnValue = env->DefineClass(classNameChar, classLoader, arrayContent, bytecodeLength); env->ReleaseByteArrayElements(bytecode, arrayContent, JNI_ABORT); env->ReleaseStringUTFChars(className, classNameChar); if (!returnValue) { - printf("ERROR: DefineClass call returned NULL by some reason. Classloading failed.\n"); + printf("ERROR: DefineClass call returned null by some reason. Classloading failed.\n"); } return returnValue; @@ -101,7 +101,7 @@ JNIEXPORT jint JNICALL Java_gc_g1_unloading_loading_ClassLoadingHelper_makeRede classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - jbyte * class_bytes = env->GetByteArrayElements(classBytes, NULL); + jbyte * class_bytes = env->GetByteArrayElements(classBytes, nullptr); classDef.class_bytes = (unsigned char *)class_bytes; if (fl == 2) { @@ -167,7 +167,7 @@ JNIEXPORT void JNICALL Java_gc_g1_unloading_keepref_JNILocalRefHolder_holdWithJN objectToKeepField = env->GetFieldID(clazz, "objectToKeep", "Ljava/lang/Object;"); objectToKeep = env->GetObjectField(thisObject, objectToKeepField); localRef = env->NewLocalRef(objectToKeep); - env->SetObjectField(thisObject, objectToKeepField, NULL); + env->SetObjectField(thisObject, objectToKeepField, nullptr); objectClazz = env->FindClass("Ljava/lang/Object;"); waitMethod = env->GetMethodID(objectClazz, "wait", "()V"); diff --git a/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC03/libnativeGC03.cpp b/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC03/libnativeGC03.cpp index e8520a1ad4f..2c97863db5a 100644 --- a/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC03/libnativeGC03.cpp +++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC03/libnativeGC03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ Java_gc_gctests_nativeGC03_nativeGC03_nativeMethod03 /*Trash all the linked lists */ while (count < 10) { while (i < len) { - env->SetObjectArrayElement(listHolder, i, NULL); + env->SetObjectArrayElement(listHolder, i, nullptr); i++; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp index 932d44e6727..5d819851e4b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *res // can't use NSK_DISPLAY since needed for nsk_ functions initialization isn't done here jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; printf("%s: initialization was done\n", AGENT_NAME); @@ -46,7 +46,7 @@ JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *res if (!NSK_VERIFY(nsk_aod_agentLoaded(jni, AGENT_NAME))) return JNI_ERR; - if (optionsString == NULL) { + if (optionsString == nullptr) { success = 0; printf("%s: ERROR: unexpected null options\n", AGENT_NAME); fflush(stdout); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp index 04949f4d861..d2c5f13cd34 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *res // can't use NSK_DISPLAY since needed for nsk_ functions initialization isn't done here jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; printf("%s: initialization was done\n", AGENT_NAME); @@ -49,7 +49,7 @@ JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *res if (!NSK_VERIFY(nsk_aod_agentLoaded(jni, AGENT_NAME))) return JNI_ERR; - if (optionsString == NULL) { + if (optionsString == nullptr) { success = 0; printf("%s: ERROR: unexpected null options\n", AGENT_NAME); fflush(stdout); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp index b93f3ba03c0..257511c60f3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *res // can't use NSK_DISPLAY since needed for nsk_ functions initialization isn't done here jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; printf("%s: initialization was done\n", AGENT_NAME); @@ -51,7 +51,7 @@ JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *res if (!NSK_VERIFY(nsk_aod_agentLoaded(jni, AGENT_NAME))) return JNI_ERR; - if (optionsString == NULL) { + if (optionsString == nullptr) { success = 0; printf("%s: ERROR: unexpected null options\n", AGENT_NAME); fflush(stdout); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp index 029057cc4b9..66bbc6a990a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *res JNIEnv* jni; jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; // can't use NSK_DISPLAY since needed for nsk_ functions initialization isn't done here diff --git a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine09/agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine09/agent00.cpp index c63187191d9..e7e6452603f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine09/agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine09/agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,18 +44,18 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *optionsString, void *reser } JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) { - JNIEnv* jni = NULL; - Options* options = NULL; + JNIEnv* jni = nullptr; + Options* options = nullptr; const char* agentName; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; NSK_DISPLAY1("%s: initialization was done\n", agentName); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp index 86626181ea3..65ff008a046 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -268,7 +268,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkCapabilities(jvmti, &initCaps, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -295,7 +295,7 @@ JNIEXPORT jint JNI_OnLoad_addcaps001(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -303,7 +303,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -318,7 +318,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #0: Add empty capabilities list in Agent_OnLoad()\n"); @@ -333,7 +333,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp index 54b85588f5c..5853d3db13e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -287,7 +287,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkCapabilities(jvmti, &initCaps, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -314,7 +314,7 @@ JNIEXPORT jint JNI_OnLoad_addcaps002(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -322,7 +322,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -337,7 +337,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&initCaps, 0, sizeof(jvmtiCapabilities)); @@ -356,7 +356,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp index 0f5476edc1d..742d50aaf8e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -136,7 +136,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkCapabilities(jvmti, &initCaps, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -163,7 +163,7 @@ JNIEXPORT jint JNI_OnLoad_addcaps003(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -171,7 +171,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -186,7 +186,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&initCaps, 0, sizeof(jvmtiCapabilities)); @@ -205,7 +205,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload001/agentonload001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload001/agentonload001.cpp index 1aa6e1b6679..b74de21db4e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload001/agentonload001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload001/agentonload001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,13 +67,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY1(" options: \"%s\"\n", nsk_null_string(options)); NSK_DISPLAY1(" reserved: 0x%p\n", (void*)jvm); - if (jvm == NULL) { - NSK_COMPLAIN1("First parameter 'vm' in JVM_OnLoad() is NULL: 0x%p\n", (void*)jvm); + if (jvm == nullptr) { + NSK_COMPLAIN1("First parameter 'vm' in JVM_OnLoad() is null: 0x%p\n", (void*)jvm); status = STATUS_FAILED; } - if (options == NULL) { - NSK_COMPLAIN1("Second parameter 'options' in JVM_OnLoad() is NULL: 0x%p\n", (void*)options); + if (options == nullptr) { + NSK_COMPLAIN1("Second parameter 'options' in JVM_OnLoad() is null: 0x%p\n", (void*)options); status = STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload002/agentonload002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload002/agentonload002.cpp index d591cac18a5..abec073b2f8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload002/agentonload002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload002/agentonload002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,8 +48,8 @@ JNIEXPORT jint JNI_OnLoad_agentonload002(JavaVM *jvm, char *options, void *reser #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - if (options == NULL) { - printf("# ERROR: Second parameter 'options' in JVM_OnLoad() is NULL: 0x%p\n", + if (options == nullptr) { + printf("# ERROR: Second parameter 'options' in JVM_OnLoad() is null: 0x%p\n", (void*)options); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload003/agentonload003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload003/agentonload003.cpp index 9aa1c4a0e58..271bf79be5b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload003/agentonload003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload003/agentonload003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,8 +48,8 @@ JNIEXPORT jint JNI_OnLoad_agentonload003(JavaVM *jvm, char *options, void *reser #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - if (options == NULL) { - printf("# ERROR: Second parameter 'options' in JVM_OnLoad() is NULL: 0x%p\n", + if (options == nullptr) { + printf("# ERROR: Second parameter 'options' in JVM_OnLoad() is null: 0x%p\n", (void*)options); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.cpp index d2df97bdea9..77402be9a4d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ extern "C" { // limit virtual memory (this usually happens on mac). #define MAX_CHUNK_COUNT 8 * 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; #ifdef STATIC_BUILD @@ -59,7 +59,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -71,17 +71,17 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_Allocate_alloc001_Test_check(JNIEnv *env, jclass cls) { jvmtiError err; size_t size; - void *prev = NULL; + void *prev = nullptr; void **mem; int memCount = 1; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } printf(">>> Null pointer check ...\n"); - err = jvmti->Allocate((jlong)1, NULL); + err = jvmti->Allocate((jlong)1, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER, got: %s\n", TranslateError(err)); @@ -135,7 +135,7 @@ Java_nsk_jvmti_Allocate_alloc001_Test_check(JNIEnv *env, jclass cls) { printf(">>> ... done (%dMb)\n", memCount); printf(">>> Deallocation ...\n"); - while (prev != NULL) { + while (prev != nullptr) { mem = (void**) prev; prev = *mem; err = jvmti->Deallocate((unsigned char *)mem); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp index de5229e6b6e..53283bd74ad 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,7 +45,7 @@ extern "C" { // class name in the ClassFileLoadHook callback #define REDEFINED_CLASS_NAME_INTERNAL "nsk/jvmti/AttachOnDemand/attach002/ClassToRedefine" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static volatile jboolean agentGotCapabilities = JNI_FALSE; @@ -152,13 +152,13 @@ void JNICALL classFileLoadHoockHandler( jint * new_class_data_len, unsigned char** new_class_data) { - if (name != NULL) { + if (name != nullptr) { NSK_DISPLAY2("%s: ClassFileLoadHook event received for class '%s'\n", agentName, name); if (!strcmp(name, REDEFINED_CLASS_NAME_INTERNAL)) { classFileLoadHookReceived++; } } else { - NSK_DISPLAY1("%s: ClassFileLoadHook event received for class with NULL name\n", agentName); + NSK_DISPLAY1("%s: ClassFileLoadHook event received for class with null name\n", agentName); } } @@ -177,21 +177,21 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) { jvmtiEventCallbacks eventCallbacks; jvmtiCapabilities caps; - jvmtiEnv* jvmti = NULL; - JNIEnv* jni = NULL; + jvmtiEnv* jvmti = nullptr; + JNIEnv* jni = nullptr; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return NSK_FALSE; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; registerNativeMethods(jni); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp index ccc022edd1f..0ff97a05b20 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ extern "C" { #define REDEFINED_CLASS_NAME "Ljava/lang/InterruptedException;" #define REDEFINED_CLASS_FILE_NAME "java/lang/InterruptedException" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_VM_OBJECT_ALLOC }; @@ -89,21 +89,21 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) { jvmtiEventCallbacks eventCallbacks; jvmtiCapabilities caps; - jvmtiEnv* jvmti = NULL; - JNIEnv* jni = NULL; + jvmtiEnv* jvmti = nullptr; + JNIEnv* jni = nullptr; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return NSK_FALSE; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp index c1e9bce3ee3..b65c1cd6d9f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ extern "C" { #define THREAD_GENERATING_EVENTS_NAME "ThreadGeneratingEvents" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_MONITOR_CONTENDED_ENTER, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED }; @@ -107,21 +107,21 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) { jvmtiEventCallbacks eventCallbacks; jvmtiCapabilities caps; - jvmtiEnv* jvmti = NULL; - JNIEnv* jni = NULL; + jvmtiEnv* jvmti = nullptr; + JNIEnv* jni = nullptr; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return NSK_FALSE; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp index 3256b62582f..62afb281ba2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ extern "C" { * - receive ClassLoad event for class LastLoadedClass and finish work */ -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; #define FIRST_LOADED_CLASS "Lnsk/jvmti/AttachOnDemand/attach009/FirstLoadedClass;" @@ -129,17 +129,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return NSK_FALSE; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&eventCallbacks,0, sizeof(eventCallbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp index 64ab7c0974b..05ee3d82ac5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,23 +49,23 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) #endif { jvmtiEnv* jvmti; - JNIEnv* jni = NULL; - Options* options = NULL; + JNIEnv* jni = nullptr; + Options* options = nullptr; const char* agentName; jvmtiCapabilities caps; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return NSK_FALSE; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp index ce3fa29a4e2..4575d4d7bfb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ extern "C" { * - agent receives ClassLoad event for this class, calls DisposeEnvironment and finishes work */ -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; void JNICALL @@ -88,21 +88,21 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) #endif { jvmtiEventCallbacks eventCallbacks; - jvmtiEnv* jvmti = NULL; - JNIEnv* jni = NULL; + jvmtiEnv* jvmti = nullptr; + JNIEnv* jni = nullptr; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return NSK_FALSE; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&eventCallbacks,0, sizeof(eventCallbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp index a28c912880c..c96519aecf2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ extern "C" { #define CLASS_NAME1 "Lnsk/jvmti/AttachOnDemand/attach015/ClassToLoad1;" #define CLASS_NAME2 "Lnsk/jvmti/AttachOnDemand/attach015/ClassToLoad2;" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static int receivedEventsCount = 0; @@ -81,21 +81,21 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) #endif { jvmtiEventCallbacks eventCallbacks; - jvmtiEnv* jvmti = NULL; - JNIEnv* jni = NULL; + jvmtiEnv* jvmti = nullptr; + JNIEnv* jni = nullptr; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return NSK_FALSE; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&eventCallbacks,0, sizeof(eventCallbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp index 78527c41cc8..eb42625c140 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ extern "C" { #define CLASS_NAME1 "Lnsk/jvmti/AttachOnDemand/attach015/ClassToLoad1;" #define CLASS_NAME2 "Lnsk/jvmti/AttachOnDemand/attach015/ClassToLoad2;" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static int receivedEventsCount = 0; @@ -81,21 +81,21 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) #endif { jvmtiEventCallbacks eventCallbacks; - jvmtiEnv* jvmti = NULL; - JNIEnv* jni = NULL; + jvmtiEnv* jvmti = nullptr; + JNIEnv* jni = nullptr; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&eventCallbacks,0, sizeof(eventCallbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp index 0a229c858a2..7552e2bb936 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ extern "C" { * */ -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_GARBAGE_COLLECTION_START, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH }; @@ -116,10 +116,10 @@ int startAuxiliaryThread(jvmtiEnv* jvmti, JNIEnv* jni) { jthread thread; thread = nsk_jvmti_aod_createThread(jni); - if (!NSK_VERIFY(thread != NULL)) + if (!NSK_VERIFY(thread != nullptr)) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(jvmti->RunAgentThread(thread, auxiliaryThreadFunction, NULL, JVMTI_THREAD_NORM_PRIORITY))) { + if (!NSK_JVMTI_VERIFY(jvmti->RunAgentThread(thread, auxiliaryThreadFunction, nullptr, JVMTI_THREAD_NORM_PRIORITY))) { return NSK_FALSE; } @@ -147,17 +147,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("GCFinishMonitor", &gcFinishMonitor))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp index 9a921d36a6f..cae9a35c8ee 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,7 +48,7 @@ extern "C" { static jvmtiEnv* jvmti; -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; // agent should set success status from objectFreeHandler @@ -74,7 +74,7 @@ Java_nsk_jvmti_AttachOnDemand_attach021_attach021Target_shutdownAgent(JNIEnv * j for any pending ObjectFree events. */ if (jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_OBJECT_FREE, - NULL) != JVMTI_ERROR_NONE) { + nullptr) != JVMTI_ERROR_NONE) { success = 0; } @@ -127,17 +127,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; registerNativeMethods(jni); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp index dfece015378..422cfa01356 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define OBJECTS_FOR_ALLOCATION_TEST_CLASS_NAME "Lnsk/jvmti/AttachOnDemand/attach022/ClassForAllocationEventsTest;" static jvmtiEnv* jvmti; -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_OBJECT_FREE, JVMTI_EVENT_VM_OBJECT_ALLOC }; @@ -174,17 +174,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; registerNativeMethods(jni); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp index c7e22cdd3f0..798c1a77bc1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ extern "C" { #define THREAD_GENERATING_EVENTS_NAME "ThreadGeneratingEvents" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_MONITOR_WAIT, JVMTI_EVENT_MONITOR_WAITED }; @@ -110,17 +110,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp index d2f0767a9a4..6e66ecde85f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ extern "C" { #define THREAD_GENERATING_EVENTS_NAME "ThreadGeneratingEvents" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_THREAD_START, JVMTI_EVENT_THREAD_END }; @@ -106,17 +106,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&eventCallbacks,0, sizeof(eventCallbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp index 7fcea1fac3b..d1ca8919c40 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ extern "C" { #define STARTED_THREAD_NAME "ThreadStartedByAgent" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_THREAD_START, JVMTI_EVENT_THREAD_END }; @@ -52,7 +52,7 @@ volatile int threadWasExecuted = 0; void JNICALL startedThreadFunction(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { char threadName[MAX_STRING_LENGTH]; - if (!nsk_jvmti_aod_getThreadName(jvmti, NULL, threadName)) { + if (!nsk_jvmti_aod_getThreadName(jvmti, nullptr, threadName)) { nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, 0, jvmti, jni); return; } @@ -66,10 +66,10 @@ int startNewThread(jvmtiEnv* jvmti, JNIEnv* jni) { jthread thread; thread = nsk_jvmti_aod_createThreadWithName(jni, STARTED_THREAD_NAME); - if (!NSK_VERIFY(thread != NULL)) + if (!NSK_VERIFY(thread != nullptr)) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(jvmti->RunAgentThread(thread, startedThreadFunction, NULL, JVMTI_THREAD_NORM_PRIORITY))) { + if (!NSK_JVMTI_VERIFY(jvmti->RunAgentThread(thread, startedThreadFunction, nullptr, JVMTI_THREAD_NORM_PRIORITY))) { return NSK_FALSE; } @@ -142,17 +142,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&eventCallbacks,0, sizeof(eventCallbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp index b5ec2fbf809..d4ee65131c5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,7 @@ static jrawMonitorID threadsCounterMonitor; static volatile int testThreadsCounter = 0; -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; void JNICALL threadStartHandler(jvmtiEnv *jvmti, @@ -134,17 +134,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("threadsCounterMonitor", &threadsCounterMonitor))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp index 6934868d6d3..e2aeb3c8dbe 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,14 +40,14 @@ extern "C" { #define STARTED_TEST_THREAD_NAME "attach041-TestThread" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; int tryFindThread(jvmtiEnv *jvmti, jthreadGroup group, const char* threadNameToFind) { jint threadsCount = 0; - jthread *threads = NULL; + jthread *threads = nullptr; jint groupsCount = 0; - jthreadGroup* groups = NULL; + jthreadGroup* groups = nullptr; jvmtiThreadGroupInfo groupInfo; int i; char threadGroupName[MAX_STRING_LENGTH]; @@ -160,17 +160,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&eventCallbacks,0, sizeof(eventCallbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp index 0edaf1107ad..262fd40fd26 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ extern "C" { #define STARTED_TEST_THREAD_NAME "attach042-TestThread" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; void JNICALL threadStartHandler(jvmtiEnv *jvmti, @@ -58,7 +58,7 @@ void JNICALL threadStartHandler(jvmtiEnv *jvmti, if (!strcmp(startedThreadName, STARTED_TEST_THREAD_NAME)) { int success = 1; jint threadsCount = 0; - jthread* threads = NULL; + jthread* threads = nullptr; int i; int startedThreadWasFound = 0; @@ -124,17 +124,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&eventCallbacks,0, sizeof(eventCallbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp index a196150bc81..593f880330d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ extern "C" { #define EXPECTED_EVENTS_NUMBER 500 -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jrawMonitorID eventsCounterMonitor; @@ -98,17 +98,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent00-eventsCounterMonitor", &eventsCounterMonitor))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp index a7ce1343d9e..a3957d5b2ce 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ extern "C" { #define EXPECTED_EVENTS_NUMBER 500 -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jrawMonitorID eventsCounterMonitor; @@ -109,17 +109,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent01-eventsCounterMonitor", &eventsCounterMonitor))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp index f2f05136e6d..a4e08c526f2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ extern "C" { #define EXPECTED_EVENTS_NUMBER 200 -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_THREAD_START, JVMTI_EVENT_THREAD_END }; @@ -129,17 +129,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent02-eventsCounterMonitor", &eventsCounterMonitor))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp index 65bd1604681..7cb7362289d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ extern "C" { #define EXPECTED_EVENTS_NUMBER 500 -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_VM_OBJECT_ALLOC }; @@ -119,17 +119,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent03-eventsCounterMonitor", &eventsCounterMonitor))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp index 0c1e03cf5f0..df01f06eac5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,7 @@ void JNICALL classLoadHandler( Options* options; options = nsk_jvmti_aod_getMultiagentsOptions(jvmti); - if (!NSK_VERIFY(options != NULL)) { + if (!NSK_VERIFY(options != nullptr)) { NSK_COMPLAIN0("Failed to get agents's options\n"); nsk_jvmti_aod_disableEvent(jvmti, JVMTI_EVENT_CLASS_LOAD); // can't call nsk_aod_agentFinished because of without options can't get agent's name @@ -96,23 +96,23 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) { jvmtiEventCallbacks eventCallbacks; jvmtiCapabilities caps; - jvmtiEnv* jvmti = NULL; - JNIEnv* jni = NULL; + jvmtiEnv* jvmti = nullptr; + JNIEnv* jni = nullptr; Options* options; const char* agentName; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return NSK_FALSE; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach050/attach050Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach050/attach050Agent00.cpp index 6a7ceeb4c48..beaca490a34 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach050/attach050Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach050/attach050Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,22 +54,22 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) #endif { jvmtiEnv* jvmti; - JNIEnv* jni = NULL; - Options* options = NULL; + JNIEnv* jni = nullptr; + Options* options = nullptr; const char* agentName; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; NSK_DISPLAY1("%s: initialization was done\n", agentName); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/sharedAgents/simpleAgent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/sharedAgents/simpleAgent00.cpp index d24922f2bfe..8f0f986f05d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/sharedAgents/simpleAgent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/sharedAgents/simpleAgent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,22 +50,22 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) #endif { jvmtiEnv* jvmti; - JNIEnv* jni = NULL; - Options* options = NULL; + JNIEnv* jni = nullptr; + Options* options = nullptr; const char* agentName; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; NSK_DISPLAY1("%s: initialization was done\n", agentName); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp index ef6c10fc9fc..e204e5aedf5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ extern "C" { const char* CLASS_NAME = "nsk/jvmti/ClassFileLoadHook/classfloadhk001"; static jint result = STATUS_FAILED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; /** callback functions **/ @@ -51,7 +51,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *env, jclass class_beeing_redefine jint class_data_len, const unsigned char* class_data, jint *new_class_data_len, unsigned char** new_class_data) { - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { NSK_DISPLAY1("CHECK PASSED: ClassFileLoadHook event received for the class \"%s\" as expected\n", name); result = PASSED; @@ -87,7 +87,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0("setting event callbacks ...\n"); @@ -97,7 +97,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling ClassFileLoadHook event ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling ClassFileLoadHook event done\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp index 520563f459f..976a53cc1c8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ static jlong timeout = 0; #define BYTECODE_FIELD_SIG "[B" #define ORIG_BYTECODE_FIELD_NAME "origClassBytes" -static unsigned char* origClassBytes = NULL; +static unsigned char* origClassBytes = nullptr; static jint origClassSize = 0; static volatile int eventsCount = 0; @@ -59,8 +59,8 @@ static int checkBytecode(const char kind[], jint size, const unsigned char bytes nsk_printHexBytes(" ", 16, size, bytes); } - if (bytes == NULL) { - NSK_COMPLAIN2("Unexpected NULL pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (bytes == nullptr) { + NSK_COMPLAIN2("Unexpected null pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", kind, (void*)bytes); return NSK_FALSE; } @@ -115,14 +115,14 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[], jint* size, unsigned char* *bytes) { - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -130,7 +130,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -144,7 +144,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, { jboolean isCopy; - if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -182,11 +182,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { NSK_DISPLAY0(">>> Obtain original bytecode of tested class\n"); { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -204,7 +204,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEvent event = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK; NSK_DISPLAY1("Enable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0(" ... event enabled\n"); @@ -216,7 +216,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { NSK_DISPLAY0(" ... event disabled\n"); } @@ -261,13 +261,13 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *env, nsk_null_string(name), (void*)loader, (void*)class_being_redefined, (void*)class_data, (int)class_data_len); - if (name != NULL && (strcmp(name, TESTED_CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, TESTED_CLASS_NAME) == 0)) { NSK_DISPLAY1("SUCCESS! CLASS_FILE_LOAD_HOOK for tested class: %s\n", TESTED_CLASS_NAME); eventsCount++; NSK_DISPLAY1("Check class_being_redefined: 0x%p\n", (void*)class_being_redefined); - if (class_being_redefined != NULL) { - NSK_COMPLAIN1("Unexpected not NULL class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (class_being_redefined != nullptr) { + NSK_COMPLAIN1("Unexpected not null class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)class_being_redefined); nsk_jvmti_setFailStatus(); } @@ -294,7 +294,7 @@ JNIEXPORT jint JNI_OnLoad_classfloadhk002(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -304,7 +304,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_generate_eraly_class_hook_events"); @@ -333,7 +333,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp index b9a11398753..d254e93b833 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,9 +45,9 @@ static jlong timeout = 0; #define BYTECODE_FIELD_SIG "[B" #define ORIG_BYTECODE_FIELD_NAME "origClassBytes" -static jobject classLoader = NULL; +static jobject classLoader = nullptr; static jint origClassSize = 0; -static unsigned char* origClassBytes = NULL; +static unsigned char* origClassBytes = nullptr; static volatile int eventsCount = 0; @@ -64,8 +64,8 @@ static int checkBytecode(const char kind[], jint size, const unsigned char bytes nsk_printHexBytes(" ", 16, size, bytes); } - if (bytes == NULL) { - NSK_COMPLAIN2("Unexpected NULL pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (bytes == nullptr) { + NSK_COMPLAIN2("Unexpected null pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", kind, (void*)bytes); return NSK_FALSE; } @@ -120,14 +120,14 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[], jint* size, unsigned char* *bytes) { - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -135,7 +135,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -149,7 +149,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, { jboolean isCopy; - if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -178,28 +178,28 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, static jobject getObject(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[]) { - jfieldID fieldID = NULL; - jobject obj = NULL; + jfieldID fieldID = nullptr; + jobject obj = nullptr; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID); NSK_DISPLAY1("Get object from static field: %s\n", fieldName); - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)obj); NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj); - if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got global ref: 0x%p\n", (void*)obj); @@ -218,12 +218,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0(">>> Obtain debuggee class\n"); NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -232,7 +232,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Obtain classloader of tested class\n"); if (!NSK_VERIFY((classLoader = getObject(jvmti, jni, debugeeClass, CLASSLOADER_FIELD_NAME, - TESTED_CLASSLOADER_SIG)) != NULL)) + TESTED_CLASSLOADER_SIG)) != nullptr)) return; NSK_DISPLAY0(">>> Obtain original bytecode of tested class\n"); @@ -248,7 +248,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEvent event = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK; NSK_DISPLAY1("Enable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0(" ... event enabled\n"); @@ -260,7 +260,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { NSK_DISPLAY0(" ... event disabled\n"); } @@ -308,20 +308,20 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, nsk_null_string(name), (void*)loader, (void*)class_being_redefined, (void*)class_data, (int)class_data_len); - if (name != NULL && (strcmp(name, TESTED_CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, TESTED_CLASS_NAME) == 0)) { NSK_DISPLAY1("SUCCESS! CLASS_FILE_LOAD_HOOK for tested class: %s\n", TESTED_CLASS_NAME); eventsCount++; NSK_DISPLAY1("Check class_being_redefined: 0x%p\n", (void*)class_being_redefined); - if (class_being_redefined != NULL) { - NSK_COMPLAIN1("Unexpected not NULL class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (class_being_redefined != nullptr) { + NSK_COMPLAIN1("Unexpected not null class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)class_being_redefined); nsk_jvmti_setFailStatus(); } NSK_DISPLAY1("Check classloader: 0x%p\n", (void*)loader); - if (loader == NULL) { - NSK_COMPLAIN1("Unexpected NULL classloader in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (loader == nullptr) { + NSK_COMPLAIN1("Unexpected null classloader in CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)loader); nsk_jvmti_setFailStatus(); } else if (!jni->IsSameObject(loader, classLoader)) { @@ -354,7 +354,7 @@ JNIEXPORT jint JNI_OnLoad_classfloadhk003(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -364,7 +364,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_generate_eraly_class_hook_events"); @@ -393,7 +393,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp index 7fe5d9b89d1..e587e45c1da 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ static jlong timeout = 0; #define NEW_BYTECODE_FIELD_NAME "newClassBytes" static jint newClassSize = 0; -static unsigned char* newClassBytes = NULL; +static unsigned char* newClassBytes = nullptr; static volatile int eventsCount = 0; @@ -54,14 +54,14 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[], jint* size, unsigned char* *bytes) { - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -69,7 +69,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -83,7 +83,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, { jboolean isCopy; - if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -121,11 +121,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { NSK_DISPLAY0(">>> Obtain classloader and instrumented bytecode of tested class\n"); { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -143,7 +143,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEvent event = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK; NSK_DISPLAY1("Enable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0(" ... event enabled\n"); @@ -155,7 +155,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { NSK_DISPLAY0(" ... event disabled\n"); } @@ -196,7 +196,7 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, nsk_null_string(name), (void*)loader, (void*)class_being_redefined, (void*)class_data, (int)class_data_len); - if (name != NULL && (strcmp(name, TESTED_CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, TESTED_CLASS_NAME) == 0)) { NSK_DISPLAY1("SUCCESS! CLASS_FILE_LOAD_HOOK for tested class: %s\n", TESTED_CLASS_NAME); eventsCount++; @@ -207,20 +207,20 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, } NSK_DISPLAY1("Check pointer to new_class_data_len: 0x%p\n", (void*)new_class_data_len); - if (new_class_data_len == NULL) { - NSK_COMPLAIN1("NULL new_class_data_len pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (new_class_data_len == nullptr) { + NSK_COMPLAIN1("null new_class_data_len pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)new_class_data_len); nsk_jvmti_setFailStatus(); } NSK_DISPLAY1("Check pointer to new_class_data: 0x%p\n", (void*)new_class_data); - if (new_class_data == NULL) { - NSK_COMPLAIN1("NULL new_class_data pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (new_class_data == nullptr) { + NSK_COMPLAIN1("null new_class_data pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)new_class_data); nsk_jvmti_setFailStatus(); } - if (new_class_data_len != NULL && new_class_data != NULL) { + if (new_class_data_len != nullptr && new_class_data != nullptr) { NSK_DISPLAY2("Replace with new bytecode: 0x%p:%d\n", (void*)newClassBytes, (int)newClassSize); if (nsk_getVerboseMode()) { @@ -248,7 +248,7 @@ JNIEXPORT jint JNI_OnLoad_classfloadhk004(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -258,7 +258,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_generate_eraly_class_hook_events"); @@ -287,7 +287,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp index 937d8d4a3e2..112f0dda0e9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ static jlong timeout = 0; #define NEW_BYTECODE_FIELD_NAME "newClassBytes" static jint newClassSize = 0; -static unsigned char* newClassBytes = NULL; +static unsigned char* newClassBytes = nullptr; static volatile int eventsCount = 0; @@ -60,8 +60,8 @@ static int checkBytecode(const char kind[], jint size, const unsigned char bytes nsk_printHexBytes(" ", 16, size, bytes); } - if (bytes == NULL) { - NSK_COMPLAIN2("Unexpected NULL pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (bytes == nullptr) { + NSK_COMPLAIN2("Unexpected null pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", kind, (void*)bytes); return NSK_FALSE; } @@ -116,14 +116,14 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[], jint* size, unsigned char* *bytes) { - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -131,7 +131,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -145,7 +145,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, { jboolean isCopy; - if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -183,11 +183,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { NSK_DISPLAY0(">>> Obtain classloader and instrumented bytecode of tested class\n"); { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -205,7 +205,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEvent event = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK; NSK_DISPLAY1("Enable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0(" ... event enabled\n"); @@ -217,7 +217,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { NSK_DISPLAY0(" ... event disabled\n"); } @@ -258,7 +258,7 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, nsk_null_string(name), (void*)loader, (void*)class_being_redefined, (void*)class_data, (int)class_data_len); - if (name != NULL && (strcmp(name, TESTED_CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, TESTED_CLASS_NAME) == 0)) { NSK_DISPLAY1("SUCCESS! CLASS_FILE_LOAD_HOOK for tested class: %s\n", TESTED_CLASS_NAME); eventsCount++; @@ -269,20 +269,20 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, } NSK_DISPLAY1("Check pointer to new_class_data_len: 0x%p\n", (void*)new_class_data_len); - if (new_class_data_len == NULL) { - NSK_COMPLAIN1("NULL new_class_data_len pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (new_class_data_len == nullptr) { + NSK_COMPLAIN1("null new_class_data_len pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)new_class_data_len); nsk_jvmti_setFailStatus(); } NSK_DISPLAY1("Check pointer to new_class_data: 0x%p\n", (void*)new_class_data); - if (new_class_data == NULL) { - NSK_COMPLAIN1("NULL new_class_data pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (new_class_data == nullptr) { + NSK_COMPLAIN1("null new_class_data pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)new_class_data); nsk_jvmti_setFailStatus(); } - if (new_class_data_len != NULL && new_class_data != NULL) { + if (new_class_data_len != nullptr && new_class_data != nullptr) { NSK_DISPLAY2("Replace with instrumented bytecode: 0x%p:%d\n", (void*)newClassBytes, (int)newClassSize); if (nsk_getVerboseMode()) { @@ -310,7 +310,7 @@ JNIEXPORT jint JNI_OnLoad_classfloadhk005(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -320,7 +320,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_generate_eraly_class_hook_events"); @@ -349,7 +349,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp index 41d48e5a484..31414b4ed90 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,10 +45,10 @@ static jlong timeout = 0; #define TESTED_CLASS_FIELD_NAME "testedClass" #define TESTED_CLASS_FIELD_SIG "Ljava/lang/Class;" -static jclass testedClass = NULL; +static jclass testedClass = nullptr; static jint redefClassSize = 0; -static unsigned char* redefClassBytes = NULL; +static unsigned char* redefClassBytes = nullptr; static volatile int eventsCount = 0; @@ -65,8 +65,8 @@ static int checkBytecode(const char kind[], jint size, const unsigned char bytes nsk_printHexBytes(" ", 16, size, bytes); } - if (bytes == NULL) { - NSK_COMPLAIN2("Unexpected NULL pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (bytes == nullptr) { + NSK_COMPLAIN2("Unexpected null pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", kind, (void*)bytes); return NSK_FALSE; } @@ -121,14 +121,14 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[], jint* size, unsigned char* *bytes) { - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -136,7 +136,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -150,7 +150,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, { jboolean isCopy; - if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -179,28 +179,28 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, static jobject getObject(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[]) { - jfieldID fieldID = NULL; - jobject obj = NULL; + jfieldID fieldID = nullptr; + jobject obj = nullptr; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID); NSK_DISPLAY1("Get object from static field: %s\n", fieldName); - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)obj); NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj); - if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got global ref: 0x%p\n", (void*)obj); @@ -238,12 +238,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0(">>> Obtain debuggee class\n"); NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -252,7 +252,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Obtain tested class object\n"); if (!NSK_VERIFY((testedClass = (jclass) getObject(jvmti, jni, debugeeClass, TESTED_CLASS_FIELD_NAME, - TESTED_CLASS_FIELD_SIG)) != NULL)) + TESTED_CLASS_FIELD_SIG)) != nullptr)) return; NSK_DISPLAY0(">>> Obtain redefined bytecode of tested class\n"); @@ -275,7 +275,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEvent event = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK; NSK_DISPLAY1("Enable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0(" ... event enabled\n"); @@ -283,7 +283,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { redefClassSize, redefClassBytes)); NSK_DISPLAY1("Disable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { NSK_DISPLAY0(" ... event disabled\n"); } @@ -330,13 +330,13 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, nsk_null_string(name), (void*)loader, (void*)class_being_redefined, (void*)class_data, (int)class_data_len); - if (name != NULL && (strcmp(name, TESTED_CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, TESTED_CLASS_NAME) == 0)) { NSK_DISPLAY1("SUCCESS! CLASS_FILE_LOAD_HOOK for tested class: %s\n", TESTED_CLASS_NAME); eventsCount++; NSK_DISPLAY1("Check class_being_redefined: 0x%p\n", (void*)class_being_redefined); - if (class_being_redefined == NULL) { - NSK_COMPLAIN1("Unexpected NULL class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (class_being_redefined == nullptr) { + NSK_COMPLAIN1("Unexpected null class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)class_being_redefined); nsk_jvmti_setFailStatus(); } else if (!jni->IsSameObject(class_being_redefined, testedClass)) { @@ -369,7 +369,7 @@ JNIEXPORT jint JNI_OnLoad_classfloadhk006(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -379,7 +379,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capabilities: %s\n", "can_generate_eraly_class_hook_events, can_redefine_classes"); @@ -409,7 +409,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp index 8c1f686361a..7107ccfdf41 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,11 +48,11 @@ static jlong timeout = 0; #define TESTED_CLASS_FIELD_NAME "testedClass" #define TESTED_CLASS_FIELD_SIG "Ljava/lang/Class;" -static jobject classLoader = NULL; -static jclass testedClass = NULL; +static jobject classLoader = nullptr; +static jclass testedClass = nullptr; static jint redefClassSize = 0; -static unsigned char* redefClassBytes = NULL; +static unsigned char* redefClassBytes = nullptr; static volatile int eventsCount = 0; @@ -69,8 +69,8 @@ static int checkBytecode(const char kind[], jint size, const unsigned char bytes nsk_printHexBytes(" ", 16, size, bytes); } - if (bytes == NULL) { - NSK_COMPLAIN2("Unexpected NULL pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (bytes == nullptr) { + NSK_COMPLAIN2("Unexpected null pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", kind, (void*)bytes); return NSK_FALSE; } @@ -125,14 +125,14 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[], jint* size, unsigned char* *bytes) { - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -140,7 +140,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -154,7 +154,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, { jboolean isCopy; - if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -183,28 +183,28 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, static jobject getObject(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[]) { - jfieldID fieldID = NULL; - jobject obj = NULL; + jfieldID fieldID = nullptr; + jobject obj = nullptr; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID); NSK_DISPLAY1("Get object from static field: %s\n", fieldName); - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)obj); NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj); - if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got global ref: 0x%p\n", (void*)obj); @@ -242,12 +242,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0(">>> Obtain debuggee class\n"); NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -256,13 +256,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Obtain tested class object\n"); if (!NSK_VERIFY((testedClass = (jclass) getObject(jvmti, jni, debugeeClass, TESTED_CLASS_FIELD_NAME, - TESTED_CLASS_FIELD_SIG)) != NULL)) + TESTED_CLASS_FIELD_SIG)) != nullptr)) return; NSK_DISPLAY0(">>> Obtain classloader object\n"); if (!NSK_VERIFY((classLoader = getObject(jvmti, jni, debugeeClass, CLASSLOADER_FIELD_NAME, - TESTED_CLASSLOADER_SIG)) != NULL)) + TESTED_CLASSLOADER_SIG)) != nullptr)) return; NSK_DISPLAY0(">>> Obtain redefined bytecode of tested class\n"); @@ -285,7 +285,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEvent event = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK; NSK_DISPLAY1("Enable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0(" ... event enabled\n"); @@ -293,7 +293,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { redefClassSize, redefClassBytes)); NSK_DISPLAY1("Disable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { NSK_DISPLAY0(" ... event disabled\n"); } @@ -343,13 +343,13 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, nsk_null_string(name), (void*)loader, (void*)class_being_redefined, (void*)class_data, (int)class_data_len); - if (name != NULL && (strcmp(name, TESTED_CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, TESTED_CLASS_NAME) == 0)) { NSK_DISPLAY1("SUCCESS! CLASS_FILE_LOAD_HOOK for tested class: %s\n", TESTED_CLASS_NAME); eventsCount++; NSK_DISPLAY1("Check classloader: 0x%p\n", (void*)loader); - if (loader == NULL) { - NSK_COMPLAIN1("Unexpected NULL classloader in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (loader == nullptr) { + NSK_COMPLAIN1("Unexpected null classloader in CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)loader); nsk_jvmti_setFailStatus(); } else if (!jni->IsSameObject(loader, classLoader)) { @@ -361,8 +361,8 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, } NSK_DISPLAY1("Check class_being_redefined: 0x%p\n", (void*)class_being_redefined); - if (class_being_redefined == NULL) { - NSK_COMPLAIN1("Unexpected NULL class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (class_being_redefined == nullptr) { + NSK_COMPLAIN1("Unexpected null class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)class_being_redefined); nsk_jvmti_setFailStatus(); } else if (!jni->IsSameObject(class_being_redefined, testedClass)) { @@ -395,7 +395,7 @@ JNIEXPORT jint JNI_OnLoad_classfloadhk007(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -405,7 +405,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capabilities: %s\n", "can_generate_eraly_class_hook_events, can_redefine_classes"); @@ -435,7 +435,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp index 7f18912194d..01ea3da04a6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,13 +46,13 @@ static jlong timeout = 0; #define TESTED_CLASS_FIELD_NAME "testedClass" #define TESTED_CLASS_FIELD_SIG "Ljava/lang/Class;" -static jclass testedClass = NULL; +static jclass testedClass = nullptr; static jint redefClassSize = 0; -static unsigned char* redefClassBytes = NULL; +static unsigned char* redefClassBytes = nullptr; static jint newClassSize = 0; -static unsigned char* newClassBytes = NULL; +static unsigned char* newClassBytes = nullptr; static volatile int eventsCount = 0; @@ -63,14 +63,14 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[], jint* size, unsigned char* *bytes) { - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -78,7 +78,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -92,7 +92,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, { jboolean isCopy; - if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -121,28 +121,28 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, static jobject getObject(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[]) { - jfieldID fieldID = NULL; - jobject obj = NULL; + jfieldID fieldID = nullptr; + jobject obj = nullptr; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID); NSK_DISPLAY1("Get object from static field: %s\n", fieldName); - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)obj); NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj); - if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got global ref: 0x%p\n", (void*)obj); @@ -180,12 +180,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0(">>> Obtain debuggee class\n"); NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -194,7 +194,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Obtain tested class object\n"); if (!NSK_VERIFY((testedClass = (jclass) getObject(jvmti, jni, debugeeClass, TESTED_CLASS_FIELD_NAME, - TESTED_CLASS_FIELD_SIG)) != NULL)) + TESTED_CLASS_FIELD_SIG)) != nullptr)) return; NSK_DISPLAY0(">>> Obtain redefined bytecode of tested class\n"); @@ -224,7 +224,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEvent event = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK; NSK_DISPLAY1("Enable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0(" ... event enabled\n"); @@ -232,7 +232,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { redefClassSize, redefClassBytes)); NSK_DISPLAY1("Disable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { NSK_DISPLAY0(" ... event disabled\n"); } @@ -279,7 +279,7 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, nsk_null_string(name), (void*)loader, (void*)class_being_redefined, (void*)class_data, (int)class_data_len); - if (name != NULL && (strcmp(name, TESTED_CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, TESTED_CLASS_NAME) == 0)) { NSK_DISPLAY1("SUCCESS! CLASS_FILE_LOAD_HOOK for tested class: %s\n", TESTED_CLASS_NAME); eventsCount++; @@ -290,20 +290,20 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, } NSK_DISPLAY1("Check pointer to new_class_data_len: 0x%p\n", (void*)new_class_data_len); - if (new_class_data_len == NULL) { - NSK_COMPLAIN1("NULL new_class_data_len pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (new_class_data_len == nullptr) { + NSK_COMPLAIN1("null new_class_data_len pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)new_class_data_len); nsk_jvmti_setFailStatus(); } NSK_DISPLAY1("Check pointer to new_class_data: 0x%p\n", (void*)new_class_data); - if (new_class_data == NULL) { - NSK_COMPLAIN1("NULL new_class_data pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (new_class_data == nullptr) { + NSK_COMPLAIN1("null new_class_data pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)new_class_data); nsk_jvmti_setFailStatus(); } - if (new_class_data_len != NULL && new_class_data != NULL) { + if (new_class_data_len != nullptr && new_class_data != nullptr) { NSK_DISPLAY2("Replace with new instrumented bytecode: 0x%p:%d\n", (void*)newClassBytes, (int)newClassSize); if (nsk_getVerboseMode()) { @@ -331,7 +331,7 @@ JNIEXPORT jint JNI_OnLoad_classfloadhk008(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -341,7 +341,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capabilities: %s\n", "can_generate_eraly_class_hook_events, can_redefine_classes"); @@ -371,7 +371,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp index e4a2067772c..296c10cb84a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,13 +46,13 @@ static jlong timeout = 0; #define TESTED_CLASS_FIELD_NAME "testedClass" #define TESTED_CLASS_FIELD_SIG "Ljava/lang/Class;" -static jclass testedClass = NULL; +static jclass testedClass = nullptr; static jint redefClassSize = 0; -static unsigned char* redefClassBytes = NULL; +static unsigned char* redefClassBytes = nullptr; static jint newClassSize = 0; -static unsigned char* newClassBytes = NULL; +static unsigned char* newClassBytes = nullptr; static volatile int eventsCount = 0; @@ -63,14 +63,14 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[], jint* size, unsigned char* *bytes) { - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -78,7 +78,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -92,7 +92,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, { jboolean isCopy; - if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -121,28 +121,28 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, static jobject getObject(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[]) { - jfieldID fieldID = NULL; - jobject obj = NULL; + jfieldID fieldID = nullptr; + jobject obj = nullptr; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID); NSK_DISPLAY1("Get object from static field: %s\n", fieldName); - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)obj); NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj); - if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got global ref: 0x%p\n", (void*)obj); @@ -180,12 +180,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0(">>> Obtain debuggee class\n"); NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -194,7 +194,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Obtain tested class object\n"); if (!NSK_VERIFY((testedClass = (jclass) getObject(jvmti, jni, debugeeClass, TESTED_CLASS_FIELD_NAME, - TESTED_CLASS_FIELD_SIG)) != NULL)) + TESTED_CLASS_FIELD_SIG)) != nullptr)) return; NSK_DISPLAY0(">>> Obtain redefined bytecode of tested class\n"); @@ -224,7 +224,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEvent event = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK; NSK_DISPLAY1("Enable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0(" ... event enabled\n"); @@ -232,7 +232,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { redefClassSize, redefClassBytes)); NSK_DISPLAY1("Disable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { NSK_DISPLAY0(" ... event disabled\n"); } @@ -279,7 +279,7 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, nsk_null_string(name), (void*)loader, (void*)class_being_redefined, (void*)class_data, (int)class_data_len); - if (name != NULL && (strcmp(name, TESTED_CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, TESTED_CLASS_NAME) == 0)) { NSK_DISPLAY1("SUCCESS! CLASS_FILE_LOAD_HOOK for tested class: %s\n", TESTED_CLASS_NAME); eventsCount++; @@ -290,20 +290,20 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, } NSK_DISPLAY1("Check pointer to new_class_data_len: 0x%p\n", (void*)new_class_data_len); - if (new_class_data_len == NULL) { - NSK_COMPLAIN1("NULL new_class_data_len pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (new_class_data_len == nullptr) { + NSK_COMPLAIN1("null new_class_data_len pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)new_class_data_len); nsk_jvmti_setFailStatus(); } NSK_DISPLAY1("Check pointer to new_class_data: 0x%p\n", (void*)new_class_data); - if (new_class_data == NULL) { - NSK_COMPLAIN1("NULL new_class_data pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (new_class_data == nullptr) { + NSK_COMPLAIN1("null new_class_data pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)new_class_data); nsk_jvmti_setFailStatus(); } - if (new_class_data_len != NULL && new_class_data != NULL) { + if (new_class_data_len != nullptr && new_class_data != nullptr) { NSK_DISPLAY2("Replace with new instrumented bytecode: 0x%p:%d\n", (void*)newClassBytes, (int)newClassSize); if (nsk_getVerboseMode()) { @@ -331,7 +331,7 @@ JNIEXPORT jint JNI_OnLoad_classfloadhk009(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -341,7 +341,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capabilities: %s\n", "can_generate_eraly_class_hook_events, can_redefine_classes"); @@ -371,7 +371,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk001/clrbrk001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk001/clrbrk001.cpp index 07540af5bf0..cae177d2537 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk001/clrbrk001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk001/clrbrk001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -62,12 +62,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -102,7 +102,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); @@ -118,7 +118,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_nsk_jvmti_ClearBreakpoint_clrbrk001_getReady(JNIEnv *env, jclass cls, jint i) { mid = env->GetStaticMethodID(cls, "trial", "(I)I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find method \"trial(I)I\"\n"); result = STATUS_FAILED; } else { @@ -129,7 +129,7 @@ Java_nsk_jvmti_ClearBreakpoint_clrbrk001_getReady(JNIEnv *env, jclass cls, jint JNIEXPORT void JNICALL Java_nsk_jvmti_ClearBreakpoint_clrbrk001_setBP(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return; } @@ -138,7 +138,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_ClearBreakpoint_clrbrk001_setBP(JNIEnv *en return; } - if (mid == NULL) { + if (mid == nullptr) { return; } @@ -153,7 +153,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_ClearBreakpoint_clrbrk001_setBP(JNIEnv *en JNIEXPORT void JNICALL Java_nsk_jvmti_ClearBreakpoint_clrbrk001_clearBP(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return; } @@ -162,7 +162,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_ClearBreakpoint_clrbrk001_clearBP(JNIEnv * return; } - if (mid == NULL) { + if (mid == nullptr) { return; } @@ -176,7 +176,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_ClearBreakpoint_clrbrk001_clearBP(JNIEnv * JNIEXPORT jint JNICALL Java_nsk_jvmti_ClearBreakpoint_clrbrk001_check(JNIEnv *env, jclass cls) { - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk002/clrbrk002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk002/clrbrk002.cpp index 79fde2ad9f2..e61a953186d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk002/clrbrk002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk002/clrbrk002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -98,7 +98,7 @@ Java_nsk_jvmti_ClearBreakpoint_clrbrk002_check(JNIEnv *env, jclass cls) { jlocation start; jlocation end; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -108,7 +108,7 @@ Java_nsk_jvmti_ClearBreakpoint_clrbrk002_check(JNIEnv *env, jclass cls) { } mid = env->GetStaticMethodID(cls, "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find method run\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk005/clrbrk005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk005/clrbrk005.cpp index f431e14ef10..d845833d94b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk005/clrbrk005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk005/clrbrk005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ Java_nsk_jvmti_ClearBreakpoint_clrbrk005_check(JNIEnv *env, jclass cls) { jvmtiError err; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -114,7 +114,7 @@ Java_nsk_jvmti_ClearBreakpoint_clrbrk005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->ClearBreakpoint(NULL, 0); + err = jvmti->ClearBreakpoint(nullptr, 0); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001/clrfldw001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001/clrfldw001.cpp index b40cf1e70fa..09561cd971b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001/clrfldw001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001/clrfldw001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,14 +45,14 @@ static jvmtiEnv *jvmti; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; -static jfieldID thrown_fid = NULL; +static jfieldID thrown_fid = nullptr; static field fields[] = { - { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001", "fld0", "I", 0, NULL }, - { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001", "fld1", "I", 1, NULL }, + { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001", "fld0", "I", 0, nullptr }, + { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001", "fld1", "I", 1, nullptr }, { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001", "fld2", - "Lnsk/jvmti/ClearFieldAccessWatch/clrfldw001a;", 0, NULL }, - { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001a", "fld3", "[I", 0, NULL }, - { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001b", "fld4", "F", 0, NULL }, + "Lnsk/jvmti/ClearFieldAccessWatch/clrfldw001a;", 0, nullptr }, + { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001a", "fld3", "[I", 0, nullptr }, + { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001b", "fld4", "F", 0, nullptr }, }; void switchWatch(JNIEnv *env, jint ind, jboolean on) { @@ -62,7 +62,7 @@ void switchWatch(JNIEnv *env, jint ind, jboolean on) { const char *msg; cls = env->FindClass(fld.klass); - if (fld.fid == NULL) { + if (fld.fid == nullptr) { if (fld.stat) { fields[ind].fid = env->GetStaticFieldID(cls, fld.name, fld.sig); } else { @@ -109,7 +109,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -145,7 +145,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err); @@ -182,7 +182,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_ClearFieldAccessWatch_clrfldw001_check(JNIEnv *env, jclass cls, jint fld_ind, jboolean flag) { if (caps.can_generate_field_access_events) { - if (flag == JNI_FALSE && thrown_fid != NULL) { + if (flag == JNI_FALSE && thrown_fid != nullptr) { result = STATUS_FAILED; printf("(Field %d) FIELD_ACCESS event without access watch set\n", fld_ind); @@ -191,7 +191,7 @@ Java_nsk_jvmti_ClearFieldAccessWatch_clrfldw001_check(JNIEnv *env, printf("(Field %d) thrown field ID expected: 0x%p, got: 0x%p\n", fld_ind, fields[fld_ind].fid, thrown_fid); } - thrown_fid = NULL; + thrown_fid = nullptr; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw002/clrfldw002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw002/clrfldw002.cpp index 889c2781623..4ae421245ee 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw002/clrfldw002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw002/clrfldw002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,7 +59,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err); @@ -125,14 +125,14 @@ Java_nsk_jvmti_ClearFieldAccessWatch_clrfldw002_check(JNIEnv *env, jclass cls) { TranslateError(err), err); } } else { - err = jvmti->ClearFieldAccessWatch(NULL, fid2); + err = jvmti->ClearFieldAccessWatch(nullptr, fid2); if (err != JVMTI_ERROR_INVALID_CLASS) { result = STATUS_FAILED; printf("Failed to return JVMTI_ERROR_INVALID_CLASS: %s (%d)\n", TranslateError(err), err); } - err = jvmti->ClearFieldAccessWatch(cls, NULL); + err = jvmti->ClearFieldAccessWatch(cls, nullptr); if (err != JVMTI_ERROR_INVALID_FIELDID) { result = STATUS_FAILED; printf("Failed to return INVALID_FIELDID: %s (%d)\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001/clrfmodw001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001/clrfmodw001.cpp index 46e0dffa21c..eaf686e623e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001/clrfmodw001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001/clrfmodw001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,14 +45,14 @@ static jvmtiEnv *jvmti; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; -static jfieldID thrown_fid = NULL; +static jfieldID thrown_fid = nullptr; static field fields[] = { - { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001", "fld0", "I", 0, NULL }, - { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001", "fld1", "I", 1, NULL }, + { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001", "fld0", "I", 0, nullptr }, + { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001", "fld1", "I", 1, nullptr }, { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001", "fld2", - "Lnsk/jvmti/ClearFieldModificationWatch/clrfmodw001a;", 0, NULL }, - { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001a", "fld3", "[I", 0, NULL }, - { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001b", "fld4", "F", 0, NULL }, + "Lnsk/jvmti/ClearFieldModificationWatch/clrfmodw001a;", 0, nullptr }, + { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001a", "fld3", "[I", 0, nullptr }, + { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001b", "fld4", "F", 0, nullptr }, }; void switchWatch(JNIEnv *env, jint ind, jboolean on) { @@ -62,7 +62,7 @@ void switchWatch(JNIEnv *env, jint ind, jboolean on) { const char *msg; cls = env->FindClass(fld.klass); - if (fld.fid == NULL) { + if (fld.fid == nullptr) { if (fld.stat) { fields[ind].fid = env->GetStaticFieldID(cls, fld.name, fld.sig); } else { @@ -109,7 +109,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -145,7 +145,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_FIELD_MODIFICATION: %s (%d)\n", TranslateError(err), err); @@ -175,7 +175,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_ClearFieldModificationWatch_clrfmodw001_to JNIEXPORT void JNICALL Java_nsk_jvmti_ClearFieldModificationWatch_clrfmodw001_check(JNIEnv *env, jclass cls, jint fld_ind, jboolean flag) { if (caps.can_generate_field_modification_events) { - if (flag == JNI_FALSE && thrown_fid != NULL) { + if (flag == JNI_FALSE && thrown_fid != nullptr) { result = STATUS_FAILED; printf("(Field %d) ", fld_ind); printf("FieldModification event without modification watch set\n"); @@ -184,7 +184,7 @@ Java_nsk_jvmti_ClearFieldModificationWatch_clrfmodw001_check(JNIEnv *env, jclass printf("(Field %d) thrown field ID expected: 0x%p, got: 0x%p\n", fld_ind, fields[fld_ind].fid, thrown_fid); } - thrown_fid = NULL; + thrown_fid = nullptr; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw002/clrfmodw002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw002/clrfmodw002.cpp index 127653e5010..329e8c32a2c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw002/clrfmodw002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw002/clrfmodw002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,7 +60,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_FIELD_MODIFICATION: %s (%d)\n", TranslateError(err), err); @@ -127,14 +127,14 @@ Java_nsk_jvmti_ClearFieldModificationWatch_clrfmodw002_check(JNIEnv *env, TranslateError(err), err); } } else { - err = jvmti->ClearFieldModificationWatch(NULL, fid2); + err = jvmti->ClearFieldModificationWatch(nullptr, fid2); if (err != JVMTI_ERROR_INVALID_CLASS) { result = STATUS_FAILED; printf("Failed to return JVMTI_ERROR_INVALID_CLASS: %s (%d)\n", TranslateError(err), err); } - err = jvmti->ClearFieldModificationWatch(cls, NULL); + err = jvmti->ClearFieldModificationWatch(cls, nullptr); if (err != JVMTI_ERROR_INVALID_FIELDID) { result = STATUS_FAILED; printf("Failed to return INVALID_FIELDID: %s (%d)\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp index a75546f9bdd..f70ded6238a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ extern "C" { #define PASSED 0 static volatile jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -113,7 +113,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to generate compiled method events */ @@ -137,9 +137,9 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling VMInit, CompiledMethodLoad event ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp index 7b048a2202f..e3b50a0474e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ extern "C" { static volatile jint result = PASSED; static volatile int compunload = 0; static volatile int class_unloaded = 0; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -88,7 +88,7 @@ CompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method, NSK_DISPLAY0("CompiledMethodUnload event received\n"); // Check for the case that the class has been unloaded - err = jvmti_env->GetMethodName(method, &name, &sig, NULL); + err = jvmti_env->GetMethodName(method, &name, &sig, nullptr); if (err == JVMTI_ERROR_NONE) { NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n", name, sig, code_addr); @@ -157,7 +157,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to generate compiled method events */ @@ -182,11 +182,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon001/crrawmon001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon001/crrawmon001.cpp index 4e8af24dc49..d2a0073b2ae 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon001/crrawmon001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon001/crrawmon001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define RAW_MONITORS_NUMBER 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -57,7 +57,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) { printf("(CreateRawMonitor#%d) unexpected error: %s (%d)\n", i, TranslateError(err), err); result = STATUS_FAILED; - } else if (monitors[i] == NULL) { + } else if (monitors[i] == nullptr) { printf("(CreateRawMonitor#%d) jrawMonitorID is null\n", i); result = STATUS_FAILED; } @@ -79,12 +79,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -98,7 +98,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon002/crrawmon002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon002/crrawmon002.cpp index 65edf664342..12519a57c2a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon002/crrawmon002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon002/crrawmon002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_crrawmon002(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_CreateRawMonitor_crrawmon002_check(JNIEnv *env, jclass cls) { jvmtiError err; jrawMonitorID monitor; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_CreateRawMonitor_crrawmon002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> name null pointer check ...\n"); } - err = jvmti->CreateRawMonitor(NULL, &monitor); + err = jvmti->CreateRawMonitor(nullptr, &monitor); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER, got: %s\n", TranslateError(err)); @@ -87,7 +87,7 @@ Java_nsk_jvmti_CreateRawMonitor_crrawmon002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> monitorPtr null pointer check ...\n"); } - err = jvmti->CreateRawMonitor("dummy", NULL); + err = jvmti->CreateRawMonitor("dummy", nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER, got: %s\n", TranslateError(err)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp index 61994f9b6a6..5a8843e6e38 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ extern "C" { #define PASSED 0 static jint result = STATUS_FAILED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jboolean eventReceived = JNI_FALSE; @@ -106,7 +106,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) { + if (!NSK_VERIFY(jvmti != nullptr)) { return JNI_ERR; } @@ -122,7 +122,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DATA_DUMP_REQUEST, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DATA_DUMP_REQUEST, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Deallocate/dealloc001/dealloc001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Deallocate/dealloc001/dealloc001.cpp index 3aac4d41b95..82ea6825b63 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Deallocate/dealloc001/dealloc001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Deallocate/dealloc001/dealloc001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_dealloc001(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_Deallocate_dealloc001_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -76,7 +76,7 @@ Java_nsk_jvmti_Deallocate_dealloc001_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> Null pointer check ...\n"); } - err = jvmti->Deallocate(NULL); + err = jvmti->Deallocate(nullptr); if (err != JVMTI_ERROR_NONE) { printf("Error expected: JVMTI_ERROR_NONE, got: %s\n", TranslateError(err)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon001/drrawmon001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon001/drrawmon001.cpp index 35f2e6557f2..341da0a65b3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon001/drrawmon001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon001/drrawmon001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define RAW_MONITORS_NUMBER 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -58,7 +58,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) { i, TranslateError(err), err); result = STATUS_FAILED; return; - } else if (monitors[i] == NULL) { + } else if (monitors[i] == nullptr) { printf("(CreateRawMonitor#%d) jrawMonitorID is null\n", i); result = STATUS_FAILED; return; @@ -94,12 +94,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -113,7 +113,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon003/drrawmon003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon003/drrawmon003.cpp index 451be8b3bc8..22765b973d8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon003/drrawmon003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon003/drrawmon003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jboolean printdump = JNI_FALSE; #ifdef STATIC_BUILD @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_drrawmon003(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_DestroyRawMonitor_drrawmon003_check(JNIEnv *env, jclass cls) { jvmtiError err; jrawMonitorID monitor; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon004/drrawmon004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon004/drrawmon004.cpp index 18e322e2438..154e98fe12f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon004/drrawmon004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon004/drrawmon004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_drrawmon004(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_DestroyRawMonitor_drrawmon004_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_DestroyRawMonitor_drrawmon004_check(JNIEnv *env, jclass cls) { printf(">>> invalid monitor check ...\n"); } - err = jvmti->DestroyRawMonitor(NULL); + err = jvmti->DestroyRawMonitor(nullptr); if (err != JVMTI_ERROR_INVALID_MONITOR) { printf("Error expected: JVMTI_ERROR_INVALID_MONITOR,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp index 43dc539ab3f..b652a8259dd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,13 +44,13 @@ JNIEXPORT jint JNI_OnLoad_disposeenv001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Dispose JVMTI environment in Agent_OnLoad()\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp index c804a2ca64c..220243ae1a2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,7 +45,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY0("Disable VM_DEATH event in VM_DEATH callback\n"); if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_VM_DEATH, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_VM_DEATH, nullptr))) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -79,13 +79,13 @@ JNIEXPORT jint JNI_OnLoad_disposeenv002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -99,7 +99,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("Enable VM_DEATH event in JVM_OnLoad()\n"); if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) { return JNI_ERR; } NSK_DISPLAY0(" ... enabled\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp index 9de2b542633..676fd762a7a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -99,7 +99,7 @@ JNIEXPORT jint JNI_OnLoad_dyncodgen001(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; /* init framework and parse options */ @@ -111,7 +111,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -121,11 +121,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* enable DynamicCodeGenerated event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, nullptr))) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp index c3eed7356cc..29df3168b9b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ extern "C" { /* ============================================================================= */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; @@ -178,7 +178,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { jvmtiCapabilities caps; - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL)) + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp index d7d1d712550..eb956244fe5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,7 +72,7 @@ JNIEXPORT jint JNI_OnLoad_forcegc001(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -80,10 +80,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp index a069c099e50..5332beb8397 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { events = 0; NSK_DISPLAY0("Enable event GarbageCollectionStart\n"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0("Call ForceGarbageCollection()\n"); @@ -60,7 +60,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Disable event GarbageCollectionStart\n"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) return; NSK_DISPLAY0("Check if expected events received\n"); @@ -98,7 +98,7 @@ JNIEXPORT jint JNI_OnLoad_forcegc002(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -106,7 +106,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -125,7 +125,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp index e247fbdbd00..819aa9189aa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ extern "C" { #define MEM_SIZE 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -194,7 +194,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to generate compiled method events */ @@ -218,9 +218,9 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp index d9dab1b0c7d..ff8e837f277 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ extern "C" { static volatile jint result = PASSED; static volatile int gcstart = 0; static volatile int gcfinish = 0; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -114,7 +114,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to generate compiled method events */ @@ -139,11 +139,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp index fb9d69ddd08..ba134f06ed8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ extern "C" { #define MEM_SIZE 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -195,7 +195,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to generate compiled method events */ @@ -219,9 +219,9 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp index f208bcdfb42..02228b3021a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -94,7 +94,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) { nsk_jvmti_setFailStatus(); } @@ -108,7 +108,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) { nsk_jvmti_setFailStatus(); } @@ -174,7 +174,7 @@ JNIEXPORT jint JNI_OnLoad_genevents001(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -182,10 +182,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* add required capabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize001/argsize001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize001/argsize001.cpp index 38b2612cab8..25d72ff3ba6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize001/argsize001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize001/argsize001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,12 +32,12 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; void chk(JNIEnv *env, jclass cl, const char *name, const char *sig, int stat, int size) { jvmtiError err; - jmethodID mid = NULL; + jmethodID mid = nullptr; jint ret_size; if (stat) { @@ -45,7 +45,7 @@ void chk(JNIEnv *env, jclass cl, const char *name, const char *sig, int stat, in } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { + if (mid == nullptr) { printf("Name = %s, sig = %s: mid = 0\n", name, sig); } err = jvmti->GetArgumentsSize(mid, &ret_size); @@ -76,7 +76,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize002/argsize002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize002/argsize002.cpp index 5fd7c0d2d04..f2d9f76e219 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize002/argsize002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize002/argsize002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_argsize002(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,13 +70,13 @@ Java_nsk_jvmti_GetArgumentsSize_argsize002_check(JNIEnv *env, jclass cls) { jmethodID mid; jint size; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"\"!\n"); return STATUS_FAILED; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetArgumentsSize_argsize002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetArgumentsSize(NULL, &size); + err = jvmti->GetArgumentsSize(nullptr, &size); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -94,7 +94,7 @@ Java_nsk_jvmti_GetArgumentsSize_argsize002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetArgumentsSize(mid, NULL); + err = jvmti->GetArgumentsSize(mid, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -102,7 +102,7 @@ Java_nsk_jvmti_GetArgumentsSize_argsize002_check(JNIEnv *env, jclass cls) { } mid = env->GetStaticMethodID(cls, "check", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"check\"!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAvailableProcessors/getavailproc001/getavailproc001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAvailableProcessors/getavailproc001/getavailproc001.cpp index 28d4ad2a91a..f374cef29ae 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAvailableProcessors/getavailproc001/getavailproc001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAvailableProcessors/getavailproc001/getavailproc001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -112,7 +112,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkProcessors(jvmti, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -139,7 +139,7 @@ JNIEXPORT jint JNI_OnLoad_getavailproc001(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -147,7 +147,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -162,7 +162,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check available processors in Agent_OnLoad()\n"); @@ -171,7 +171,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes001/bytecodes001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes001/bytecodes001.cpp index ee476a7ce33..b0971242418 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes001/bytecodes001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes001/bytecodes001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ typedef struct { unsigned char *codes; } info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -70,12 +70,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -117,12 +117,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { void checkMeth(JNIEnv *env, jclass cl, int meth_ind) { jvmtiError err; - jmethodID mid = NULL; + jmethodID mid = nullptr; jint count = -1; - unsigned char *codes = NULL; + unsigned char *codes = nullptr; int i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -135,7 +135,7 @@ void checkMeth(JNIEnv *env, jclass cl, int meth_ind) { mid = env->GetMethodID(cl, meth_tab[meth_ind].name, meth_tab[meth_ind].sig); } - if (mid == NULL) { + if (mid == nullptr) { printf("\"%s%s\": cannot get method ID!\n", meth_tab[meth_ind].name, meth_tab[meth_ind].sig); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes002/bytecodes002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes002/bytecodes002.cpp index ad5e5eeacd2..63a0a3c866a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes002/bytecodes002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes002/bytecodes002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -105,13 +105,13 @@ Java_nsk_jvmti_GetBytecodes_bytecodes002_check(JNIEnv *env, jclass cls) { jint bytecodeCount; unsigned char *bytecodes; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"\"!\n"); return STATUS_FAILED; } @@ -119,7 +119,7 @@ Java_nsk_jvmti_GetBytecodes_bytecodes002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetBytecodes(NULL, &bytecodeCount, &bytecodes); + err = jvmti->GetBytecodes(nullptr, &bytecodeCount, &bytecodes); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_bytecodes) { /* It is OK */ } else if (err != JVMTI_ERROR_INVALID_METHODID) { @@ -131,7 +131,7 @@ Java_nsk_jvmti_GetBytecodes_bytecodes002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (bytecodeCountPtr) null pointer check ...\n"); } - err = jvmti->GetBytecodes(mid, NULL, &bytecodes); + err = jvmti->GetBytecodes(mid, nullptr, &bytecodes); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_bytecodes) { /* It is OK */ } else if (err != JVMTI_ERROR_NULL_POINTER) { @@ -143,7 +143,7 @@ Java_nsk_jvmti_GetBytecodes_bytecodes002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (bytecodesPtr) null pointer check ...\n"); } - err = jvmti->GetBytecodes(mid, &bytecodeCount, NULL); + err = jvmti->GetBytecodes(mid, &bytecodeCount, nullptr); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_bytecodes) { /* It is OK */ } else if (err != JVMTI_ERROR_NULL_POINTER) { @@ -153,7 +153,7 @@ Java_nsk_jvmti_GetBytecodes_bytecodes002_check(JNIEnv *env, jclass cls) { } mid = env->GetStaticMethodID(cls, "check", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"check\"!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp index bd8c2e25abe..4d7ed6978de 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,7 @@ typedef struct { int length; } opcode_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -324,8 +324,8 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti_env, JNIEnv *env, unsigned char *bytecodes; jint i; - sig = NULL; - err = jvmti_env->GetClassSignature(cls, &sig, NULL); + sig = nullptr; + err = jvmti_env->GetClassSignature(cls, &sig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(GetClassSignature#%d) unexpected error: %s (%d)\n", eventsCount, TranslateError(err), err); @@ -347,15 +347,15 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti_env, JNIEnv *env, } for (i = 0; i < mcount; i++) { - if (methods[i] == NULL) { + if (methods[i] == nullptr) { if (printdump == JNI_TRUE) { printf(" null"); } } else { - name = NULL; - msig = NULL; - bytecodes = NULL; - err = jvmti_env->GetMethodName(methods[i], &name, &msig, NULL); + name = nullptr; + msig = nullptr; + bytecodes = nullptr; + err = jvmti_env->GetMethodName(methods[i], &name, &msig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(GetMethodName) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -397,22 +397,22 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti_env, JNIEnv *env, } } } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char *)name); } - if (msig != NULL) { + if (msig != nullptr) { jvmti_env->Deallocate((unsigned char *)msig); } - if (bytecodes != NULL) { + if (bytecodes != nullptr) { jvmti_env->Deallocate(bytecodes); } } } - if (methods != NULL) { + if (methods != nullptr) { jvmti_env->Deallocate((unsigned char *)methods); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char *)sig); } eventsCount++; @@ -433,12 +433,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -488,7 +488,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_CLASS_PREPARE, NULL); + JVMTI_EVENT_CLASS_PREPARE, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable ClassPrepare: %s (%d)\n", TranslateError(err), err); @@ -505,14 +505,14 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetBytecodes_bytecodes003_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } if (caps.can_get_bytecodes) { err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, - JVMTI_EVENT_CLASS_PREPARE, NULL); + JVMTI_EVENT_CLASS_PREPARE, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to disable JVMTI_EVENT_CLASS_PREPARE: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps001/getcaps001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps001/getcaps001.cpp index 33057c64901..74adc9187a8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps001/getcaps001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps001/getcaps001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getcaps001(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetCapabilities_getcaps001_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -76,7 +76,7 @@ Java_nsk_jvmti_GetCapabilities_getcaps001_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetCapabilities(NULL); + err = jvmti->GetCapabilities(nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps002/getcaps002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps002/getcaps002.cpp index d3ddec8ad80..90bab14b567 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps002/getcaps002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps002/getcaps002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -252,7 +252,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkCapabilities(jvmti, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -279,7 +279,7 @@ JNIEXPORT jint JNI_OnLoad_getcaps002(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -287,7 +287,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -302,7 +302,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check capabilities in Agent_OnLoad()\n"); @@ -311,7 +311,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld005/getclfld005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld005/getclfld005.cpp index 38264eaa61a..cd178863545 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld005/getclfld005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld005/getclfld005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclfld005(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetClassFields_getclfld005_check(JNIEnv *env, jclass cls) { jint fcount; jfieldID *fields; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -78,7 +78,7 @@ Java_nsk_jvmti_GetClassFields_getclfld005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetClassFields(NULL, &fcount, &fields); + err = jvmti->GetClassFields(nullptr, &fcount, &fields); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -88,7 +88,7 @@ Java_nsk_jvmti_GetClassFields_getclfld005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (fieldCountPtr) null pointer check ...\n"); } - err = jvmti->GetClassFields(cls, NULL, &fields); + err = jvmti->GetClassFields(cls, nullptr, &fields); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(fieldCountPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -98,7 +98,7 @@ Java_nsk_jvmti_GetClassFields_getclfld005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (fieldsPtr) null pointer check ...\n"); } - err = jvmti->GetClassFields(cls, &fcount, NULL); + err = jvmti->GetClassFields(cls, &fcount, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(fieldsPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld006/getclfld006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld006/getclfld006.cpp index aace1a93e3c..1c786d84908 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld006/getclfld006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld006/getclfld006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclfld006(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetClassFields_getclfld006_check(JNIEnv *env, jclass cls, jint i, jint fcount; jfieldID *fields; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld007/getclfld007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld007/getclfld007.cpp index 93da371fd54..c3f5a53daa5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld007/getclfld007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld007/getclfld007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,16 +33,16 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; // compares 'value' with jobject_arr[index] static bool equals_str(JNIEnv *env, const char *value, jobjectArray jobject_arr, jint index) { jstring jstr = (jstring)env->GetObjectArrayElement(jobject_arr, index); - const char* utf = env->GetStringUTFChars(jstr, NULL); + const char* utf = env->GetStringUTFChars(jstr, nullptr); bool res = false; - if (utf != NULL) { + if (utf != nullptr) { res = strcmp(value, utf) == 0; env->ReleaseStringUTFChars(jstr, utf); } else { @@ -68,7 +68,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetClassFields_getclfld007_check(JNIEnv *env, jclass cls, jclass char *name, *sig; int j; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); fflush(0); result = STATUS_FAILED; @@ -109,12 +109,12 @@ Java_nsk_jvmti_GetClassFields_getclfld007_check(JNIEnv *env, jclass cls, jclass result = STATUS_FAILED; } for (j = 0; j < fcount; j++) { - if (fields[j] == NULL) { + if (fields[j] == nullptr) { printf("(%d) fieldID = null\n", j); result = STATUS_FAILED; continue; } - err = jvmti->GetFieldName(clazz, fields[j], &name, &sig, NULL); + err = jvmti->GetFieldName(clazz, fields[j], &name, &sig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(GetFieldName#%d) unexpected error: %s (%d)\n", j, TranslateError(err), err); @@ -123,7 +123,7 @@ Java_nsk_jvmti_GetClassFields_getclfld007_check(JNIEnv *env, jclass cls, jclass } printf(">>> [%d]: %s, sig = \"%s\"\n", j, name, sig); if ((j < field_count) && - (name == NULL || sig == NULL || + (name == nullptr || sig == nullptr || !equals_str(env, name, fieldArr, j * 2) || !equals_str(env, sig, fieldArr, j * 2 + 1))) { printf("(%d) wrong field: \"%s%s\"", j, name, sig); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr001/getclsldr001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr001/getclsldr001.cpp index f337c203ba7..9d2d8a449d3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr001/getclsldr001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr001/getclsldr001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclsldr001(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_GetClassLoader_getclsldr001_check(JNIEnv *env, jclass cls) { jvmtiError err; jobject classloader; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_GetClassLoader_getclsldr001_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetClassLoader(NULL, &classloader); + err = jvmti->GetClassLoader(nullptr, &classloader); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -87,7 +87,7 @@ Java_nsk_jvmti_GetClassLoader_getclsldr001_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetClassLoader(cls, NULL); + err = jvmti->GetClassLoader(cls, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr002/getclsldr002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr002/getclsldr002.cpp index 04d473fc7c3..968158cc087 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr002/getclsldr002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr002/getclsldr002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclsldr002(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -71,7 +71,7 @@ Java_nsk_jvmti_GetClassLoader_getclsldr002_check(JNIEnv *env, jobject classloader; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -97,8 +97,8 @@ Java_nsk_jvmti_GetClassLoader_getclsldr002_check(JNIEnv *env, printf(">>> %d: %s\n", i, sig); } - if (classloader != NULL) { - printf("(%d:%s) class loader is not NULL: 0x%p\n", + if (classloader != nullptr) { + printf("(%d:%s) class loader is not null: 0x%p\n", i, sig, classloader); result = STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr003/getclsldr003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr003/getclsldr003.cpp index d003074a629..3bd7008a32d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr003/getclsldr003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr003/getclsldr003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclsldr003(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -71,7 +71,7 @@ Java_nsk_jvmti_GetClassLoader_getclsldr003_check(JNIEnv *env, jobject classloader; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss001/clsldrclss001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss001/clsldrclss001.cpp index afe7952ab20..af3a2e0b162 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss001/clsldrclss001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss001/clsldrclss001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_clsldrclss001(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -71,7 +71,7 @@ Java_nsk_jvmti_GetClassLoaderClasses_clsldrclss001_check(JNIEnv *env, jclass cls jclass *classes; jint classCount; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -87,7 +87,7 @@ Java_nsk_jvmti_GetClassLoaderClasses_clsldrclss001_check(JNIEnv *env, jclass cls if (printdump == JNI_TRUE) { printf(">>> (initiatingLoader) null pointer check ...\n"); } - err = jvmti->GetClassLoaderClasses(NULL, &classCount, &classes); + err = jvmti->GetClassLoaderClasses(nullptr, &classCount, &classes); if (err == JVMTI_ERROR_NULL_POINTER) { printf("Expected: the classes initiated by the bootstrap loader,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -97,7 +97,7 @@ Java_nsk_jvmti_GetClassLoaderClasses_clsldrclss001_check(JNIEnv *env, jclass cls if (printdump == JNI_TRUE) { printf(">>> (classCountPtr) null pointer check ...\n"); } - err = jvmti->GetClassLoaderClasses(classloader, NULL, &classes); + err = jvmti->GetClassLoaderClasses(classloader, nullptr, &classes); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -107,7 +107,7 @@ Java_nsk_jvmti_GetClassLoaderClasses_clsldrclss001_check(JNIEnv *env, jclass cls if (printdump == JNI_TRUE) { printf(">>> (classesPtr) null pointer check ...\n"); } - err = jvmti->GetClassLoaderClasses(classloader, &classCount, NULL); + err = jvmti->GetClassLoaderClasses(classloader, &classCount, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss002/clsldrclss002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss002/clsldrclss002.cpp index 65116a118a3..f389a9d56e1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss002/clsldrclss002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss002/clsldrclss002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,9 +35,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject testedClassLoader = NULL; -static jclass testedClass = NULL; -static jfieldID testedFieldID = NULL; +static jobject testedClassLoader = nullptr; +static jclass testedClass = nullptr; +static jfieldID testedFieldID = nullptr; static const char* CLASS_SIG = "Lnsk/jvmti/GetClassLoaderClasses/clsldrclss002;"; @@ -58,15 +58,15 @@ static int prepare(JNIEnv* jni) { NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n"); NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (testedFieldID = - jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -82,15 +82,15 @@ static int lookup(jvmtiEnv* jvmti, if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(classes[i], &signature, &generic))) break; - if (signature != NULL && strcmp(signature, exp_sig) == 0) { + if (signature != nullptr && strcmp(signature, exp_sig) == 0) { NSK_DISPLAY1("Expected class found: %s\n", exp_sig); found = NSK_TRUE; } - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); - if (generic != NULL) + if (generic != nullptr) jvmti->Deallocate((unsigned char*)generic); } @@ -115,7 +115,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Testcase #1: check on default classloader\n"); if (!NSK_JNI_VERIFY(jni, (testedClassLoader = - jni->GetStaticObjectField(testedClass, testedFieldID)) != NULL)) { + jni->GetStaticObjectField(testedClass, testedFieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -127,7 +127,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(classes != NULL)) { + if (!NSK_VERIFY(classes != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -136,7 +136,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); return; } - if (classes != NULL) + if (classes != nullptr) jvmti->Deallocate((unsigned char*)classes); if (!nsk_jvmti_resumeSync()) @@ -146,7 +146,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Testcase #2: check on custom classloader\n"); if (!NSK_JNI_VERIFY(jni, (testedClassLoader = - jni->GetStaticObjectField(testedClass, testedFieldID)) != NULL)) { + jni->GetStaticObjectField(testedClass, testedFieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -158,7 +158,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(classes != NULL)) { + if (!NSK_VERIFY(classes != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -174,7 +174,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_COMPLAIN1("Cannot find class in the list: %s\n", CLASS_SIG_E); nsk_jvmti_setFailStatus(); } - if (classes != NULL) + if (classes != nullptr) jvmti->Deallocate((unsigned char*)classes); NSK_TRACE(jni->DeleteGlobalRef(testedClass)); @@ -198,7 +198,7 @@ JNIEXPORT jint JNI_OnLoad_clsldrclss002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -208,10 +208,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd005/getclmthd005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd005/getclmthd005.cpp index ec8da62bb60..5a39a2bf549 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd005/getclmthd005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd005/getclmthd005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclmthd005(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd005_check(JNIEnv *env, jclass cls) { jint mcount; jmethodID *methods; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -78,7 +78,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetClassMethods(NULL, &mcount, &methods); + err = jvmti->GetClassMethods(nullptr, &mcount, &methods); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -88,7 +88,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (methodCountPtr) null pointer check ...\n"); } - err = jvmti->GetClassMethods(cls, NULL, &methods); + err = jvmti->GetClassMethods(cls, nullptr, &methods); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(methodCountPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -98,7 +98,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (methodsPtr) null pointer check ...\n"); } - err = jvmti->GetClassMethods(cls, &mcount, NULL); + err = jvmti->GetClassMethods(cls, &mcount, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(methodsPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd006/getclmthd006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd006/getclmthd006.cpp index 03d1152454c..3435c915a48 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd006/getclmthd006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd006/getclmthd006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclmthd006(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd006_check(JNIEnv *env, jclass cls, jint jint mcount; jmethodID *methods; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd007/getclmthd007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd007/getclmthd007.cpp index 031f11d03ed..e5e75b5d9b1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd007/getclmthd007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd007/getclmthd007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ typedef struct { meth_info *meths; } class_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -124,12 +124,12 @@ JNIEXPORT jint JNI_OnLoad_getclmthd007(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -147,7 +147,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd007_check(JNIEnv *env, int j, k; int failed = JNI_FALSE; // enable debugging on failure - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -173,7 +173,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd007_check(JNIEnv *env, printf(">>> %s:\n", classes[i].name); } for (k = 0; k < mcount; k++) { - if (methods[k] == NULL) { + if (methods[k] == nullptr) { printf("(%d:%d) methodID = null\n", i, k); result = STATUS_FAILED; } else if (printdump == JNI_TRUE || failed == JNI_TRUE) { @@ -187,7 +187,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd007_check(JNIEnv *env, for (j = 0; j < classes[i].mcount; j++) { /* search the returned table for each expected entry */ for (k = 0; k < mcount; k++) { - if (methods[k] != NULL) { + if (methods[k] != nullptr) { err = jvmti->GetMethodName(methods[k], &name, &sig, &generic); if (err != JVMTI_ERROR_NONE) { @@ -195,7 +195,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd007_check(JNIEnv *env, i, k, TranslateError(err), err); result = STATUS_FAILED; } else { - if (name != NULL && sig != NULL && + if (name != nullptr && sig != nullptr && strcmp(name, classes[i].meths[j].name) == 0 && strcmp(sig, classes[i].meths[j].sig) == 0) break; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf004/getclmdf004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf004/getclmdf004.cpp index da09f1c5f2c..f929d466d9c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf004/getclmdf004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf004/getclmdf004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclmdf004(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_GetClassModifiers_getclmdf004_check(JNIEnv *env, jclass cls) { jvmtiError err; jint modifiers; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_GetClassModifiers_getclmdf004_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetClassModifiers(NULL, &modifiers); + err = jvmti->GetClassModifiers(nullptr, &modifiers); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -87,7 +87,7 @@ Java_nsk_jvmti_GetClassModifiers_getclmdf004_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetClassModifiers(cls, NULL); + err = jvmti->GetClassModifiers(cls, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf005/getclmdf005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf005/getclmdf005.cpp index 7a83d1dbd72..8cdaff36314 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf005/getclmdf005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf005/getclmdf005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ extern "C" { #define ACC_FINAL 0x0010 #define ACC_INTERFACE 0x0200 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -57,12 +57,12 @@ JNIEXPORT jint JNI_OnLoad_getclmdf005(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -75,7 +75,7 @@ Java_nsk_jvmti_GetClassModifiers_getclmdf005_check(JNIEnv *env, jclass cls, jint jvmtiError err; jint modifiers; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf006/getclmdf006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf006/getclmdf006.cpp index d13e51d5a5d..14d7a0b2e29 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf006/getclmdf006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf006/getclmdf006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ extern "C" { #define ACC_INTERFACE 0x0200 #define ACC_ABSTRACT 0x0400 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -60,12 +60,12 @@ JNIEXPORT jint JNI_OnLoad_getclmdf006(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -90,7 +90,7 @@ Java_nsk_jvmti_GetClassModifiers_getclmdf006_check(JNIEnv *env, jclass cls, jcla jvmtiError err; jint modifiers; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf007/getclmdf007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf007/getclmdf007.cpp index f6742e15cd7..5315c795dba 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf007/getclmdf007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf007/getclmdf007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ extern "C" { #define ACC_INTERFACE 0x0200 #define ACC_ABSTRACT 0x0400 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -60,12 +60,12 @@ JNIEXPORT jint JNI_OnLoad_getclmdf007(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -91,7 +91,7 @@ Java_nsk_jvmti_GetClassModifiers_getclmdf007_check(JNIEnv *env, jclass cls, jint jint ArrayModifiers; jint ComponentModifiers; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig004/getclsig004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig004/getclsig004.cpp index 782a331729b..d01bf625873 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig004/getclsig004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig004/getclsig004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static const char *sigs[] = { @@ -63,12 +63,12 @@ JNIEXPORT jint JNI_OnLoad_getclsig004(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -82,7 +82,7 @@ Java_nsk_jvmti_GetClassSignature_getclsig004_check(JNIEnv *env, jvmtiError err; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig005/getclsig005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig005/getclsig005.cpp index 149ab655a72..919bd50b940 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig005/getclsig005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig005/getclsig005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define CLASS_SIGNATURE "Lnsk/jvmti/GetClassSignature/getclsig005;" -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -52,12 +52,12 @@ JNIEXPORT jint JNI_OnLoad_getclsig005(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetClassSignature_getclsig005_check(JNIEnv *env, jclass cls) { jvmtiError err; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -78,7 +78,7 @@ Java_nsk_jvmti_GetClassSignature_getclsig005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetClassSignature(NULL, &sig, &generic); + err = jvmti->GetClassSignature(nullptr, &sig, &generic); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -88,7 +88,7 @@ Java_nsk_jvmti_GetClassSignature_getclsig005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (signature_ptr) null pointer check ...\n"); } - err = jvmti->GetClassSignature(cls, NULL, &generic); + err = jvmti->GetClassSignature(cls, nullptr, &generic); if (err != JVMTI_ERROR_NONE) { printf("(signature_ptr) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -102,7 +102,7 @@ Java_nsk_jvmti_GetClassSignature_getclsig005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (generic_ptr) null pointer check ...\n"); } - err = jvmti->GetClassSignature(cls, &sig, NULL); + err = jvmti->GetClassSignature(cls, &sig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(generic_ptr) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -111,7 +111,7 @@ Java_nsk_jvmti_GetClassSignature_getclsig005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> sig = \"%s\"\n", sig); } - if (sig == NULL || strcmp(sig, CLASS_SIGNATURE) != 0) { + if (sig == nullptr || strcmp(sig, CLASS_SIGNATURE) != 0) { printf("Wrong class sig: \"%s\", expected: \"%s\"\n", CLASS_SIGNATURE, sig); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp index acd3ed52578..56b79a1cdf1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ extern "C" { /* expected class signatures are below */ static const char *class_sig[][CLS_NUM] = { - { "getclsig006", "Lnsk/jvmti/GetClassSignature/getclsig006;", "NULL" }, + { "getclsig006", "Lnsk/jvmti/GetClassSignature/getclsig006;", "null" }, { "getclsig006b", "Lnsk/jvmti/GetClassSignature/getclsig006b;", "Ljava/lang/Object;" }, { "getclsig006c", "Lnsk/jvmti/GetClassSignature/getclsig006c;", @@ -51,7 +51,7 @@ static const char *class_sig[][CLS_NUM] = { "Ljava/lang/Object;" } }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static int checkSig(JNIEnv *jni_env, jclass testedCls, int idx) { int totRes = PASSED; @@ -67,7 +67,7 @@ static int checkSig(JNIEnv *jni_env, jclass testedCls, int idx) { class_sig[idx][0]); if (strcmp(class_sig[idx][1], sign) != 0 || - strcmp(class_sig[idx][2], (gen_sign == NULL) ? "NULL" : gen_sign) != 0) { + strcmp(class_sig[idx][2], (gen_sign == nullptr) ? "null" : gen_sign) != 0) { NSK_COMPLAIN5( "TEST FAILED: class: \"%s\" has\n" "\tsignature: \"%s\"\n" @@ -75,19 +75,19 @@ static int checkSig(JNIEnv *jni_env, jclass testedCls, int idx) { "\tExpected: \"%s\"\n" "\t\"%s\"\n\n", class_sig[idx][0], - sign, (gen_sign == NULL) ? "NULL" : gen_sign, + sign, (gen_sign == nullptr) ? "null" : gen_sign, class_sig[idx][1], class_sig[idx][2]); totRes = STATUS_FAILED; } else NSK_DISPLAY2("CHECK PASSED: signature: \"%s\",\n\tgeneric signature: \"%s\"\n", - sign, (gen_sign == NULL) ? "NULL" : gen_sign); + sign, (gen_sign == nullptr) ? "null" : gen_sign); NSK_DISPLAY0("Deallocating the signature array\n"); if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) sign))) { totRes = STATUS_FAILED; } - if (gen_sign != NULL) + if (gen_sign != nullptr) if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) gen_sign))) { totRes = STATUS_FAILED; } @@ -105,7 +105,7 @@ Java_nsk_jvmti_GetClassSignature_getclsig006_check( jclass testedCls; for (i=0; iFindClass(class_sig[i][1])) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (testedCls = jni->FindClass(class_sig[i][1])) != nullptr)) { NSK_COMPLAIN1("TEST FAILURE: unable to find class \"%s\"\n\n", class_sig[i][0]); res = STATUS_FAILED; @@ -137,7 +137,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat005/getclstat005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat005/getclstat005.cpp index f348991f670..7bc57e7082b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat005/getclstat005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat005/getclstat005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclstat005(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_GetClassStatus_getclstat005_check(JNIEnv *env, jclass cls) { jvmtiError err; jint status; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_GetClassStatus_getclstat005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetClassStatus(NULL, &status); + err = jvmti->GetClassStatus(nullptr, &status); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -87,7 +87,7 @@ Java_nsk_jvmti_GetClassStatus_getclstat005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetClassStatus(cls, NULL); + err = jvmti->GetClassStatus(cls, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat006/getclstat006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat006/getclstat006.cpp index 8f8a5d38820..72fb949f9b0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat006/getclstat006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat006/getclstat006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ typedef struct { const char *name; } bit_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static bit_info bits[] = { @@ -60,12 +60,12 @@ JNIEXPORT jint JNI_OnLoad_getclstat006(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -78,7 +78,7 @@ Java_nsk_jvmti_GetClassStatus_getclstat006_check(JNIEnv *env, jclass cls, jint i jvmtiError err; jint status; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat007/getclstat007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat007/getclstat007.cpp index ed1ce5ace77..4daaed64594 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat007/getclstat007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat007/getclstat007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclstat007(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetClassStatus_getclstat007_check(JNIEnv *env, jclass cls, jvmtiError err; jint status; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTime/curthrcputime001/curthrcputime001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTime/curthrcputime001/curthrcputime001.cpp index 3e7fcdd1b17..b883c0b682f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTime/curthrcputime001/curthrcputime001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTime/curthrcputime001/curthrcputime001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -80,7 +80,7 @@ static int checkCpuTime(jvmtiEnv* jvmti, jthread thread, julong* time, where, julong_to_string(*time, buf)); } - if (prevTime != NULL) { + if (prevTime != nullptr) { julong diff = *time - *prevTime; NSK_DISPLAY1("Compare with previous time: %s\n", @@ -147,7 +147,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Testcase #2: Check initial cpu time in agent thread\n"); { - if (!checkCpuTime(jvmti, testAgentThread, &prevAgentThreadTime, NULL, "agent thread")) { + if (!checkCpuTime(jvmti, testAgentThread, &prevAgentThreadTime, nullptr, "agent thread")) { nsk_jvmti_setFailStatus(); } } @@ -157,7 +157,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { runIterations(iterations); NSK_DISPLAY1("Enable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } @@ -184,7 +184,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... disabled\n"); } } @@ -214,7 +214,7 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY0(">>> Testcase #1: Check initial cpu time in VM_INIT callback\n"); { julong time = 0; - if (!checkCpuTime(jvmti, thread, &time, NULL, "VM_INIT callback")) { + if (!checkCpuTime(jvmti, thread, &time, nullptr, "VM_INIT callback")) { nsk_jvmti_setFailStatus(); } } @@ -230,14 +230,14 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY0(">>> Testcase #7: Check initial cpu time in VM_DEATH callback\n"); { julong time = 0; - if (!checkCpuTime(jvmti, NULL, &time, NULL, "VM_DEATH callback")) { + if (!checkCpuTime(jvmti, nullptr, &time, nullptr, "VM_DEATH callback")) { success = NSK_FALSE; nsk_jvmti_setFailStatus(); } } NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -266,9 +266,9 @@ callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY1(" for thread: %s\n", nsk_null_string(threadInfo.name)); } - if (threadInfo.name != NULL && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { + if (threadInfo.name != nullptr && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { NSK_DISPLAY0(">>> Testcase #3: Check initial cpu time in THREAD_START callback\n"); - if (!checkCpuTime(jvmti, thread, &prevTestedThreadTime, NULL, "THREAD_START callback")) { + if (!checkCpuTime(jvmti, thread, &prevTestedThreadTime, nullptr, "THREAD_START callback")) { nsk_jvmti_setFailStatus(); } } @@ -289,7 +289,7 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY1(" for thread: %s\n", nsk_null_string(threadInfo.name)); } - if (threadInfo.name != NULL && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { + if (threadInfo.name != nullptr && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { julong time = 0; NSK_DISPLAY0(">>> Testcase #5: Check final cpu time in THREAD_END callback\n"); if (!checkCpuTime(jvmti, thread, &time, &prevTestedThreadTime, "THREAD_END callback")) { @@ -313,7 +313,7 @@ JNIEXPORT jint JNI_OnLoad_curthrcputime001(JavaVM *jvm, char *options, void *res } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -325,7 +325,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_get_current_thread_cpu_time"); @@ -355,11 +355,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY0(" ... callbacks set\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTimerInfo/curthrtimerinfo001/curthrtimerinfo001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTimerInfo/curthrtimerinfo001/curthrtimerinfo001.cpp index cf22a491b08..2efa96fb584 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTimerInfo/curthrtimerinfo001/curthrtimerinfo001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTimerInfo/curthrtimerinfo001/curthrtimerinfo001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -76,7 +76,7 @@ static int checkTimerInfo(jvmtiEnv* jvmti, jvmtiTimerInfo* info, NSK_DISPLAY1(" may_skip_forward: %d\n", (int)info->may_skip_forward); NSK_DISPLAY1(" may_skip_backward: %d\n", (int)info->may_skip_backward); - if (initInfo != NULL) { + if (initInfo != nullptr) { NSK_DISPLAY0("Compare with initial timer info\n"); if (info->max_value != initInfo->max_value) { NSK_COMPLAIN4("In %s GetCurrentThreadCpuTimerInfo() returned different info:\n" @@ -132,7 +132,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Testcases #3,4: Check timer info in thread events\n"); { NSK_DISPLAY1("Enable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } @@ -143,7 +143,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... disabled\n"); } } @@ -163,7 +163,7 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY0(">>> Testcase #1: Check initial timer info in VM_INIT callback\n"); { - if (!checkTimerInfo(jvmti, &initInfo, NULL, "VM_INIT callback")) { + if (!checkTimerInfo(jvmti, &initInfo, nullptr, "VM_INIT callback")) { nsk_jvmti_setFailStatus(); } } @@ -183,7 +183,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { } NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -242,7 +242,7 @@ JNIEXPORT jint JNI_OnLoad_curthrtimerinfo001(JavaVM *jvm, char *options, void *r } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -250,7 +250,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_get_current_thread_cpu_time"); @@ -282,11 +282,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY0(" ... callbacks set\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnv/GetEnv001/GetEnv001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnv/GetEnv001/GetEnv001.cpp index 0a6ba80bf70..3959c846492 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnv/GetEnv001/GetEnv001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnv/GetEnv001/GetEnv001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -87,7 +87,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) return JNI_ERR; } - if (vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1) != JNI_OK || jvmti == NULL) { + if (vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1) != JNI_OK || jvmti == nullptr) { NSK_COMPLAIN0("JVMTI_VERSION_1_1 isn't supported."); return JNI_OK; } @@ -109,7 +109,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) return JNI_ERR; // Enable class retransformation - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnvironmentLocalStorage/getenvstor001/getenvstor001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnvironmentLocalStorage/getenvstor001/getenvstor001.cpp index c196ea89f1d..34b26debe67 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnvironmentLocalStorage/getenvstor001/getenvstor001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnvironmentLocalStorage/getenvstor001/getenvstor001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ static jvmtiEvent events[EVENTS_COUNT] = { * @returns NSK_FALSE if any error occured. */ static int checkEnvStorage(jvmtiEnv* jvmti, const char where[]) { - void* storage = NULL; + void* storage = nullptr; NSK_DISPLAY0("GetEnvironmentLocalStorage() for current JVMTI env\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage(&storage))) { @@ -58,8 +58,8 @@ static int checkEnvStorage(jvmtiEnv* jvmti, const char where[]) { } NSK_DISPLAY1(" ... got storage: 0x%p\n", (void*)storage); - if (storage != NULL) { - NSK_COMPLAIN2("GetEnvironmentLocalStorage() returned NOT NULL storage in %s:\n" + if (storage != nullptr) { + NSK_COMPLAIN2("GetEnvironmentLocalStorage() returned NOT null storage in %s:\n" "# storage pointer: 0x%p\n", where, (void*)storage); return NSK_FALSE; @@ -113,7 +113,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkEnvStorage(jvmti, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -140,7 +140,7 @@ JNIEXPORT jint JNI_OnLoad_getenvstor001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -148,7 +148,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -163,7 +163,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check env storage in JVM_OnLoad()\n"); @@ -172,7 +172,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname001/geterrname001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname001/geterrname001.cpp index cc0aa8ba792..6f8bcb17b3a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname001/geterrname001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname001/geterrname001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -253,7 +253,7 @@ JNIEXPORT jint JNI_OnLoad_geterrname001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; jvmtiEventCallbacks callbacks; /* init framework and parse options */ @@ -265,7 +265,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* Create data access lock */ @@ -290,16 +290,16 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* enable VMInit event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; /* enable ClassFileLoadHook event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/geterrname002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/geterrname002.cpp index 05937d62892..9dcf87e7be1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/geterrname002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/geterrname002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Testcase #2: check on JVMTI_ERROR_NULL_POINTER\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_NULL_POINTER, - jvmti->GetErrorName(JVMTI_ERROR_NONE, NULL))) + jvmti->GetErrorName(JVMTI_ERROR_NONE, nullptr))) nsk_jvmti_setFailStatus(); /* resume debugee after last sync */ @@ -76,7 +76,7 @@ JNIEXPORT jint JNI_OnLoad_geterrname002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -89,11 +89,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionEvents/extevents001/extevents001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionEvents/extevents001/extevents001.cpp index 24edbbbd494..bdc033f35cb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionEvents/extevents001/extevents001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionEvents/extevents001/extevents001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ static jlong timeout = 0; static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { int success = NSK_TRUE; jint extCount = 0; - jvmtiExtensionEventInfo* extList = NULL; + jvmtiExtensionEventInfo* extList = nullptr; int i; NSK_DISPLAY0("Get extension events list\n"); @@ -61,8 +61,8 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { NSK_DISPLAY1(" ... got list: 0x%p\n", (void*)extList); if (extCount > 0) { - if (extList == NULL) { - NSK_COMPLAIN3("In %s phase GetExtensionEvents() returned NULL pointer:\n" + if (extList == nullptr) { + NSK_COMPLAIN3("In %s phase GetExtensionEvents() returned null pointer:\n" "# extensions pointer: 0x%p\n" "# extensions count: %d\n", phase, (void*)extList, (int)extCount); @@ -80,7 +80,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { NSK_DISPLAY1(" param_count: %d\n", (int)extList[i].param_count); NSK_DISPLAY1(" params: 0x%p\n", (void*)extList[i].params); - if (extList[i].params != NULL) { + if (extList[i].params != nullptr) { for (j = 0; j < extList[i].param_count; j++) { NSK_DISPLAY1(" param #%d:\n", j); NSK_DISPLAY1(" name: \"%s\"\n", @@ -94,10 +94,10 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { } } - if (extList[i].id == NULL - || extList[i].short_description == NULL - || (extList[i].params == NULL && extList[i].param_count > 0)) { - NSK_COMPLAIN9("In %s phase GetExtensionEvents() returned event #%d with NULL attribute(s):\n" + if (extList[i].id == nullptr + || extList[i].short_description == nullptr + || (extList[i].params == nullptr && extList[i].param_count > 0)) { + NSK_COMPLAIN9("In %s phase GetExtensionEvents() returned event #%d with null attribute(s):\n" "# event_index: %d\n" "# id: 0x%p (%s)\n" "# short_desc: 0x%p (%s)\n" @@ -111,7 +111,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { success = NSK_FALSE; } - if (extList[i].id != NULL && strlen(extList[i].id) <= 0) { + if (extList[i].id != nullptr && strlen(extList[i].id) <= 0) { NSK_COMPLAIN6("In %s phase GetExtensionEvents() returned event #%d with empty id:\n" "# event_index: %d\n" "# id: \"%s\"\n" @@ -123,7 +123,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { nsk_null_string(extList[i].short_description), (int)extList[i].param_count); success = NSK_FALSE; - } else if (strstr(extList[i].id, NAME_PREFIX) == NULL) { + } else if (strstr(extList[i].id, NAME_PREFIX) == nullptr) { NSK_COMPLAIN6("In %s phase GetExtensionEvents() returned event #%d with unexpected id:\n" "# event_index: %d\n" "# id: \"%s\"\n" @@ -137,7 +137,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { success = NSK_FALSE; } - if (extList[i].short_description != NULL && strlen(extList[i].short_description) <= 0) { + if (extList[i].short_description != nullptr && strlen(extList[i].short_description) <= 0) { NSK_COMPLAIN6("In %s phase GetExtensionEvents() returned event #%d with empty desc:\n" "# event_index: %d\n" "# id: \"%s\"\n" @@ -151,9 +151,9 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { success = NSK_FALSE; } - if (extList[i].param_count > 0 && extList[i].params != NULL) { + if (extList[i].param_count > 0 && extList[i].params != nullptr) { for (j = 0; j < extList[i].param_count; j++) { - if (extList[i].params[j].name == NULL + if (extList[i].params[j].name == nullptr || strlen(extList[i].params[j].name) <= 0) { NSK_COMPLAIN9("In %s phase GetExtensionEvents() returned event #%d with empty desc:\n" "# event_index: %d\n" @@ -262,7 +262,7 @@ JNIEXPORT jint JNI_OnLoad_extevents001(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -270,7 +270,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check extension events in OnLoad phase\n"); @@ -280,7 +280,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionFunctions/extfuncs001/extfuncs001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionFunctions/extfuncs001/extfuncs001.cpp index 60f573c2b71..015313e7b2b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionFunctions/extfuncs001/extfuncs001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionFunctions/extfuncs001/extfuncs001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,7 +49,7 @@ static jlong timeout = 0; static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { int success = NSK_TRUE; jint extCount = 0; - jvmtiExtensionFunctionInfo* extList = NULL; + jvmtiExtensionFunctionInfo* extList = nullptr; int i; NSK_DISPLAY0("Get extension functions list\n"); @@ -60,8 +60,8 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { NSK_DISPLAY1(" ... got list: 0x%p\n", (void*)extList); if (extCount > 0) { - if (extList == NULL) { - NSK_COMPLAIN3("In %s phase GetExtensionFunctions() returned NULL pointer:\n" + if (extList == nullptr) { + NSK_COMPLAIN3("In %s phase GetExtensionFunctions() returned null pointer:\n" "# extensions pointer: 0x%p\n" "# extensions count: %d\n", phase, (void*)extList, (int)extCount); @@ -79,7 +79,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { NSK_DISPLAY1(" param_count: %d\n", (int)extList[i].param_count); NSK_DISPLAY1(" params: 0x%p\n", (void*)extList[i].params); - if (extList[i].params != NULL) { + if (extList[i].params != nullptr) { for (j = 0; j < extList[i].param_count; j++) { NSK_DISPLAY1(" param #%d:\n", j); NSK_DISPLAY1(" name: \"%s\"\n", @@ -96,19 +96,19 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { NSK_DISPLAY1(" error_count: %d\n", (int)extList[i].error_count); NSK_DISPLAY1(" errors: 0x%p\n", (void*)extList[i].errors); - if (extList[i].errors != NULL) { + if (extList[i].errors != nullptr) { for (j = 0; j < extList[i].error_count; j++) { NSK_DISPLAY2(" error #%d: %d\n", j, (int)extList[i].errors[j]); } } - if (extList[i].func == NULL - || extList[i].id == NULL - || extList[i].short_description == NULL - || (extList[i].params == NULL && extList[i].param_count > 0) - || (extList[i].errors == NULL && extList[i].error_count > 0)) { - NSK_COMPLAIN9("In %s phase GetExtensionFunctions() returned function #%d with NULL attribute(s):\n" + if (extList[i].func == nullptr + || extList[i].id == nullptr + || extList[i].short_description == nullptr + || (extList[i].params == nullptr && extList[i].param_count > 0) + || (extList[i].errors == nullptr && extList[i].error_count > 0)) { + NSK_COMPLAIN9("In %s phase GetExtensionFunctions() returned function #%d with null attribute(s):\n" "# func: 0x%p\n" "# id: 0x%p (%s)\n" "# short_desc: 0x%p (%s)\n" @@ -122,7 +122,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { success = NSK_FALSE; } - if (extList[i].id != NULL && strlen(extList[i].id) <= 0) { + if (extList[i].id != nullptr && strlen(extList[i].id) <= 0) { NSK_COMPLAIN6("In %s phase GetExtensionFunctions() returned function #%d with empty id:\n" "# func: 0x%p\n" "# id: \"%s\"\n" @@ -134,7 +134,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { nsk_null_string(extList[i].short_description), (int)extList[i].param_count); success = NSK_FALSE; - } else if (strstr(extList[i].id, NAME_PREFIX) == NULL) { + } else if (strstr(extList[i].id, NAME_PREFIX) == nullptr) { NSK_COMPLAIN6("In %s phase GetExtensionFunctions() returned function #%d with unexpected id:\n" "# func: 0x%p\n" "# id: \"%s\"\n" @@ -148,7 +148,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { success = NSK_FALSE; } - if (extList[i].short_description != NULL && strlen(extList[i].short_description) <= 0) { + if (extList[i].short_description != nullptr && strlen(extList[i].short_description) <= 0) { NSK_COMPLAIN6("In %s phase GetExtensionFunctions() returned function #%d with empty desc:\n" "# func: 0x%p\n" "# id: \"%s\"\n" @@ -162,9 +162,9 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { success = NSK_FALSE; } - if (extList[i].param_count > 0 && extList[i].params != NULL) { + if (extList[i].param_count > 0 && extList[i].params != nullptr) { for (j = 0; j < extList[i].param_count; j++) { - if (extList[i].params[j].name == NULL + if (extList[i].params[j].name == nullptr || strlen(extList[i].params[j].name) <= 0) { NSK_COMPLAIN9("In %s phase GetExtensionFunctions() returned function #%d with empty desc:\n" "# func: 0x%p\n" @@ -273,7 +273,7 @@ JNIEXPORT jint JNI_OnLoad_extfuncs001(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -281,7 +281,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check extension functions in OnLoad phase\n"); @@ -291,7 +291,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl001/getfldecl001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl001/getfldecl001.cpp index 9c1e9b050c9..695d6758f24 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl001/getfldecl001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl001/getfldecl001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static const char* fields[] = { "x", "y", "z" }; @@ -52,12 +52,12 @@ JNIEXPORT jint JNI_OnLoad_getfldecl001(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -73,7 +73,7 @@ Java_nsk_jvmti_GetFieldDeclaringClass_getfldecl001_check(JNIEnv *env, jclass declaringClass; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetFieldDeclaringClass_getfldecl001_check(JNIEnv *env, } else { fid = env->GetFieldID(cls1, fields[i], "I"); } - if (fid == NULL) { + if (fid == nullptr) { printf("(%d) cannot get field ID for %s:\"I\"\n", i, fields[i]); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl002/getfldecl002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl002/getfldecl002.cpp index 10ba137744c..aac0cbe4d66 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl002/getfldecl002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl002/getfldecl002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static const char* fields[] = { "const1", "fld", "xx" }; @@ -52,12 +52,12 @@ JNIEXPORT jint JNI_OnLoad_getfldecl002(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -73,7 +73,7 @@ Java_nsk_jvmti_GetFieldDeclaringClass_getfldecl002_check(JNIEnv *env, jclass declaringClass; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetFieldDeclaringClass_getfldecl002_check(JNIEnv *env, } else { fid = env->GetFieldID(cls1, fields[i], "I"); } - if (fid == NULL) { + if (fid == nullptr) { printf("(%d) cannot get field ID for %s:\"I\"\n", i, fields[i]); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl004/getfldecl004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl004/getfldecl004.cpp index 1661a4dc28e..66bfdd8ce2f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl004/getfldecl004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl004/getfldecl004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ typedef struct { jboolean is_static; } field_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static field_info fields[] = { @@ -71,12 +71,12 @@ JNIEXPORT jint JNI_OnLoad_getfldecl004(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -92,7 +92,7 @@ Java_nsk_jvmti_GetFieldDeclaringClass_getfldecl004_check(JNIEnv *env, jclass declaringClass; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -103,7 +103,7 @@ Java_nsk_jvmti_GetFieldDeclaringClass_getfldecl004_check(JNIEnv *env, } else { fid = env->GetFieldID(cls1, fields[i].name, fields[i].sig); } - if (fid == NULL) { + if (fid == nullptr) { printf("(%d) cannot get field ID for %s:\"%s\"\n", i, fields[i].name, fields[i].sig); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf003/getfldmdf003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf003/getfldmdf003.cpp index e112f59ab60..f763138923d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf003/getfldmdf003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf003/getfldmdf003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getfldmdf003(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,13 +70,13 @@ Java_nsk_jvmti_GetFieldModifiers_getfldmdf003_check(JNIEnv *env, jclass cls) { jfieldID fid; jint modifiers; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } fid = env->GetFieldID(cls, "fld", "I"); - if (fid == NULL) { + if (fid == nullptr) { printf("Cannot get field ID!\n"); return STATUS_FAILED; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetFieldModifiers_getfldmdf003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetFieldModifiers(NULL, fid, &modifiers); + err = jvmti->GetFieldModifiers(nullptr, fid, &modifiers); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -94,7 +94,7 @@ Java_nsk_jvmti_GetFieldModifiers_getfldmdf003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid field check ...\n"); } - err = jvmti->GetFieldModifiers(cls, NULL, &modifiers); + err = jvmti->GetFieldModifiers(cls, nullptr, &modifiers); if (err != JVMTI_ERROR_INVALID_FIELDID) { printf("Error expected: JVMTI_ERROR_INVALID_FIELDID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -104,7 +104,7 @@ Java_nsk_jvmti_GetFieldModifiers_getfldmdf003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetFieldModifiers(cls, fid, NULL); + err = jvmti->GetFieldModifiers(cls, fid, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(namePtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf004/getfldmdf004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf004/getfldmdf004.cpp index ab10f30398e..72fc33280e5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf004/getfldmdf004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf004/getfldmdf004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,7 @@ typedef struct { jboolean is_static; } field_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static field_info fields[] = { @@ -120,12 +120,12 @@ JNIEXPORT jint JNI_OnLoad_getfldmdf004(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -155,7 +155,7 @@ Java_nsk_jvmti_GetFieldModifiers_getfldmdf004_check(JNIEnv *env, jfieldID fid; jint modifiers; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -166,7 +166,7 @@ Java_nsk_jvmti_GetFieldModifiers_getfldmdf004_check(JNIEnv *env, } else { fid = env->GetFieldID(cls, fields[i].name, fields[i].sig); } - if (fid == NULL) { + if (fid == nullptr) { printf("(%d) cannot get field ID for %s:\"%s\"\n", i, fields[i].name, fields[i].sig); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm003/getfldnm003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm003/getfldnm003.cpp index 643f0ce376d..c1121a55259 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm003/getfldnm003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm003/getfldnm003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getfldnm003(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,13 +70,13 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { jfieldID field; char *name, *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } field = env->GetFieldID(cls, "fld", "I"); - if (field == NULL) { + if (field == nullptr) { printf("Cannot get field ID!\n"); return STATUS_FAILED; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetFieldName(NULL, field, &name, &sig, &generic); + err = jvmti->GetFieldName(nullptr, field, &name, &sig, &generic); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -94,7 +94,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid field check ...\n"); } - err = jvmti->GetFieldName(cls, NULL, &name, &sig, &generic); + err = jvmti->GetFieldName(cls, nullptr, &name, &sig, &generic); if (err != JVMTI_ERROR_INVALID_FIELDID) { printf("Error expected: JVMTI_ERROR_INVALID_FIELDID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -104,7 +104,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (namePtr) null pointer check ...\n"); } - err = jvmti->GetFieldName(cls, field, NULL, &sig, &generic); + err = jvmti->GetFieldName(cls, field, nullptr, &sig, &generic); if (err != JVMTI_ERROR_NONE) { printf("(name_ptr) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -113,7 +113,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> sig = \"%s\", generic = \"%s\"\n", sig, generic); } - if (sig == NULL || strcmp(sig, "I") != 0) { + if (sig == nullptr || strcmp(sig, "I") != 0) { printf("Wrong field sig: \"%s\", expected: \"I\"\n", sig); result = STATUS_FAILED; } @@ -122,7 +122,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (signature_ptr) null pointer check ...\n"); } - err = jvmti->GetFieldName(cls, field, &name, NULL, &generic); + err = jvmti->GetFieldName(cls, field, &name, nullptr, &generic); if (err != JVMTI_ERROR_NONE) { printf("(signaturePtr) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -131,7 +131,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> name = \"%s\", generic = \"%s\"\n", name, generic); } - if (name == NULL || strcmp(name, "fld") != 0) { + if (name == nullptr || strcmp(name, "fld") != 0) { printf("Wrong field name: \"%s\", expected: \"fld\"\n", name); result = STATUS_FAILED; } @@ -140,7 +140,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (generic_ptr) null pointer check ...\n"); } - err = jvmti->GetFieldName(cls, field, &name, &sig, NULL); + err = jvmti->GetFieldName(cls, field, &name, &sig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(signaturePtr) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -149,11 +149,11 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> name = \"%s\", sig = \"%s\"\n", name, sig); } - if (name == NULL || strcmp(name, "fld") != 0) { + if (name == nullptr || strcmp(name, "fld") != 0) { printf("Wrong field name: \"%s\", expected: \"fld\"\n", name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, "I") != 0) { + if (sig == nullptr || strcmp(sig, "I") != 0) { printf("Wrong field sig: \"%s\", expected: \"I\"\n", sig); result = STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm004/getfldnm004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm004/getfldnm004.cpp index 5cb6eca8ddf..f748f6600c0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm004/getfldnm004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm004/getfldnm004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ typedef struct { jboolean is_static; } field_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static field_info fields[] = { @@ -81,12 +81,12 @@ JNIEXPORT jint JNI_OnLoad_getfldnm004(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -102,7 +102,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm004_check(JNIEnv *env, char *name, *sig, *generic; size_t i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -115,7 +115,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm004_check(JNIEnv *env, fid = env->GetFieldID( clazz, fields[i].name, fields[i].sig); } - if (fid == NULL) { + if (fid == nullptr) { printf("(%" PRIuPTR ") cannot get field ID for %s:\"%s\"\n", i, fields[i].name, fields[i].sig); result = STATUS_FAILED; @@ -131,12 +131,12 @@ Java_nsk_jvmti_GetFieldName_getfldnm004_check(JNIEnv *env, if (printdump == JNI_TRUE) { printf(">>> %" PRIuPTR " -- %s:\"%s\"\n", i, name, sig); } - if (name == NULL || strcmp(name, fields[i].name) != 0) { + if (name == nullptr || strcmp(name, fields[i].name) != 0) { printf("(%" PRIuPTR ") wrong field name: \"%s\"", i, name); printf(", expected: \"%s\"\n", fields[i].name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, fields[i].sig) != 0) { + if (sig == nullptr || strcmp(sig, fields[i].sig) != 0) { printf("(%" PRIuPTR ") wrong field sig: \"%s\"", i, sig); printf(", expected: \"%s\"\n", fields[i].sig); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp index 87332b15447..65508b38baf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ extern "C" { /* expected field signatures are below */ static const char *fld_sig[][FLDS_NUM] = { { "_getfldnm005St", "static", - "Lnsk/jvmti/GetFieldName/getfldnm005;", "NULL" }, + "Lnsk/jvmti/GetFieldName/getfldnm005;", "null" }, { "_getfldnm005b", "instance", "Lnsk/jvmti/GetFieldName/getfldnm005b;", @@ -59,10 +59,10 @@ static const char *fld_sig[][FLDS_NUM] = { { "_getfldnm005e", "instance", "Lnsk/jvmti/GetFieldName/getfldnm005e;", - "NULL" }, + "null" }, { "_getfldnm005eSt", "static", "Lnsk/jvmti/GetFieldName/getfldnm005e;", - "NULL" }, + "null" }, { "_getfldnm005if", "instance", "Lnsk/jvmti/GetFieldName/getfldnm005if;", @@ -80,10 +80,10 @@ static const char *fld_sig[][FLDS_NUM] = { { "_getfldnm005gArr", "instance", "[Lnsk/jvmti/GetFieldName/getfldnm005g;", - "NULL" } + "null" } }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static int checkSig(JNIEnv *jni_env, jclass testedCls, jfieldID testedFld, int instance, int idx) { @@ -101,7 +101,7 @@ static int checkSig(JNIEnv *jni_env, jclass testedCls, name); if (strcmp(fld_sig[idx][2], sign) != 0 || - strcmp(fld_sig[idx][3], (gen_sign == NULL) ? "NULL" : gen_sign) != 0) { + strcmp(fld_sig[idx][3], (gen_sign == nullptr) ? "null" : gen_sign) != 0) { NSK_COMPLAIN6( "TEST FAILED: %s field \"%s\" has\n" "\tsignature: \"%s\"\n" @@ -110,20 +110,20 @@ static int checkSig(JNIEnv *jni_env, jclass testedCls, "\t\t\"%s\"\n\n", (instance == 0) ? "instance" : "static", fld_sig[idx][0], - sign, (gen_sign == NULL) ? "NULL" : gen_sign, + sign, (gen_sign == nullptr) ? "null" : gen_sign, fld_sig[idx][2], fld_sig[idx][3]); totRes = STATUS_FAILED; } else NSK_DISPLAY2("CHECK PASSED: signature: \"%s\",\n\tgeneric signature: \"%s\"\n", - sign, (gen_sign == NULL) ? "NULL" : gen_sign); + sign, (gen_sign == nullptr) ? "null" : gen_sign); NSK_DISPLAY0("Deallocating name & signature arrays\n"); if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) name))) totRes = STATUS_FAILED; if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) sign))) totRes = STATUS_FAILED; - if (gen_sign != NULL) + if (gen_sign != nullptr) if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) gen_sign))) totRes = STATUS_FAILED; } @@ -135,7 +135,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetFieldName_getfldnm005_check( JNIEnv *jni, jobject obj) { int res = PASSED, i, instance; - jfieldID testedFld = NULL; + jfieldID testedFld = nullptr; jclass objCls = jni->GetObjectClass(obj); for (i=0; iGetFieldID(objCls, fld_sig[i][0], fld_sig[i][2])) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (testedFld = jni->GetFieldID(objCls, fld_sig[i][0], fld_sig[i][2])) != nullptr)) { NSK_COMPLAIN1("TEST FAILERE: unable to get field ID for \"%s\"\n\n", fld_sig[i][0]); res = STATUS_FAILED; @@ -153,7 +153,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm005_check( } } else - if (!NSK_JNI_VERIFY(jni, (testedFld = jni->GetStaticFieldID(objCls, fld_sig[i][0], fld_sig[i][2])) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (testedFld = jni->GetStaticFieldID(objCls, fld_sig[i][0], fld_sig[i][2])) != nullptr)) { NSK_COMPLAIN1("TEST FAILERE: unable to get field ID for \"%s\"\n\n", fld_sig[i][0]); res = STATUS_FAILED; @@ -189,7 +189,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf005/getintrf005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf005/getintrf005.cpp index ee7b56923c4..89e743f1b9f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf005/getintrf005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf005/getintrf005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getintrf005(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetImplementedInterfaces_getintrf005_check(JNIEnv *env, jclass cl jint icount; jclass *interfaces; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -78,7 +78,7 @@ Java_nsk_jvmti_GetImplementedInterfaces_getintrf005_check(JNIEnv *env, jclass cl if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetImplementedInterfaces(NULL, &icount, &interfaces); + err = jvmti->GetImplementedInterfaces(nullptr, &icount, &interfaces); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -88,7 +88,7 @@ Java_nsk_jvmti_GetImplementedInterfaces_getintrf005_check(JNIEnv *env, jclass cl if (printdump == JNI_TRUE) { printf(">>> (interfaceCountPtr) null pointer check ...\n"); } - err = jvmti->GetImplementedInterfaces(cls, NULL, &interfaces); + err = jvmti->GetImplementedInterfaces(cls, nullptr, &interfaces); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(interfaceCountPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -98,7 +98,7 @@ Java_nsk_jvmti_GetImplementedInterfaces_getintrf005_check(JNIEnv *env, jclass cl if (printdump == JNI_TRUE) { printf(">>> (interfacesPtr) null pointer check ...\n"); } - err = jvmti->GetImplementedInterfaces(cls, &icount, NULL); + err = jvmti->GetImplementedInterfaces(cls, &icount, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(interfacesPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf006/getintrf006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf006/getintrf006.cpp index 50b4f30383e..6c6b4e060fb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf006/getintrf006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf006/getintrf006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getintrf006(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetImplementedInterfaces_getintrf006_check(JNIEnv *env, jclass cl jint icount; jclass *interfaces; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf007/getintrf007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf007/getintrf007.cpp index da6fb2acbc4..5b855f85b9d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf007/getintrf007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf007/getintrf007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ typedef struct { iface_info *ifaces; } class_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -68,17 +68,17 @@ static iface_info i9[] = { }; static class_info classes[] = { - { "InnerClass1", 0, NULL }, - { "InnerInterface1", 0, NULL }, + { "InnerClass1", 0, nullptr }, + { "InnerInterface1", 0, nullptr }, { "InnerInterface2", 1, i2 }, { "InnerClass2", 1, i3 }, - { "OuterClass1", 0, NULL }, - { "OuterClass2", 0, NULL }, - { "OuterInterface1", 0, NULL }, + { "OuterClass1", 0, nullptr }, + { "OuterClass2", 0, nullptr }, + { "OuterInterface1", 0, nullptr }, { "OuterClass3", 1, i7 }, { "OuterInterface2", 1, i8 }, { "OuterClass4", 1, i9 }, - { "OuterClass5", 0, NULL } + { "OuterClass5", 0, nullptr } }; #ifdef STATIC_BUILD @@ -95,12 +95,12 @@ JNIEXPORT jint JNI_OnLoad_getintrf007(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -116,7 +116,7 @@ Java_nsk_jvmti_GetImplementedInterfaces_getintrf007_check(JNIEnv *env, jclass cl char *sig, *generic; int j; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -141,7 +141,7 @@ Java_nsk_jvmti_GetImplementedInterfaces_getintrf007_check(JNIEnv *env, jclass cl } for (j = 0; j < icount; j++) { - if (interfaces[j] == NULL) { + if (interfaces[j] == nullptr) { printf("(%d:%d) null reference\n", i, j); } else { err = jvmti->GetClassSignature(interfaces[j], @@ -153,7 +153,7 @@ Java_nsk_jvmti_GetImplementedInterfaces_getintrf007_check(JNIEnv *env, jclass cl if (printdump == JNI_TRUE) { printf(">>> [%d]: %s\n", j, sig); } - if ((j < classes[i].icount) && (sig == NULL || + if ((j < classes[i].icount) && (sig == nullptr || strcmp(sig, classes[i].ifaces[j].sig) != 0)) { printf("(%d:%d) wrong interface: \"%s\"", i, j, sig); printf(", expected: \"%s\"\n", classes[i].ifaces[j].sig); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt001/getjlocfmt001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt001/getjlocfmt001.cpp index b604af51f8a..2725d43068f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt001/getjlocfmt001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt001/getjlocfmt001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -156,7 +156,7 @@ JNIEXPORT jint JNI_OnLoad_getjlocfmt001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; jvmtiJlocationFormat format; jvmtiEventCallbacks callbacks; @@ -169,7 +169,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* Create data access lock */ @@ -199,16 +199,16 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* enable VMInit event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; /* enable ClassFileLoadHook event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt002/getjlocfmt002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt002/getjlocfmt002.cpp index b8125340a95..f13d7f1cf10 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt002/getjlocfmt002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt002/getjlocfmt002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,8 +45,8 @@ agentProc(jvmtiEnv *jvmti, JNIEnv* jni, void* arg) { if (!nsk_jvmti_waitForSync(timeout)) return; - NSK_DISPLAY0("Check if GetJLocationFormat(NULL) returns JVMTI_ERROR_NULL_POINTER\n"); - if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_NULL_POINTER, jvmti->GetJLocationFormat(NULL))) + NSK_DISPLAY0("Check if GetJLocationFormat(null) returns JVMTI_ERROR_NULL_POINTER\n"); + if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_NULL_POINTER, jvmti->GetJLocationFormat(nullptr))) nsk_jvmti_setFailStatus(); /* resume debugee after last sync */ @@ -69,7 +69,7 @@ JNIEXPORT jint JNI_OnLoad_getjlocfmt002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -82,11 +82,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp index 213daccd426..a1293a0cb5d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,17 +38,17 @@ extern "C" { #define STATUS_FAILED 2 static JavaVM *vm; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static int verbose = 0; static jint result = PASSED; /* the original JNI function table */ -static jniNativeInterface *orig_jni_functions = NULL; +static jniNativeInterface *orig_jni_functions = nullptr; /* the redirected JNI function table */ -static jniNativeInterface *redir_jni_functions = NULL; +static jniNativeInterface *redir_jni_functions = nullptr; /* number of the redirected JNI function calls */ static volatile int redir_calls = 0; @@ -120,7 +120,7 @@ static void doRestore(JNIEnv *env) { } static void checkRedir(JNIEnv *env, int exCalls) { - jniNativeInterface *tested_jni_functions = NULL; + jniNativeInterface *tested_jni_functions = nullptr; jvmtiError err; jint res; @@ -156,7 +156,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetJNIFunctionTable_getjniftab001_check(JNIEnv *env, jobject obj) { int exitCode = PASSED; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; @@ -191,14 +191,14 @@ JNIEXPORT jint JNI_OnLoad_getjniftab001(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "-verbose") == 0) + if (options != nullptr && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp index db01fdbe12d..7c564bfa28c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,8 +33,8 @@ extern "C" { #define STATUS_FAILED 2 static JavaVM *vm; -static jvmtiEnv *jvmti = NULL; -static jniNativeInterface *orig_jni_functions = NULL; +static jvmtiEnv *jvmti = nullptr; +static jniNativeInterface *orig_jni_functions = nullptr; static int verbose = 0; static jint result = PASSED; @@ -46,7 +46,7 @@ void redirect(JNIEnv *env, jvmtiError exError) { printf("\ntrying to get the JNI function table expecting the error %s to be returned ...\n", TranslateError(exError)); - err = jvmti->GetJNIFunctionTable((exError == JVMTI_ERROR_NULL_POINTER) ? NULL : &orig_jni_functions); + err = jvmti->GetJNIFunctionTable((exError == JVMTI_ERROR_NULL_POINTER) ? nullptr : &orig_jni_functions); if (err != exError) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: GetJNIFunctionTable() returns %s instead of %s as expected\n", @@ -61,9 +61,9 @@ void redirect(JNIEnv *env, jvmtiError exError) { JNIEXPORT jint JNICALL Java_nsk_jvmti_GetJNIFunctionTable_getjniftab002_check(JNIEnv *env, jobject obj) { jint err; - JNIEnv *nextEnv = NULL; + JNIEnv *nextEnv = nullptr; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; @@ -115,14 +115,14 @@ JNIEXPORT jint JNI_OnLoad_getjniftab002(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "-verbose") == 0) + if (options != nullptr && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab001/linetab001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab001/linetab001.cpp index 17884af7497..669374789ec 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab001/linetab001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab001/linetab001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,8 +67,8 @@ void checkMeth(JNIEnv *env, jclass cl, const char *name, const char *sig, } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { - printf("Name = %s, sig = %s: mid = NULL\n", name, sig); + if (mid == nullptr) { + printf("Name = %s, sig = %s: mid = null\n", name, sig); result = STATUS_FAILED; return; } @@ -132,7 +132,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab002/linetab002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab002/linetab002.cpp index a4df264ccbe..ad5984a64d9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab002/linetab002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab002/linetab002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -98,7 +98,7 @@ Java_nsk_jvmti_GetLineNumberTable_linetab002_check(JNIEnv *env, jclass cls) { jint entryCount; jvmtiLineNumberEntry *table; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -108,7 +108,7 @@ Java_nsk_jvmti_GetLineNumberTable_linetab002_check(JNIEnv *env, jclass cls) { } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -116,7 +116,7 @@ Java_nsk_jvmti_GetLineNumberTable_linetab002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetLineNumberTable(NULL, &entryCount, &table); + err = jvmti->GetLineNumberTable(nullptr, &entryCount, &table); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -126,7 +126,7 @@ Java_nsk_jvmti_GetLineNumberTable_linetab002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (entryCountPtr) null pointer check ...\n"); } - err = jvmti->GetLineNumberTable(mid, NULL, &table); + err = jvmti->GetLineNumberTable(mid, nullptr, &table); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(entryCountPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -136,7 +136,7 @@ Java_nsk_jvmti_GetLineNumberTable_linetab002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (tablePtr) null pointer check ...\n"); } - err = jvmti->GetLineNumberTable(mid, &entryCount, NULL); + err = jvmti->GetLineNumberTable(mid, &entryCount, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(tablePtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab003/linetab003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab003/linetab003.cpp index 26ba35b8472..00468064849 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab003/linetab003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab003/linetab003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -99,7 +99,7 @@ Java_nsk_jvmti_GetLineNumberTable_linetab003_check(JNIEnv *env, jclass cls) { jvmtiLineNumberEntry *table; int i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -109,7 +109,7 @@ Java_nsk_jvmti_GetLineNumberTable_linetab003_check(JNIEnv *env, jclass cls) { } mid = env->GetMethodID(cls, "meth", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss001/loadedclss001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss001/loadedclss001.cpp index 12515f15fca..23bd64d6284 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss001/loadedclss001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss001/loadedclss001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_loadedclss001(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_GetLoadedClasses_loadedclss001_check(JNIEnv *env, jclass cls) { jclass *classes; jint classCount; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_GetLoadedClasses_loadedclss001_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (classCountPtr) null pointer check ...\n"); } - err = jvmti->GetLoadedClasses(NULL, &classes); + err = jvmti->GetLoadedClasses(nullptr, &classes); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -87,7 +87,7 @@ Java_nsk_jvmti_GetLoadedClasses_loadedclss001_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (classesPtr) null pointer check ...\n"); } - err = jvmti->GetLoadedClasses(&classCount, NULL); + err = jvmti->GetLoadedClasses(&classCount, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss002/loadedclss002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss002/loadedclss002.cpp index 8a65e34cfd4..73e8472c3c4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss002/loadedclss002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss002/loadedclss002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,9 +35,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject testedClassLoader = NULL; -static jclass testedClass = NULL; -static jfieldID testedFieldID = NULL; +static jobject testedClassLoader = nullptr; +static jclass testedClass = nullptr; +static jfieldID testedFieldID = nullptr; static const char *CLASS_SIG[] = { "Lnsk/jvmti/GetLoadedClasses/loadedclss002;", @@ -63,15 +63,15 @@ static int lookup(jvmtiEnv* jvmti, if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(classes[i], &signature, &generic))) break; - if (signature != NULL && strcmp(signature, exp_sig) == 0) { + if (signature != nullptr && strcmp(signature, exp_sig) == 0) { NSK_DISPLAY1("Expected class found: %s\n", exp_sig); found = NSK_TRUE; } - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); - if (generic != NULL) + if (generic != nullptr) jvmti->Deallocate((unsigned char*)generic); } @@ -100,7 +100,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; } - if (!NSK_VERIFY(classes != NULL)) { + if (!NSK_VERIFY(classes != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -121,7 +121,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } } - if (classes != NULL) + if (classes != nullptr) jvmti->Deallocate((unsigned char*)classes); if (!nsk_jvmti_resumeSync()) @@ -143,7 +143,7 @@ JNIEXPORT jint JNI_OnLoad_loadedclss002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -153,10 +153,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal001/getlocal001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal001/getlocal001.cpp index 42bdfb46cc2..9095312a5b6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal001/getlocal001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal001/getlocal001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -146,7 +146,7 @@ void check2(jvmtiEnv *jvmti_env, jthread thr, jint depth, void check3(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jint depth, jvmtiLocalVariableEntry *table, jint count, jmethodID mid) { jvmtiError err; - jobject ob1 = NULL, ob2 = NULL; + jobject ob1 = nullptr, ob2 = nullptr; jclass cls; jfieldID fid; jint fldVal = 0; @@ -171,7 +171,7 @@ void check3(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jint depth, continue; } fid = env->GetFieldID(cls, "fld", "I"); - if (fid == NULL) { + if (fid == nullptr) { printf("Cannot find ID for \"fld\" field of meth03\n"); env->ExceptionClear(); result = STATUS_FAILED; @@ -284,7 +284,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID mid, jboolean was_poped_by_exception, jvalue return_value) { jvmtiError err; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; int i; @@ -307,7 +307,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env, printf(">>> exit: meth02\n"); } check2(jvmti_env, thr, 0, table, entryCount); - mid2 = NULL; + mid2 = nullptr; } else if (mid == mid3) { if (printdump == JNI_TRUE) { printf(">>> exit: meth03\n"); @@ -320,7 +320,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env, check4(jvmti_env, thr, 0, table, entryCount); } } - if (table != NULL) { + if (table != nullptr) { for (i = 0; i < entryCount; i++) { jvmti_env->Deallocate((unsigned char*)table[i].name); jvmti_env->Deallocate((unsigned char*)table[i].signature); @@ -332,7 +332,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env, void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID method, jlocation location) { jvmtiError err; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jmethodID mid; jlocation loc; @@ -376,7 +376,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, printf("ERROR: didn't know where we got called from"); result = STATUS_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (i = 0; i < entryCount; i++) { jvmti_env->Deallocate((unsigned char*)table[i].name); jvmti_env->Deallocate((unsigned char*)table[i].signature); @@ -400,12 +400,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -474,7 +474,7 @@ Java_nsk_jvmti_GetLocalVariable_getlocal001_getMeth(JNIEnv *env, jclass cls, result = STATUS_FAILED; return; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable METHOD_EXIT event: %s (%d)\n", TranslateError(err), err); @@ -487,7 +487,7 @@ Java_nsk_jvmti_GetLocalVariable_getlocal001_getMeth(JNIEnv *env, jclass cls, return; } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal002/getlocal002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal002/getlocal002.cpp index 6f6081fe24e..48fac6fc75f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal002/getlocal002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal002/getlocal002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,12 +33,12 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jmethodID mid = NULL; +static jmethodID mid = nullptr; void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID method, @@ -52,7 +52,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env, if (mid == method) { err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, - JVMTI_EVENT_METHOD_EXIT, NULL); + JVMTI_EVENT_METHOD_EXIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to disable metod exit event: %s (%d)\n", TranslateError(err), err); @@ -98,7 +98,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env, if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetLocalFloat(thr, 0, table[i].slot, NULL); + err = jvmti->GetLocalFloat(thr, 0, table[i].slot, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -129,12 +129,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -181,7 +181,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_GetLocalVariable_getlocal002_getMeth(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -191,14 +191,14 @@ Java_nsk_jvmti_GetLocalVariable_getlocal002_getMeth(JNIEnv *env, jclass cls) { !caps.can_generate_method_exit_events) return; mid = env->GetMethodID(cls, "meth01", "()D"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for meth01\n"); result = STATUS_FAILED; return; } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_METHOD_EXIT, NULL); + JVMTI_EVENT_METHOD_EXIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable metod exit event: %s (%d)\n", TranslateError(err), err); @@ -215,12 +215,12 @@ Java_nsk_jvmti_GetLocalVariable_getlocal002_checkLoc(JNIEnv *env, jmethodID mid; jint i1; - if (jvmti == NULL) { + if (jvmti == nullptr) { return; } mid = env->GetStaticMethodID(cls, "meth02", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for meth02\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab001/localtab001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab001/localtab001.cpp index fcc3e5040ba..bca81f0d9fe 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab001/localtab001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab001/localtab001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,47 +42,47 @@ static jvmtiEnv *jvmti; static jvmtiCapabilities caps; static jint result = PASSED; static jvmtiLocalVariableEntry m1[] = { - { 0, 21, (char*) "this", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", NULL, 0 }, - { 4, 17, (char*) "l", (char*) "J", NULL, 1 }, - { 7, 14, (char*) "f", (char*) "F", NULL, 2 }, - { 12, 9, (char*) "d", (char*) "D", NULL, 3 } + { 0, 21, (char*) "this", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", nullptr, 0 }, + { 4, 17, (char*) "l", (char*) "J", nullptr, 1 }, + { 7, 14, (char*) "f", (char*) "F", nullptr, 2 }, + { 12, 9, (char*) "d", (char*) "D", nullptr, 3 } }; static jvmtiLocalVariableEntry m2[] = { - { 0, 32, (char*) "this", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", NULL, 0 }, - { 0, 32, (char*) "step", (char*) "I", NULL, 1 }, - { 2, 29, (char*) "i2", (char*) "S", NULL, 2 }, - { 4, 27, (char*) "i3", (char*) "C", NULL, 3 }, - { 7, 24, (char*) "i4", (char*) "B", NULL, 4 }, - { 10,21, (char*) "i5", (char*) "Z", NULL, 5 }, - { 13,18, (char*) "i1", (char*) "I", NULL, 6 } + { 0, 32, (char*) "this", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", nullptr, 0 }, + { 0, 32, (char*) "step", (char*) "I", nullptr, 1 }, + { 2, 29, (char*) "i2", (char*) "S", nullptr, 2 }, + { 4, 27, (char*) "i3", (char*) "C", nullptr, 3 }, + { 7, 24, (char*) "i4", (char*) "B", nullptr, 4 }, + { 10,21, (char*) "i5", (char*) "Z", nullptr, 5 }, + { 13,18, (char*) "i1", (char*) "I", nullptr, 6 } }; static jvmtiLocalVariableEntry m3[] = { - { 0, 70, (char*) "ob", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", NULL, 0 }, - { 2, 67, (char*) "ob1", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", NULL, 1 }, - { 56,13, (char*) "ob2", (char*) "[I", NULL, 2 }, - { 61, 0, (char*) "i", (char*) "I", NULL, 3 }, - { 64, 5, (char*) "e", (char*) "Ljava/lang/IndexOutOfBoundsException;", NULL, 4 } + { 0, 70, (char*) "ob", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", nullptr, 0 }, + { 2, 67, (char*) "ob1", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", nullptr, 1 }, + { 56,13, (char*) "ob2", (char*) "[I", nullptr, 2 }, + { 61, 0, (char*) "i", (char*) "I", nullptr, 3 }, + { 64, 5, (char*) "e", (char*) "Ljava/lang/IndexOutOfBoundsException;", nullptr, 4 } }; static jvmtiLocalVariableEntry m4[] = { - { 0, 33, (char*) "i1", (char*) "I", NULL, 0 }, - { 0, 33, (char*) "l", (char*) "J", NULL, 1 }, - { 0, 33, (char*) "i2", (char*) "S", NULL, 2 }, - { 0, 33, (char*) "d", (char*) "D", NULL, 3 }, - { 0, 33, (char*) "i3", (char*) "C", NULL, 4 }, - { 0, 33, (char*) "f", (char*) "F", NULL, 5 }, - { 0, 33, (char*) "i4", (char*) "B", NULL, 6 }, - { 0, 33, (char*) "b", (char*) "Z", NULL, 7 } + { 0, 33, (char*) "i1", (char*) "I", nullptr, 0 }, + { 0, 33, (char*) "l", (char*) "J", nullptr, 1 }, + { 0, 33, (char*) "i2", (char*) "S", nullptr, 2 }, + { 0, 33, (char*) "d", (char*) "D", nullptr, 3 }, + { 0, 33, (char*) "i3", (char*) "C", nullptr, 4 }, + { 0, 33, (char*) "f", (char*) "F", nullptr, 5 }, + { 0, 33, (char*) "i4", (char*) "B", nullptr, 6 }, + { 0, 33, (char*) "b", (char*) "Z", nullptr, 7 } }; static jvmtiLocalVariableEntry m5[] = { - { 0, 6, (char*) "this", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", NULL, 0 }, - { 0, 6, (char*) "i", (char*) "I", NULL, 1 }, - { 2, 4, (char*) "i12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", (char*) "I", NULL, 2 } + { 0, 6, (char*) "this", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", nullptr, 0 }, + { 0, 6, (char*) "i", (char*) "I", nullptr, 1 }, + { 2, 4, (char*) "i12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", (char*) "I", nullptr, 2 } }; static jvmtiLocalVariableEntry m6[] = { - { 0, 5, (char*) "this", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", NULL, 0 }, + { 0, 5, (char*) "this", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", nullptr, 0 }, }; static info meth_tab[] = { - { 0, NULL }, + { 0, nullptr }, { 4, m1 }, { 7, m2 }, { 5, m3 }, @@ -106,8 +106,8 @@ void checkMeth(JNIEnv *env, jclass cl, const char *name, const char *sig, } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { - printf("Name = %s, sig = %s: mid = NULL\n", name, sig); + if (mid == nullptr) { + printf("Name = %s, sig = %s: mid = null\n", name, sig); result = STATUS_FAILED; return; } @@ -194,7 +194,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab002/localtab002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab002/localtab002.cpp index 10ce5662641..877ed5fe517 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab002/localtab002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab002/localtab002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -98,7 +98,7 @@ Java_nsk_jvmti_GetLocalVariableTable_localtab002_check(JNIEnv *env, jclass cls) jint entryCount; jvmtiLocalVariableEntry *table; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -106,7 +106,7 @@ Java_nsk_jvmti_GetLocalVariableTable_localtab002_check(JNIEnv *env, jclass cls) if (!caps.can_access_local_variables) return result; mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"\"!\n"); return STATUS_FAILED; } @@ -114,7 +114,7 @@ Java_nsk_jvmti_GetLocalVariableTable_localtab002_check(JNIEnv *env, jclass cls) if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetLocalVariableTable(NULL, &entryCount, &table); + err = jvmti->GetLocalVariableTable(nullptr, &entryCount, &table); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -124,7 +124,7 @@ Java_nsk_jvmti_GetLocalVariableTable_localtab002_check(JNIEnv *env, jclass cls) if (printdump == JNI_TRUE) { printf(">>> (entryCountPtr) null pointer check ...\n"); } - err = jvmti->GetLocalVariableTable(mid, NULL, &table); + err = jvmti->GetLocalVariableTable(mid, nullptr, &table); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -134,7 +134,7 @@ Java_nsk_jvmti_GetLocalVariableTable_localtab002_check(JNIEnv *env, jclass cls) if (printdump == JNI_TRUE) { printf(">>> (tablePtr) null pointer check ...\n"); } - err = jvmti->GetLocalVariableTable(mid, &entryCount, NULL); + err = jvmti->GetLocalVariableTable(mid, &entryCount, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -142,7 +142,7 @@ Java_nsk_jvmti_GetLocalVariableTable_localtab002_check(JNIEnv *env, jclass cls) } mid = env->GetStaticMethodID(cls, "check", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"check\"!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab003/localtab003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab003/localtab003.cpp index f1763f736ea..00f3498d4d8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab003/localtab003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab003/localtab003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -99,7 +99,7 @@ Java_nsk_jvmti_GetLocalVariableTable_localtab003_check(JNIEnv *env, jclass cls) jvmtiLocalVariableEntry *table; int i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -107,7 +107,7 @@ Java_nsk_jvmti_GetLocalVariableTable_localtab003_check(JNIEnv *env, jclass cls) if (!caps.can_access_local_variables) return result; mid = env->GetMethodID(cls, "meth", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp index 8f25575e04d..2bd35a65392 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,12 +81,12 @@ typedef struct { /* local variables of a method */ /* list of tested methods */ static methodInfo methInfo[] = { - { 1, (char*) "", (char*) "()V", 6, constr_lv, NULL }, - { 1, (char*) "finMethod", (char*) "(CJIJ)V", 7, finMeth_lv, NULL }, - { 0, (char*) "statMethod", (char*) "(III)D", 5, statMeth_lv, NULL } + { 1, (char*) "", (char*) "()V", 6, constr_lv, nullptr }, + { 1, (char*) "finMethod", (char*) "(CJIJ)V", 7, finMeth_lv, nullptr }, + { 0, (char*) "statMethod", (char*) "(III)D", 5, statMeth_lv, nullptr } }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static int checkAttr(JNIEnv *jni_env, jclass testedCls) { @@ -102,7 +102,7 @@ static int checkAttr(JNIEnv *jni_env, jclass testedCls) { methInfo[i].mid = jni_env->GetMethodID(testedCls, methInfo[i].m_name, methInfo[i].m_sign); else /* a static method */ methInfo[i].mid = jni_env->GetStaticMethodID(testedCls, methInfo[i].m_name, methInfo[i].m_sign); - if (methInfo[i].mid == NULL) { + if (methInfo[i].mid == nullptr) { NSK_COMPLAIN3("TEST FAILURE: unable to get the method ID for the %s method \"%s\", signature \"%s\"\n\n", methInfo[i].inst ? "instance" : "static", methInfo[i].m_name, methInfo[i].m_sign); @@ -196,7 +196,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to access local variables */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp index 3a681654762..0436b7f1d49 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,35 +45,35 @@ typedef struct { /* local variable info */ /* expected local variable info are below */ static localVar constr_lv[] = { /* constructor's local variables */ - { "this", "Lnsk/jvmti/GetLocalVariableTable/localtab005a;", "NULL" }, + { "this", "Lnsk/jvmti/GetLocalVariableTable/localtab005a;", "null" }, { "constr_b", "Lnsk/jvmti/GetLocalVariableTable/localtab005b;", "Lnsk/jvmti/GetLocalVariableTable/localtab005b;" }, - { "constr_i", "I", "NULL" }, + { "constr_i", "I", "null" }, { "constr_c", "Lnsk/jvmti/GetLocalVariableTable/localtab005c;", "Lnsk/jvmti/GetLocalVariableTable/localtab005c;" }, - { "constr_f", "F", "NULL" }, - { "constr_ch", "C", "NULL" }, + { "constr_f", "F", "null" }, + { "constr_ch", "C", "null" }, { "constr_if", "Lnsk/jvmti/GetLocalVariableTable/localtab005if;", "Lnsk/jvmti/GetLocalVariableTable/localtab005if;" } }; static localVar insMeth_lv[] = { /* finMethod()'s local variables */ - { "this", "Lnsk/jvmti/GetLocalVariableTable/localtab005a;", "NULL" }, - { "ins_c", "C", "NULL" }, - { "ins_i", "J", "NULL" }, + { "this", "Lnsk/jvmti/GetLocalVariableTable/localtab005a;", "null" }, + { "ins_c", "C", "null" }, + { "ins_i", "J", "null" }, { "ltab005d", "Lnsk/jvmti/GetLocalVariableTable/localtab005d;", "Lnsk/jvmti/GetLocalVariableTable/localtab005d;" }, - { "ins_k", "J", "NULL" }, - { "ins_l", "J", "NULL" }, + { "ins_k", "J", "null" }, + { "ins_l", "J", "null" }, { "ins_g", "Lnsk/jvmti/GetLocalVariableTable/localtab005g;", "Lnsk/jvmti/GetLocalVariableTable/localtab005g;" } }; static localVar statMeth_lv[] = { /* statMethod()'s local variables */ - { "stat_x", "I", "NULL" }, - { "stat_y", "I", "NULL" }, - { "stat_z", "I", "NULL" }, - { "stat_j", "D", "NULL" }, + { "stat_x", "I", "null" }, + { "stat_y", "I", "null" }, + { "stat_z", "I", "null" }, + { "stat_j", "D", "null" }, { "stat_d", "Lnsk/jvmti/GetLocalVariableTable/localtab005d;", "Lnsk/jvmti/GetLocalVariableTable/localtab005d;" } }; @@ -89,12 +89,12 @@ typedef struct { /* local variables of a method */ /* list of tested methods */ static methodInfo methInfo[] = { - { 1, (char*) "", (char*) "()V", 7, constr_lv, NULL }, - { 1, (char*) "insMethod", (char*) "(CJLnsk/jvmti/GetLocalVariableTable/localtab005d;J)V", 7, insMeth_lv, NULL }, - { 0, (char*) "statMethod", (char*) "(III)D", 5, statMeth_lv, NULL } + { 1, (char*) "", (char*) "()V", 7, constr_lv, nullptr }, + { 1, (char*) "insMethod", (char*) "(CJLnsk/jvmti/GetLocalVariableTable/localtab005d;J)V", 7, insMeth_lv, nullptr }, + { 0, (char*) "statMethod", (char*) "(III)D", 5, statMeth_lv, nullptr } }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static int checkAttr(JNIEnv *jni_env, jclass testedCls) { @@ -110,7 +110,7 @@ static int checkAttr(JNIEnv *jni_env, jclass testedCls) { methInfo[i].mid = jni_env->GetMethodID(testedCls, methInfo[i].m_name, methInfo[i].m_sign); else /* a static method */ methInfo[i].mid = jni_env->GetStaticMethodID(testedCls, methInfo[i].m_name, methInfo[i].m_sign); - if (methInfo[i].mid == NULL) { + if (methInfo[i].mid == nullptr) { NSK_COMPLAIN3("TEST FAILURE: unable to get the method ID for the %s method \"%s\", signature \"%s\"\n\n", methInfo[i].inst ? "instance" : "static", methInfo[i].m_name, methInfo[i].m_sign); @@ -137,7 +137,7 @@ static int checkAttr(JNIEnv *jni_env, jclass testedCls) { NSK_COMPLAIN4("\t%d) name: \"%s\"\n\tsignature: \"%s\"\n\tgeneric signature: \"%s\"\n", j+1, lv_table[j].name, lv_table[j].signature, - (lv_table[j].generic_signature == NULL) ? "NULL" : lv_table[j].generic_signature); + (lv_table[j].generic_signature == nullptr) ? "null" : lv_table[j].generic_signature); NSK_COMPLAIN0("\n"); continue; @@ -155,7 +155,7 @@ static int checkAttr(JNIEnv *jni_env, jclass testedCls) { for (k=0; kGetMethodID(cl, name, sig); } - if (mid == NULL) { + if (mid == nullptr) { printf("Name = %s, sig = %s: mid = 0\n", name, sig); result = STATUS_FAILED; return; @@ -77,7 +77,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMaxLocals/maxloc002/maxloc002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMaxLocals/maxloc002/maxloc002.cpp index 6fbea7d6a5a..81851e1e282 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMaxLocals/maxloc002/maxloc002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMaxLocals/maxloc002/maxloc002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_maxloc002(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,13 +70,13 @@ Java_nsk_jvmti_GetMaxLocals_maxloc002_check(JNIEnv *env, jclass cls) { jmethodID mid; jint max; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"\"!\n"); return STATUS_FAILED; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetMaxLocals_maxloc002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetMaxLocals(NULL, &max); + err = jvmti->GetMaxLocals(nullptr, &max); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -94,7 +94,7 @@ Java_nsk_jvmti_GetMaxLocals_maxloc002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetMaxLocals(mid, NULL); + err = jvmti->GetMaxLocals(mid, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -102,7 +102,7 @@ Java_nsk_jvmti_GetMaxLocals_maxloc002_check(JNIEnv *env, jclass cls) { } mid = env->GetStaticMethodID(cls, "check", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"check\"!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls001/declcls001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls001/declcls001.cpp index ec3691af227..bfb2441f7dc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls001/declcls001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls001/declcls001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,8 +49,8 @@ void checkMeth(JNIEnv *env, const char *cl_name, const char *name, const char *s } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { - printf("%s.%s%s: mid = NULL\n", cl_name, name, sig); + if (mid == nullptr) { + printf("%s.%s%s: mid = null\n", cl_name, name, sig); result = STATUS_FAILED; return; } @@ -95,7 +95,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls002/declcls002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls002/declcls002.cpp index a923fd4d950..8edd98ab96e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls002/declcls002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls002/declcls002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_declcls002(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,13 +70,13 @@ Java_nsk_jvmti_GetMethodDeclaringClass_declcls002_check(JNIEnv *env, jclass cls) jmethodID mid; jclass declaringClass; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetMethodDeclaringClass_declcls002_check(JNIEnv *env, jclass cls) if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetMethodDeclaringClass(NULL, &declaringClass); + err = jvmti->GetMethodDeclaringClass(nullptr, &declaringClass); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -94,7 +94,7 @@ Java_nsk_jvmti_GetMethodDeclaringClass_declcls002_check(JNIEnv *env, jclass cls) if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetMethodDeclaringClass(mid, NULL); + err = jvmti->GetMethodDeclaringClass(mid, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls003/declcls003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls003/declcls003.cpp index 8f447709770..ca7bce9eb81 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls003/declcls003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls003/declcls003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static const char *exp_class_sig = "Ljava/lang/Object;"; @@ -55,8 +55,8 @@ void do_check(JNIEnv *env, const char *name, const char *meth, const char *sig) cl = env->FindClass(name); mid = env->GetMethodID(cl, meth, sig); - if (mid == NULL) { - printf("%s.%s%s: mid = NULL\n", name, meth, sig); + if (mid == nullptr) { + printf("%s.%s%s: mid = null\n", name, meth, sig); result = STATUS_FAILED; return; } @@ -105,12 +105,12 @@ JNIEXPORT jint JNI_OnLoad_declcls003(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc001/methloc001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc001/methloc001.cpp index c8e9cd6c730..53978f36efe 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc001/methloc001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc001/methloc001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,8 +59,8 @@ void checkMeth(JNIEnv *env, jclass cl, const char *name, const char *sig, } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { - printf("Name = %s, sig = %s: mid = NULL\n", name, sig); + if (mid == nullptr) { + printf("Name = %s, sig = %s: mid = null\n", name, sig); result = STATUS_FAILED; return; } @@ -103,7 +103,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc002/methloc002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc002/methloc002.cpp index 858553a7d85..2e596dd7861 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc002/methloc002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc002/methloc002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_methloc002(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -71,13 +71,13 @@ Java_nsk_jvmti_GetMethodLocation_methloc002_check(JNIEnv *env, jclass cls) { jlocation startLocation; jlocation endLocation; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"\"!\n"); return STATUS_FAILED; } @@ -85,7 +85,7 @@ Java_nsk_jvmti_GetMethodLocation_methloc002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetMethodLocation(NULL, &startLocation, &endLocation); + err = jvmti->GetMethodLocation(nullptr, &startLocation, &endLocation); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -95,7 +95,7 @@ Java_nsk_jvmti_GetMethodLocation_methloc002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (startLocationPtr) null pointer check ...\n"); } - err = jvmti->GetMethodLocation(mid, NULL, &endLocation); + err = jvmti->GetMethodLocation(mid, nullptr, &endLocation); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(startLocationPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -105,7 +105,7 @@ Java_nsk_jvmti_GetMethodLocation_methloc002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (endLocationPtr) null pointer check ...\n"); } - err = jvmti->GetMethodLocation(mid, &startLocation, NULL); + err = jvmti->GetMethodLocation(mid, &startLocation, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(endLocationPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -113,7 +113,7 @@ Java_nsk_jvmti_GetMethodLocation_methloc002_check(JNIEnv *env, jclass cls) { } mid = env->GetStaticMethodID(cls, "check", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"check\"!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod001/methmod001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod001/methmod001.cpp index 838adc03019..3b44d8daf4c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod001/methmod001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod001/methmod001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ extern "C" { #define ACC_NATIVE 0x100 #define ACC_ABSTRACT 0x400 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -70,7 +70,7 @@ void checkMeth(jvmtiEnv *jvmti_env, JNIEnv *env, jclass cl, } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find MethodID for \"%s%s\"\n", name, sig); result = STATUS_FAILED; return; @@ -135,12 +135,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -154,7 +154,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_CLASS_LOAD, NULL); + JVMTI_EVENT_CLASS_LOAD, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable event JVMTI_EVENT_CLASS_LOAD: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod002/methmod002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod002/methmod002.cpp index 5542a3d35fc..02fc2a5ba77 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod002/methmod002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod002/methmod002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_methmod002(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,13 +70,13 @@ Java_nsk_jvmti_GetMethodModifiers_methmod002_check(JNIEnv *env, jclass cls) { jmethodID mid; jint modifiers; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetMethodModifiers_methmod002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetMethodModifiers(NULL, &modifiers); + err = jvmti->GetMethodModifiers(nullptr, &modifiers); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -94,7 +94,7 @@ Java_nsk_jvmti_GetMethodModifiers_methmod002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetMethodModifiers(mid, NULL); + err = jvmti->GetMethodModifiers(mid, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname001/methname001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname001/methname001.cpp index 79c0db9c6af..6c4dcbb889e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname001/methname001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname001/methname001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -50,7 +50,7 @@ void checkMeth(jvmtiEnv *jvmti_env, JNIEnv *env, jclass cl, } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find MethodID for \"%s%s\"\n", name, sig); result = STATUS_FAILED; return; @@ -115,12 +115,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -134,7 +134,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_CLASS_LOAD, NULL); + JVMTI_EVENT_CLASS_LOAD, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable event JVMTI_EVENT_CLASS_LOAD: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname002/methname002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname002/methname002.cpp index 292d5f2b4be..bd503a6ae8c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname002/methname002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname002/methname002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_methname002(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,13 +70,13 @@ Java_nsk_jvmti_GetMethodName_methname002_check(JNIEnv *env, jclass cls) { jmethodID mid; char *name, *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetMethodName_methname002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetMethodName(NULL, &name, &sig, &generic); + err = jvmti->GetMethodName(nullptr, &name, &sig, &generic); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -94,7 +94,7 @@ Java_nsk_jvmti_GetMethodName_methname002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (namePtr) null pointer check ...\n"); } - err = jvmti->GetMethodName(mid, NULL, &sig, &generic); + err = jvmti->GetMethodName(mid, nullptr, &sig, &generic); if (err != JVMTI_ERROR_NONE) { printf("(namePtr) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -103,7 +103,7 @@ Java_nsk_jvmti_GetMethodName_methname002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> sig = \"%s\", generic = \"%s\"\n", sig, generic); } - if (sig == NULL || strcmp(sig, "()V") != 0) { + if (sig == nullptr || strcmp(sig, "()V") != 0) { printf("Wrong field sig: \"%s\", expected: \"I\"\n", sig); result = STATUS_FAILED; } @@ -112,7 +112,7 @@ Java_nsk_jvmti_GetMethodName_methname002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (signaturePtr) null pointer check ...\n"); } - err = jvmti->GetMethodName(mid, &name, NULL, &generic); + err = jvmti->GetMethodName(mid, &name, nullptr, &generic); if (err != JVMTI_ERROR_NONE) { printf("(signaturePtr) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -121,7 +121,7 @@ Java_nsk_jvmti_GetMethodName_methname002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> name = \"%s\", generic = \"%s\"\n", name, generic); } - if (name == NULL || strcmp(name, "") != 0) { + if (name == nullptr || strcmp(name, "") != 0) { printf("Wrong field name: \"%s\", expected: \"fld\"\n", name); result = STATUS_FAILED; } @@ -130,7 +130,7 @@ Java_nsk_jvmti_GetMethodName_methname002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (genericPtr) null pointer check ...\n"); } - err = jvmti->GetMethodName(mid, &name, &sig, NULL); + err = jvmti->GetMethodName(mid, &name, &sig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(signaturePtr) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -139,11 +139,11 @@ Java_nsk_jvmti_GetMethodName_methname002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> name = \"%s\", sig = \"%s\"\n", name, sig); } - if (name == NULL || strcmp(name, "") != 0) { + if (name == nullptr || strcmp(name, "") != 0) { printf("Wrong field name: \"%s\", expected: \"fld\"\n", name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, "()V") != 0) { + if (sig == nullptr || strcmp(sig, "()V") != 0) { printf("Wrong field sig: \"%s\", expected: \"I\"\n", sig); result = STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname003/methname003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname003/methname003.cpp index 669500625f1..a7a3a44022f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname003/methname003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname003/methname003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,14 +60,14 @@ static const char *meth_sig[][METH_NUM][TOT_NUM] = { { { "methname003eMeth", "instance", "(Lnsk/jvmti/GetMethodName/methname003e;)V", - "NULL" }, + "null" }, { "methname003eMethSt", "static", "(Lnsk/jvmti/GetMethodName/methname003e;)V", - "NULL" } }, + "null" } }, { { "methname003ifMeth", "instance", "()I", - "NULL" }, + "null" }, { "methname003ifMeth2", "instance", "(Ljava/lang/Object;)I", "(TT;)I" } }, @@ -80,7 +80,7 @@ static const char *meth_sig[][METH_NUM][TOT_NUM] = { "(TA;TB;)V" } } }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static int checkSig(JNIEnv *jni_env, jmethodID testedMeth, int instance, int clsIdx, int methIdx) { @@ -98,17 +98,17 @@ static int checkSig(JNIEnv *jni_env, jmethodID testedMeth, meth_sig[clsIdx][methIdx][0]); if (strcmp(meth_sig[clsIdx][methIdx][2], sign) != 0 || - strcmp(meth_sig[clsIdx][methIdx][3], (gen_sign == NULL) ? "NULL" : gen_sign) != 0) { + strcmp(meth_sig[clsIdx][methIdx][3], (gen_sign == nullptr) ? "null" : gen_sign) != 0) { NSK_COMPLAIN5("TEST FAILED: class: \"%s\" \ has\n\tsignature: \"%s\"\n\tgeneric signature: \"%s\"\n\n\tExpected: \"%s\"\n\t\t\"%s\"\n\n", meth_sig[clsIdx][methIdx][0], - sign, (gen_sign == NULL) ? "NULL" : gen_sign, + sign, (gen_sign == nullptr) ? "null" : gen_sign, meth_sig[clsIdx][methIdx][2], meth_sig[clsIdx][methIdx][3]); totRes = STATUS_FAILED; } else NSK_DISPLAY2("CHECK PASSED: signature: \"%s\",\n\tgeneric signature: \"%s\"\n", - sign, (gen_sign == NULL) ? "NULL" : gen_sign); + sign, (gen_sign == nullptr) ? "null" : gen_sign); NSK_DISPLAY0("Deallocating name & signature arrays\n"); if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) name))) { @@ -117,7 +117,7 @@ has\n\tsignature: \"%s\"\n\tgeneric signature: \"%s\"\n\n\tExpected: \"%s\"\n\t\ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) sign))) { totRes = STATUS_FAILED; } - if (gen_sign != NULL) + if (gen_sign != nullptr) if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) gen_sign))) { totRes = STATUS_FAILED; } @@ -130,7 +130,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetMethodName_methname003_check( JNIEnv *jni, jobject obj, jobject testedObj, jint clsIdx) { int res = PASSED, i, instance; - jmethodID testedMeth = NULL; + jmethodID testedMeth = nullptr; jclass objCls = jni->GetObjectClass(testedObj); for (i=0; iGetMethodID(objCls, meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2])) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (testedMeth = jni->GetMethodID(objCls, meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2])) != nullptr)) { NSK_COMPLAIN2("TEST FAILERE: unable to get method ID for \"%s\" \"%s\"\n\n", meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2]); res = STATUS_FAILED; @@ -148,7 +148,7 @@ Java_nsk_jvmti_GetMethodName_methname003_check( } } else - if (!NSK_JNI_VERIFY(jni, (testedMeth = jni->GetStaticMethodID(objCls, meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2])) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (testedMeth = jni->GetStaticMethodID(objCls, meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2])) != nullptr)) { NSK_COMPLAIN2("TEST FAILERE: unable to get method ID for \"%s\" \"%s\"\n\n", meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2]); res = STATUS_FAILED; @@ -184,7 +184,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectHashCode/objhashcode001/objhashcode001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectHashCode/objhashcode001/objhashcode001.cpp index da85ff4c539..2931d0b0319 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectHashCode/objhashcode001/objhashcode001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectHashCode/objhashcode001/objhashcode001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,16 +51,16 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jobject testedObject = NULL; + jobject testedObject = nullptr; jint objectHashCode = 0; NSK_DISPLAY0(">>> Obtain tested object from a static field of debugee class\n"); { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -68,7 +68,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -76,14 +76,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Get object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (testedObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1(" ... got object: %p\n", (void*)testedObject); NSK_DISPLAY1("Create global reference for object: %p\n", (void*)testedObject); - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -180,7 +180,7 @@ JNIEXPORT jint JNI_OnLoad_objhashcode001(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -190,11 +190,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage001/objmonusage001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage001/objmonusage001.cpp index de518c2240f..a02179847f6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage001/objmonusage001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage001/objmonusage001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -117,7 +117,7 @@ Java_nsk_jvmti_GetObjectMonitorUsage_objmonusage001_check(JNIEnv *env, } if (printdump == JNI_TRUE) { - if (inf.owner == NULL) { + if (inf.owner == nullptr) { printf(">>> [%2d] owner: none (0x0)\n", i); } else { jvmti->GetThreadInfo(inf.owner, &tinf); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage002/objmonusage002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage002/objmonusage002.cpp index dda31c173b1..2dd0eaa24f0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage002/objmonusage002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage002/objmonusage002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,7 +97,7 @@ Java_nsk_jvmti_GetObjectMonitorUsage_objmonusage002_check(JNIEnv *env, jvmtiError err; jvmtiMonitorUsage inf; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -105,7 +105,7 @@ Java_nsk_jvmti_GetObjectMonitorUsage_objmonusage002_check(JNIEnv *env, if (printdump == JNI_TRUE) { printf(">>> invalid object check ...\n"); } - err = jvmti->GetObjectMonitorUsage(NULL, &inf); + err = jvmti->GetObjectMonitorUsage(nullptr, &inf); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_monitor_info) { /* Ok, it's expected */ @@ -118,7 +118,7 @@ Java_nsk_jvmti_GetObjectMonitorUsage_objmonusage002_check(JNIEnv *env, if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetObjectMonitorUsage(obj, NULL); + err = jvmti->GetObjectMonitorUsage(obj, nullptr); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_monitor_info) { /* Ok, it's expected */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage003/objmonusage003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage003/objmonusage003.cpp index b9d8346c879..d696fa08c4f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage003/objmonusage003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage003/objmonusage003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -54,12 +54,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -116,7 +116,7 @@ Java_nsk_jvmti_GetObjectMonitorUsage_objmonusage003_check(JNIEnv *env, } if (printdump == JNI_TRUE) { - if (inf.owner == NULL) { + if (inf.owner == nullptr) { printf(">>> [%2d] owner: none (0x0)\n", count); } else { err = jvmti->GetThreadInfo(inf.owner, &tinf); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage004/objmonusage004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage004/objmonusage004.cpp index 34e340e1f65..47be3771376 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage004/objmonusage004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage004/objmonusage004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -54,12 +54,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -116,7 +116,7 @@ Java_nsk_jvmti_GetObjectMonitorUsage_objmonusage004_check(JNIEnv *env, } if (printdump == JNI_TRUE) { - if (inf.owner == NULL) { + if (inf.owner == nullptr) { printf(">>> [%2d] owner: none (0x0)\n", count); } else { err = jvmti->GetThreadInfo(inf.owner, &tinf); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage005/objmonusage005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage005/objmonusage005.cpp index 881607b4678..36aed3377ca 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage005/objmonusage005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage005/objmonusage005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage006/objmonusage006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage006/objmonusage006.cpp index 460abfd41c7..2be448e7342 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage006/objmonusage006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage006/objmonusage006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectSize/objsize001/objsize001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectSize/objsize001/objsize001.cpp index 10860792e17..87dfb9c40f7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectSize/objsize001/objsize001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectSize/objsize001/objsize001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,16 +48,16 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; { - jobject testedObject = NULL; + jobject testedObject = nullptr; jlong objectSize = 0; NSK_DISPLAY0(">>> Obtain tested object from a static field of debugee class\n"); { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -65,7 +65,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -73,14 +73,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Get object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (testedObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)testedObject); NSK_DISPLAY1("Create global reference for object: 0x%p\n", (void*)testedObject); - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -180,7 +180,7 @@ JNIEXPORT jint JNI_OnLoad_objsize001(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -188,10 +188,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectsWithTags/objwithtags001/objwithtags001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectsWithTags/objwithtags001/objwithtags001.cpp index d6ea8445774..c2f4d92e318 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectsWithTags/objwithtags001/objwithtags001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectsWithTags/objwithtags001/objwithtags001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,9 +56,9 @@ static int objectsCount = 0; /** Obtain tested objects from static field of debugee class. */ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int objectsCount, jobject* *objects, jlong* *tags) { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; - jobjectArray arrayObject = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; + jobjectArray arrayObject = nullptr; int size = tagsCount * objectsCount; NSK_DISPLAY2("Allocate memory for lists: %d objects for %d tags\n", @@ -78,7 +78,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int obj { int i, k; for (k = 0; k < size; k++) { - (*objects)[k] = NULL; + (*objects)[k] = nullptr; } for (i = 0; i < tagsCount; i++) { @@ -87,7 +87,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int obj } NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -95,7 +95,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int obj NSK_DISPLAY1("Find static field: %s\n", OBJECTS_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECTS_FIELD_NAME, OBJECTS_FIELD_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECTS_FIELD_NAME, OBJECTS_FIELD_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -103,7 +103,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int obj NSK_DISPLAY1("Get objects array from static field: %s\n", OBJECTS_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (arrayObject = (jobjectArray) - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -121,13 +121,13 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int obj NSK_DISPLAY1(" ... got array length: %d\n", (int)size); for (k = 0; k < size; k++) { - jobject object = NULL; + jobject object = nullptr; - if (!NSK_JNI_VERIFY(jni, (object = jni->GetObjectArrayElement(arrayObject, k)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (object = jni->GetObjectArrayElement(arrayObject, k)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } - if (!NSK_JNI_VERIFY(jni, (object = jni->NewGlobalRef(object)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (object = jni->NewGlobalRef(object)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -146,12 +146,12 @@ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int int size = tagsCount * objectsCount; int k; - if (objects == NULL) + if (objects == nullptr) return NSK_TRUE; NSK_DISPLAY1("Release objects references: %d objects\n", size); for (k = 0; k < size; k++) { - if (objects[k] != NULL) { + if (objects[k] != nullptr) { NSK_TRACE(jni->DeleteGlobalRef(objects[k])); } } @@ -163,7 +163,7 @@ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int nsk_jvmti_setFailStatus(); } - if (tags == NULL) + if (tags == nullptr) return NSK_FALSE; NSK_DISPLAY1("Deallocate tags list: 0x%p\n", (void*)tags); @@ -180,8 +180,8 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int o jlong tags[], jobject objects[], const char kind[], int expectedCount) { jint taggedObjectsCount = 0; - jobject* taggedObjectsList = NULL; - jlong* taggedObjectsTags = NULL; + jobject* taggedObjectsList = nullptr; + jlong* taggedObjectsTags = nullptr; jlong expectedTag = 0; int k; @@ -201,15 +201,15 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int o nsk_jvmti_setFailStatus(); } - if (taggedObjectsList == NULL && taggedObjectsCount > 0) { - NSK_COMPLAIN2("GetObjectsWithTags() returns NULL list of objects %s: 0x%p\n", + if (taggedObjectsList == nullptr && taggedObjectsCount > 0) { + NSK_COMPLAIN2("GetObjectsWithTags() returns null list of objects %s: 0x%p\n", kind, (void*)taggedObjectsList); nsk_jvmti_setFailStatus(); return NSK_TRUE; } - if (taggedObjectsTags == NULL && taggedObjectsCount > 0) { - NSK_COMPLAIN2("GetObjectsWithTags() returns NULL list of tags for objects %s: 0x%p\n", + if (taggedObjectsTags == nullptr && taggedObjectsCount > 0) { + NSK_COMPLAIN2("GetObjectsWithTags() returns null list of tags for objects %s: 0x%p\n", kind, (void*)taggedObjectsTags); nsk_jvmti_setFailStatus(); return NSK_TRUE; @@ -223,8 +223,8 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int o NSK_DISPLAY3(" #%d: object: 0x%p, tag: %ld\n", k, (void*)object, (long)tag); - if (object == NULL) { - NSK_COMPLAIN3("GetObjectsWithTags() returns NULL for object #%d %s: 0x%p\n", + if (object == nullptr) { + NSK_COMPLAIN3("GetObjectsWithTags() returns null for object #%d %s: 0x%p\n", k, kind, (void*)object); nsk_jvmti_setFailStatus(); continue; @@ -306,8 +306,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { int size = tagsCount * objectsCount; - jobject* objects = NULL; - jlong* tags = NULL; + jobject* objects = nullptr; + jlong* tags = nullptr; NSK_DISPLAY0(">>> Obtain tested objects list from a static field of debugee class\n"); { @@ -417,7 +417,7 @@ JNIEXPORT jint JNI_OnLoad_objwithtags001(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -433,7 +433,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add required capabilities */ @@ -448,7 +448,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf001/ownmoninf001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf001/ownmoninf001.cpp index 3d304530135..e86bf820b34 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf001/ownmoninf001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf001/ownmoninf001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -89,7 +89,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jobject *getInfo(JNIEnv *env, jint point, jthread thr, int count) { jvmtiError err; jint owned_monitor_count; - jobject *owned_monitors = NULL; + jobject *owned_monitors = nullptr; err = jvmti->GetOwnedMonitorInfo(thr, &owned_monitor_count, &owned_monitors); @@ -100,13 +100,13 @@ jobject *getInfo(JNIEnv *env, jint point, jthread thr, int count) { printf("(GetOwnedMonitorInfo#%d) unexpected error: %s (%d)\n", point, TranslateError(err), err); result = STATUS_FAILED; - return NULL; + return nullptr; } else { if (owned_monitor_count != count) { result = STATUS_FAILED; printf("Point %d: number of owned monitors expected: %d, got: %d\n", point, count, owned_monitor_count); - return NULL; + return nullptr; } } return owned_monitors; @@ -123,7 +123,7 @@ Java_nsk_jvmti_GetOwnedMonitorInfo_ownmoninf001_checkMon1(JNIEnv *env, jclass cls, jint point, jthread thr, jobject lock) { jobject *monitors; monitors = getInfo(env, point, thr, 1); - if (monitors == NULL) { + if (monitors == nullptr) { return; } if (!env->IsSameObject(lock, monitors[0])) { @@ -137,7 +137,7 @@ Java_nsk_jvmti_GetOwnedMonitorInfo_ownmoninf001_checkMon2(JNIEnv *env, jclass cls, jint point, jthread thr, jobject lock1, jobject lock2) { jobject *monitors; monitors = getInfo(env, point, thr, 2); - if (monitors == NULL) { + if (monitors == nullptr) { return; } if (!env->IsSameObject(lock1, monitors[0]) && !env->IsSameObject(lock2, monitors[0])) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf002/ownmoninf002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf002/ownmoninf002.cpp index 7ad4e1b0ef3..f5c13cfe71d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf002/ownmoninf002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf002/ownmoninf002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf003/ownmoninf003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf003/ownmoninf003.cpp index 83b39f17aaa..975be49082b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf003/ownmoninf003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf003/ownmoninf003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -98,7 +98,7 @@ Java_nsk_jvmti_GetOwnedMonitorInfo_ownmoninf003_check(JNIEnv *env, jint owned_monitor_count; jobject *owned_monitors; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -120,7 +120,7 @@ Java_nsk_jvmti_GetOwnedMonitorInfo_ownmoninf003_check(JNIEnv *env, if (printdump == JNI_TRUE) { printf(">>> (owned_monitor_count_ptr) null pointer check ...\n"); } - err = jvmti->GetOwnedMonitorInfo(thr, NULL, &owned_monitors); + err = jvmti->GetOwnedMonitorInfo(thr, nullptr, &owned_monitors); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_monitor_info) { /* Ok, it's expected */ @@ -133,7 +133,7 @@ Java_nsk_jvmti_GetOwnedMonitorInfo_ownmoninf003_check(JNIEnv *env, if (printdump == JNI_TRUE) { printf(">>> (owned_monitors_ptr) null pointer check ...\n"); } - err = jvmti->GetOwnedMonitorInfo(thr, &owned_monitor_count, NULL); + err = jvmti->GetOwnedMonitorInfo(thr, &owned_monitor_count, nullptr); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_monitor_info) { /* Ok, it's expected */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase001/getphase001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase001/getphase001.cpp index e3c4df42cba..70228ae0274 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase001/getphase001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase001/getphase001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -268,7 +268,7 @@ JNIEXPORT jint JNI_OnLoad_getphase001(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; jvmtiPhase phase; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -284,7 +284,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* Create data access lock */ @@ -319,31 +319,31 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* enable VMStart event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr))) return JNI_ERR; /* enable VMInit event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; /* enable NativeMethodBind event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr))) return JNI_ERR; /* enable ClassFileLoadHook event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; /* enable VMDeath event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase002/getphase002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase002/getphase002.cpp index e1d03830f70..ec67d08a9f6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase002/getphase002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase002/getphase002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,9 +45,9 @@ agentProc(jvmtiEnv *jvmti, JNIEnv* jni, void* arg) { if (!nsk_jvmti_waitForSync(timeout)) return; - NSK_DISPLAY0("Check if GetPhase(NULL) returns JVMTI_ERROR_NULL_POINTER\n"); + NSK_DISPLAY0("Check if GetPhase(null) returns JVMTI_ERROR_NULL_POINTER\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_NULL_POINTER, - jvmti->GetPhase(NULL))) + jvmti->GetPhase(nullptr))) nsk_jvmti_setFailStatus(); /* resume debugee after last sync */ @@ -70,7 +70,7 @@ JNIEXPORT jint JNI_OnLoad_getphase002(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -83,11 +83,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPotentialCapabilities/getpotcaps001/getpotcaps001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPotentialCapabilities/getpotcaps001/getpotcaps001.cpp index 0e5d7159d27..f69b88176f1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPotentialCapabilities/getpotcaps001/getpotcaps001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPotentialCapabilities/getpotcaps001/getpotcaps001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -188,7 +188,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkCapabilities(jvmti, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -215,7 +215,7 @@ JNIEXPORT jint JNI_OnLoad_getpotcaps001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -223,7 +223,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -239,7 +239,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check capabilities in Agent_OnLoad()\n"); @@ -248,7 +248,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex001/srcdebugex001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex001/srcdebugex001.cpp index 66e4dbdceeb..ab1125b0037 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex001/srcdebugex001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex001/srcdebugex001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -90,7 +90,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetSourceDebugExtension_srcdebugex001_getSrcDebugX(JNIEnv *env, jclass cls, jboolean vrb) { jvmtiError err; - char *srcDebugX = NULL; + char *srcDebugX = nullptr; if (!caps.can_get_source_debug_extension) return result; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex002/srcdebugex002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex002/srcdebugex002.cpp index b05b1b38225..420f38f84c6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex002/srcdebugex002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex002/srcdebugex002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -90,18 +90,18 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetSourceDebugExtension_srcdebugex002_getSrcDebugX(JNIEnv *env, jclass cls, jint t_case) { jvmtiError err; - char *srcDebugX = NULL; + char *srcDebugX = nullptr; jobject invalCls; /* used as invalid class */ if (!caps.can_get_source_debug_extension) return result; switch (t_case) { - case 1: /* NULL pointer in test debug mode */ - printf("\nInvoke GetSourceDebugExtension() with NULL pointer...\n"); + case 1: /* nullptr pointer in test debug mode */ + printf("\nInvoke GetSourceDebugExtension() with null pointer...\n"); fflush(stdout); // fallthrough - case 0: /* NULL pointer */ - err = jvmti->GetSourceDebugExtension(cls, NULL); + case 0: /* nullptr pointer */ + err = jvmti->GetSourceDebugExtension(cls, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("TEST FAILED: the function GetSourceDebugExtension() returned the error %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex003/srcdebugex003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex003/srcdebugex003.cpp index e4759cf49df..37fc8742807 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex003/srcdebugex003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex003/srcdebugex003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,7 +55,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -92,7 +92,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetSourceDebugExtension_srcdebugex003_getSrcDebugX(JNIEnv *env, jclass cls, jboolean vrb) { jvmtiError err; - char *srcDebugX = NULL; + char *srcDebugX = nullptr; if (!caps.can_get_source_debug_extension) return result; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn004/getsrcfn004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn004/getsrcfn004.cpp index 18d96711181..e9a2aff2a52 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn004/getsrcfn004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn004/getsrcfn004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jvmtiCapabilities caps; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint code; jvmtiError res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } code = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (code != JNI_OK || jvmti == NULL) { + if (code != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ Java_nsk_jvmti_GetSourceFileName_getsrcfn004_check(JNIEnv *env, jclass cls) { jvmtiError err; char *name; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -104,7 +104,7 @@ Java_nsk_jvmti_GetSourceFileName_getsrcfn004_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetSourceFileName(NULL, &name); + err = jvmti->GetSourceFileName(nullptr, &name); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && caps.can_get_source_file_name) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -118,7 +118,7 @@ Java_nsk_jvmti_GetSourceFileName_getsrcfn004_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetSourceFileName(cls, NULL); + err = jvmti->GetSourceFileName(cls, nullptr); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && caps.can_get_source_file_name) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn005/getsrcfn005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn005/getsrcfn005.cpp index 63676521f85..16bf11e65f1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn005/getsrcfn005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn005/getsrcfn005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jvmtiCapabilities caps; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError res; jint code; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } code = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (code != JNI_OK || jvmti == NULL) { + if (code != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ Java_nsk_jvmti_GetSourceFileName_getsrcfn005_check(JNIEnv *env, jclass cls, jint jvmtiError err; char *name; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn006/getsrcfn006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn006/getsrcfn006.cpp index 9edb42aa836..390c9c1e124 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn006/getsrcfn006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn006/getsrcfn006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jvmtiCapabilities caps; @@ -59,12 +59,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError res; jint code; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } code = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (code != JNI_OK || jvmti == NULL) { + if (code != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -102,7 +102,7 @@ Java_nsk_jvmti_GetSourceFileName_getsrcfn006_check(JNIEnv *env, jclass cls, jint jvmtiError err; char *name; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops001/getsysprops001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops001/getsysprops001.cpp index ec770b75655..13a391227cb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops001/getsysprops001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops001/getsysprops001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ static jlong timeout = 0; static int checkProperties(jvmtiEnv* jvmti, const char phase[]) { int success = NSK_TRUE; jint count = 0; - char** properties = NULL; + char** properties = nullptr; NSK_DISPLAY0("Invoke GetSystemProperties()\n"); if (!NSK_JVMTI_VERIFY( @@ -56,8 +56,8 @@ static int checkProperties(jvmtiEnv* jvmti, const char phase[]) { success = NSK_FALSE; } - if (properties == NULL) { - NSK_COMPLAIN2("In %s phase GetSystemProperties() returned NULL pointer for properties list: 0x%p\n", + if (properties == nullptr) { + NSK_COMPLAIN2("In %s phase GetSystemProperties() returned null pointer for properties list: 0x%p\n", phase, (void*)properties); success = NSK_FALSE; } else { @@ -66,8 +66,8 @@ static int checkProperties(jvmtiEnv* jvmti, const char phase[]) { NSK_DISPLAY1("Check each property: %d properties\n", (int)count); for (i = 0; i < count; i++) { NSK_DISPLAY2(" property #%d: [%s]\n", i, nsk_null_string(properties[i])); - if (properties[i] == NULL) { - NSK_COMPLAIN3("In %s phase GetSystemProperties() returned NULL for property #%d: 0x%p\n", + if (properties[i] == nullptr) { + NSK_COMPLAIN3("In %s phase GetSystemProperties() returned null for property #%d: 0x%p\n", phase, i, (void*)properties[i]); success = NSK_FALSE; } @@ -118,7 +118,7 @@ JNIEXPORT jint JNI_OnLoad_getsysprops001(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -126,7 +126,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Check system properties in OnLoad phase\n"); @@ -134,7 +134,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { nsk_jvmti_setFailStatus(); } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops002/getsysprops002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops002/getsysprops002.cpp index a48128e2bc6..81bd1819948 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops002/getsysprops002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops002/getsysprops002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,7 @@ static PropertyDesc propDescList[PROPERTIES_COUNT] = { static int checkProperties (jvmtiEnv* jvmti, const char phase[]) { int success = NSK_TRUE; jint count = 0; - char** properties = NULL; + char** properties = nullptr; NSK_DISPLAY0("Get system properties list\n"); if (!NSK_JVMTI_VERIFY( @@ -61,7 +61,7 @@ static int checkProperties (jvmtiEnv* jvmti, const char phase[]) { } NSK_DISPLAY1(" ... got properties: %d\n", (int)count); - if (!NSK_VERIFY(properties != NULL)) { + if (!NSK_VERIFY(properties != nullptr)) { return NSK_FALSE; } @@ -77,7 +77,7 @@ static int checkProperties (jvmtiEnv* jvmti, const char phase[]) { for (i = 0; i < count; i++) { NSK_DISPLAY2(" property #%d: [%s]\n", i, nsk_null_string(properties[i])); - if (properties[i] != NULL) { + if (properties[i] != nullptr) { for (j = 0; j < PROPERTIES_COUNT; j++) { if (strcmp(properties[i], propDescList[j].name) == 0) { NSK_DISPLAY1("SUCCESS: found tested property: %s\n", @@ -150,7 +150,7 @@ JNIEXPORT jint JNI_OnLoad_getsysprops002(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -158,7 +158,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Check system properties in OnLoad phase\n"); @@ -166,7 +166,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { nsk_jvmti_setFailStatus(); } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop001/getsysprop001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop001/getsysprop001.cpp index 126712c66f8..0540d756238 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop001/getsysprop001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop001/getsysprop001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ static jlong timeout = 0; static int checkProperties(jvmtiEnv* jvmti, const char phase[]) { int success = NSK_TRUE; jint count = 0; - char** properties = NULL; + char** properties = nullptr; NSK_DISPLAY0("Get system properties names\n"); if (!NSK_JVMTI_VERIFY( @@ -47,7 +47,7 @@ static int checkProperties(jvmtiEnv* jvmti, const char phase[]) { } NSK_DISPLAY1(" ... got properties: %d\n", (int)count); - if (!NSK_VERIFY(properties != NULL)) { + if (!NSK_VERIFY(properties != nullptr)) { return NSK_FALSE; } @@ -56,10 +56,10 @@ static int checkProperties(jvmtiEnv* jvmti, const char phase[]) { int i; for (i = 0; i < count; i++) { - char* value = NULL; + char* value = nullptr; NSK_DISPLAY2(" property #%d: [%s]:\n", i, nsk_null_string(properties[i])); - if (!NSK_VERIFY(properties[i] != NULL)) { + if (!NSK_VERIFY(properties[i] != nullptr)) { success = NSK_FALSE; continue; } @@ -71,8 +71,8 @@ static int checkProperties(jvmtiEnv* jvmti, const char phase[]) { } NSK_DISPLAY1(" value: \"%s\"\n", nsk_null_string(value)); - if (value == NULL) { - NSK_COMPLAIN4("In %s phase GetSystemProperty() returned NULL for property #%d:\n" + if (value == nullptr) { + NSK_COMPLAIN4("In %s phase GetSystemProperty() returned null for property #%d:\n" "# property name: %s\n" "# got value: 0x%p\n", phase, i, @@ -131,7 +131,7 @@ JNIEXPORT jint JNI_OnLoad_getsysprop001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -139,7 +139,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Check system properties in OnLoad phase\n"); @@ -147,7 +147,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { nsk_jvmti_setFailStatus(); } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop002/getsysprop002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop002/getsysprop002.cpp index a9704eed75b..38687ba8e9a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop002/getsysprop002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop002/getsysprop002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,7 +49,7 @@ static PropertyDesc propDescList[PROPERTIES_COUNT] = { static int checkProperty(jvmtiEnv* jvmti, const char phase[], PropertyDesc* desc) { int success = NSK_TRUE; - char* value = NULL; + char* value = nullptr; NSK_DISPLAY1("Get value of tested property: %s\n", desc->name); if (!NSK_JVMTI_VERIFY( @@ -58,8 +58,8 @@ static int checkProperty(jvmtiEnv* jvmti, const char phase[], PropertyDesc* desc } NSK_DISPLAY1(" ... got value: \"%s\"\n", nsk_null_string(value)); - if (value == NULL) { - NSK_COMPLAIN4("In %s phase GetSystemProperty() returned NULL value for property:\n" + if (value == nullptr) { + NSK_COMPLAIN4("In %s phase GetSystemProperty() returned null value for property:\n" "# defined as: -D%s=\"%s\"\n" "# got value: 0x%p\n", phase, desc->name, desc->value, (void*)value); @@ -130,7 +130,7 @@ JNIEXPORT jint JNI_OnLoad_getsysprop002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -138,7 +138,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Check defined system properties in OnLoad phase\n"); @@ -146,7 +146,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { nsk_jvmti_setFailStatus(); } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTag/gettag001/gettag001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTag/gettag001/gettag001.cpp index 801d210de35..926ef71ddab 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTag/gettag001/gettag001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTag/gettag001/gettag001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,17 +51,17 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jobject testedObject = NULL; + jobject testedObject = nullptr; jlong objectTag = 0; NSK_DISPLAY0(">>> Obtain tested object from a static field of debugee class\n"); { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -69,7 +69,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -77,7 +77,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Get object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (testedObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -85,7 +85,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Create global reference for object: 0x%p\n", (void*)testedObject); if (!NSK_JNI_VERIFY(jni, (testedObject = - jni->NewGlobalRef(testedObject)) != NULL)) { + jni->NewGlobalRef(testedObject)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -142,7 +142,7 @@ JNIEXPORT jint JNI_OnLoad_gettag001(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -152,7 +152,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add required capabilities */ @@ -168,7 +168,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime001/thrcputime001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime001/thrcputime001.cpp index 4effa902072..127ae04a0f9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime001/thrcputime001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime001/thrcputime001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -69,9 +69,9 @@ static int checkCpuTime(jvmtiEnv* jvmti, jthread thread, julong* time, char buf[64], buf2[64], buf3[64]; int success = NSK_TRUE; - NSK_DISPLAY1("GetThreadCpuTime() for current thread (passing NULL): 0x%p\n", (void*)thread); + NSK_DISPLAY1("GetThreadCpuTime() for current thread (passing null): 0x%p\n", (void*)thread); if (!NSK_JVMTI_VERIFY( - jvmti->GetThreadCpuTime(NULL, (jlong *)time))) { + jvmti->GetThreadCpuTime(nullptr, (jlong *)time))) { return NSK_FALSE; } NSK_DISPLAY1(" ... got cpu time: %s\n", julong_to_string(*time, buf)); @@ -81,7 +81,7 @@ static int checkCpuTime(jvmtiEnv* jvmti, jthread thread, julong* time, where, julong_to_string(*time, buf)); } - if (prevTime != NULL) { + if (prevTime != nullptr) { julong diff = *time - *prevTime; NSK_DISPLAY1("Compare with previous time: %s\n", @@ -148,7 +148,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Testcase #2: Check initial cpu time in agent thread\n"); { - if (!checkCpuTime(jvmti, testAgentThread, &prevAgentThreadTime, NULL, "agent thread")) { + if (!checkCpuTime(jvmti, testAgentThread, &prevAgentThreadTime, nullptr, "agent thread")) { nsk_jvmti_setFailStatus(); } } @@ -158,7 +158,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { runIterations(iterations); NSK_DISPLAY1("Enable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } @@ -185,7 +185,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... disabled\n"); } } @@ -215,7 +215,7 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY0(">>> Testcase #1: Check initial cpu time in VM_INIT callback\n"); { julong time = 0; - if (!checkCpuTime(jvmti, thread, &time, NULL, "VM_INIT callback")) { + if (!checkCpuTime(jvmti, thread, &time, nullptr, "VM_INIT callback")) { nsk_jvmti_setFailStatus(); } } @@ -231,14 +231,14 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY0(">>> Testcase #7: Check initial cpu time in VM_DEATH callback\n"); { julong time = 0; - if (!checkCpuTime(jvmti, NULL, &time, NULL, "VM_DEATH callback")) { + if (!checkCpuTime(jvmti, nullptr, &time, nullptr, "VM_DEATH callback")) { success = NSK_FALSE; nsk_jvmti_setFailStatus(); } } NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -268,9 +268,9 @@ callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY1(" for thread: %s\n", nsk_null_string(threadInfo.name)); } - if (threadInfo.name != NULL && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { + if (threadInfo.name != nullptr && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { NSK_DISPLAY0(">>> Testcase #3: Check initial cpu time in THREAD_START callback\n"); - if (!checkCpuTime(jvmti, thread, &prevTestedThreadTime, NULL, "THREAD_START callback")) { + if (!checkCpuTime(jvmti, thread, &prevTestedThreadTime, nullptr, "THREAD_START callback")) { nsk_jvmti_setFailStatus(); } } @@ -292,7 +292,7 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY1(" for thread: %s\n", nsk_null_string(threadInfo.name)); } - if (threadInfo.name != NULL && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { + if (threadInfo.name != nullptr && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { julong time = 0; NSK_DISPLAY0(">>> Testcase #5: Check final cpu time in THREAD_END callback\n"); if (!checkCpuTime(jvmti, thread, &time, &prevTestedThreadTime, "THREAD_END callback")) { @@ -316,7 +316,7 @@ JNIEXPORT jint JNI_OnLoad_thrcputime001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -328,7 +328,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_get_thread_cpu_time"); @@ -360,11 +360,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY0(" ... callbacks set\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime002/thrcputime002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime002/thrcputime002.cpp index 2782c060621..e69f2de6286 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime002/thrcputime002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime002/thrcputime002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,8 +55,8 @@ static jvmtiEvent threadEvents[THREAD_EVENTS_COUNT] = { static julong prevTestedThreadTime = 0; static julong prevAgentThreadTime = 0; -static jthread testedThread = NULL; -static jthread testAgentThread = NULL; +static jthread testedThread = nullptr; +static jthread testAgentThread = nullptr; static int iterations = 0; @@ -83,7 +83,7 @@ static int checkCpuTime(jvmtiEnv* jvmti, jthread thread, julong* time, where, julong_to_string(*time, buf)); } - if (prevTime != NULL) { + if (prevTime != nullptr) { julong diff = *time - *prevTime; NSK_DISPLAY1("Compare with previous time: %s\n", @@ -150,7 +150,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Testcase #2: Check initial cpu time in agent thread\n"); { - if (!checkCpuTime(jvmti, testAgentThread, &prevAgentThreadTime, NULL, "agent thread")) { + if (!checkCpuTime(jvmti, testAgentThread, &prevAgentThreadTime, nullptr, "agent thread")) { nsk_jvmti_setFailStatus(); } } @@ -160,7 +160,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { runIterations(iterations); NSK_DISPLAY1("Enable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } @@ -180,7 +180,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } } - if (testedThread != NULL) { + if (testedThread != nullptr) { NSK_DISPLAY0(">>> Testcase #6: Check tested thread cpu time from agent thread\n"); { julong time = 0; @@ -198,7 +198,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... disabled\n"); } } @@ -228,7 +228,7 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY0(">>> Testcase #1: Check initial cpu time in VM_INIT callback\n"); { julong time = 0; - if (!checkCpuTime(jvmti, thread, &time, NULL, "VM_INIT callback")) { + if (!checkCpuTime(jvmti, thread, &time, nullptr, "VM_INIT callback")) { nsk_jvmti_setFailStatus(); } } @@ -242,7 +242,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { int success = NSK_TRUE; NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -279,13 +279,13 @@ callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { } } - if (threadInfo.name != NULL && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { - if (!NSK_JNI_VERIFY(jni, (testedThread = jni->NewGlobalRef(thread)) != NULL)) { + if (threadInfo.name != nullptr && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { + if (!NSK_JNI_VERIFY(jni, (testedThread = jni->NewGlobalRef(thread)) != nullptr)) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0(">>> Testcase #4: Check initial cpu time in THREAD_START callback\n"); - if (!checkCpuTime(jvmti, thread, &prevTestedThreadTime, NULL, "THREAD_START callback")) { + if (!checkCpuTime(jvmti, thread, &prevTestedThreadTime, nullptr, "THREAD_START callback")) { nsk_jvmti_setFailStatus(); } } @@ -314,14 +314,14 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { } } - if (threadInfo.name != NULL && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { + if (threadInfo.name != nullptr && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { julong time = 0; NSK_DISPLAY0(">>> Testcase #8: Check final cpu time in THREAD_END callback\n"); if (!checkCpuTime(jvmti, thread, &time, &prevTestedThreadTime, "THREAD_END callback")) { nsk_jvmti_setFailStatus(); } NSK_TRACE(jni->DeleteGlobalRef(testedThread)); - testedThread = NULL; + testedThread = nullptr; } } @@ -340,7 +340,7 @@ JNIEXPORT jint JNI_OnLoad_thrcputime002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -352,7 +352,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_get_thread_cpu_time"); @@ -382,11 +382,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY0(" ... callbacks set\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTimerInfo/thrtimerinfo001/thrtimerinfo001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTimerInfo/thrtimerinfo001/thrtimerinfo001.cpp index 81bfb416b58..5d7ee5fb8a5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTimerInfo/thrtimerinfo001/thrtimerinfo001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTimerInfo/thrtimerinfo001/thrtimerinfo001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -76,7 +76,7 @@ static int checkTimerInfo(jvmtiEnv* jvmti, jvmtiTimerInfo* info, NSK_DISPLAY1(" may_skip_forward: %d\n", (int)info->may_skip_forward); NSK_DISPLAY1(" may_skip_backward: %d\n", (int)info->may_skip_backward); - if (initInfo != NULL) { + if (initInfo != nullptr) { NSK_DISPLAY0("Compare with initial timer info\n"); if (info->max_value != initInfo->max_value) { NSK_COMPLAIN4("In %s GetThreadCpuTimerInfo() returned different info:\n" @@ -132,7 +132,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Testcases #3,4: Check timer info in thread events\n"); { NSK_DISPLAY1("Enable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } @@ -143,7 +143,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... disabled\n"); } } @@ -163,7 +163,7 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY0(">>> Testcase #1: Check initial timer info in VM_INIT callback\n"); { - if (!checkTimerInfo(jvmti, &initInfo, NULL, "VM_INIT callback")) { + if (!checkTimerInfo(jvmti, &initInfo, nullptr, "VM_INIT callback")) { nsk_jvmti_setFailStatus(); } } @@ -183,7 +183,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { } NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -242,7 +242,7 @@ JNIEXPORT jint JNI_OnLoad_thrtimerinfo001(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -250,7 +250,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_get_thread_cpu_time"); @@ -282,11 +282,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY0(" ... callbacks set\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupChildren/getthrdgrpchld001/getthrdgrpchld001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupChildren/getthrdgrpchld001/getthrdgrpchld001.cpp index 4c04b046d70..e81cf933140 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupChildren/getthrdgrpchld001/getthrdgrpchld001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupChildren/getthrdgrpchld001/getthrdgrpchld001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constant names */ @@ -69,15 +69,15 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthreadGroup rootGroup = NULL; - jthreadGroup runningGroup = NULL; - jthreadGroup notStartedGroup = NULL; - jthreadGroup finishedGroup = NULL; + jthreadGroup rootGroup = nullptr; + jthreadGroup runningGroup = nullptr; + jthreadGroup notStartedGroup = nullptr; + jthreadGroup finishedGroup = nullptr; /* find root thread group */ { jint topGroupsCount = 0; - jthreadGroup* topGroups = NULL; + jthreadGroup* topGroups = nullptr; NSK_DISPLAY0("Get top level thread groups\n"); if (!NSK_JVMTI_VERIFY( @@ -87,13 +87,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY1(" ... got groups: %d\n", (int)topGroupsCount); - if (!NSK_VERIFY(topGroupsCount > 0 && topGroups != NULL)) + if (!NSK_VERIFY(topGroupsCount > 0 && topGroups != nullptr)) return; NSK_DISPLAY1("Find thread group by name: %s\n", ROOT_GROUP_NAME); if (!NSK_VERIFY((rootGroup = findThreadGroupByName(jvmti, jni, ROOT_GROUP_NAME, - topGroupsCount, topGroups)) != NULL)) { + topGroupsCount, topGroups)) != nullptr)) { NSK_COMPLAIN1("No tested root thread group found: %s\n", ROOT_GROUP_NAME); nsk_jvmti_setFailStatus(); return; @@ -105,8 +105,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { jint groupsCount = 0; jint threadsCount = 0; - jthread* threads = NULL; - jthreadGroup* groups = NULL; + jthread* threads = nullptr; + jthreadGroup* groups = nullptr; NSK_DISPLAY1("Get children of root thread group: %p\n", (void*)rootGroup); if (!NSK_JVMTI_VERIFY( @@ -150,7 +150,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (strcmp(info.name, RUNNING_GROUP_NAME) == 0) { NSK_DISPLAY2(" ... found runningThreadGroup: %p (%s)\n", groups[i], info.name); - if (runningGroup != NULL) { + if (runningGroup != nullptr) { NSK_COMPLAIN6("Duplicated runningThreadGroup in rootThreadGroup:\n" "# parent group: %p (%s)\n" "# existing group: %p (%s)\n" @@ -168,7 +168,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (strcmp(info.name, NOT_STARTED_GROUP_NAME) == 0) { NSK_DISPLAY2(" ... found notStartedThreadGroup: %p (%s)\n", groups[i], info.name); - if (notStartedGroup != NULL) { + if (notStartedGroup != nullptr) { NSK_COMPLAIN6("Duplicated notStartedThreadGroup in rootThreadGroup:\n" "# parent group: %p (%s)\n" "# existing group: %p (%s)\n" @@ -186,7 +186,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (strcmp(info.name, FINISHED_GROUP_NAME) == 0) { NSK_DISPLAY2(" ... found finishedThreadGroup: %p (%s)\n", groups[i], info.name); - if (finishedGroup != NULL) { + if (finishedGroup != nullptr) { NSK_COMPLAIN6("Duplicated finishedThreadGroup in rootThreadGroup:\n" "# parent group: %p (%s)\n" "# existing group: %p (%s)\n" @@ -243,7 +243,7 @@ static int checkThreadGroup(jvmtiEnv* jvmti, JNIEnv* jni, jint expectedThreadsCount, const char expectedThreadName[]) { size_t threadNameLen = strlen(expectedThreadName); - if (group == NULL) { + if (group == nullptr) { NSK_COMPLAIN1("No expected group found in rootThreadGroup: %s\n", groupName); nsk_jvmti_setFailStatus(); return NSK_FALSE; @@ -253,8 +253,8 @@ static int checkThreadGroup(jvmtiEnv* jvmti, JNIEnv* jni, { jint threadsCount = 0; jint groupsCount = 0; - jthread* threads = NULL; - jthreadGroup* groups = NULL; + jthread* threads = nullptr; + jthreadGroup* groups = nullptr; if (!NSK_JVMTI_VERIFY( jvmti->GetThreadGroupChildren(group, &threadsCount, &threads, &groupsCount, &groups))) { @@ -296,7 +296,7 @@ static int checkThreadGroup(jvmtiEnv* jvmti, JNIEnv* jni, NSK_DISPLAY2(" ... found thread: %p (%s)\n", (void*)threads[i], nsk_null_string(info.name)); - if (info.name == NULL || + if (info.name == nullptr || strncmp(info.name, expectedThreadName, threadNameLen) != 0) { NSK_COMPLAIN5("Found unexpected thread in thread group:\n" "# thread group: %p (%s)\n" @@ -327,31 +327,31 @@ static int checkThreadGroup(jvmtiEnv* jvmti, JNIEnv* jni, /** Recursively find thread group by its name among given groups and their childrens. */ static jthreadGroup findThreadGroupByName(jvmtiEnv* jvmti, JNIEnv* jni, const char name[], jint count, jthreadGroup groupsList[]) { - jthreadGroup foundGroup = NULL; + jthreadGroup foundGroup = nullptr; int i; - for (i = 0; i < count && foundGroup == NULL; i++) { + for (i = 0; i < count && foundGroup == nullptr; i++) { jint threadsCount = 0; jint groupsCount = 0; - jthread* threads = NULL; - jthreadGroup * groups = NULL; + jthread* threads = nullptr; + jthreadGroup * groups = nullptr; if (!NSK_JVMTI_VERIFY( jvmti->GetThreadGroupChildren(groupsList[i], &threadsCount, &threads, &groupsCount, &groups))) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } if (groupsCount > 0) { int j; - if (!NSK_VERIFY(groups != NULL)) - return NULL; + if (!NSK_VERIFY(groups != nullptr)) + return nullptr; for (j = 0; j < groupsCount; j++) { jvmtiThreadGroupInfo info; - if (groups[j] != NULL) { + if (groups[j] != nullptr) { if (!NSK_JVMTI_VERIFY( jvmti->GetThreadGroupInfo(groups[j], &info))) { @@ -366,7 +366,7 @@ static jthreadGroup findThreadGroupByName(jvmtiEnv* jvmti, JNIEnv* jni, const ch } } - if (foundGroup == NULL) { + if (foundGroup == nullptr) { foundGroup = findThreadGroupByName(jvmti, jni, name, groupsCount, groups); } } @@ -400,7 +400,7 @@ JNIEXPORT jint JNI_OnLoad_getthrdgrpchld001(JavaVM *jvm, char *options, void *re } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -415,11 +415,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo001/thrgrpinfo001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo001/thrgrpinfo001.cpp index 92134d1e0ff..1d8bf4c02d2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo001/thrgrpinfo001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo001/thrgrpinfo001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jint stage = 0; @@ -53,12 +53,12 @@ JNIEXPORT jint JNI_OnLoad_thrgrpinfo001(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -72,7 +72,7 @@ Java_nsk_jvmti_GetThreadGroupInfo_thrgrpinfo001_check(JNIEnv *env, jclass cls, j jvmtiError err; jvmtiThreadGroupInfo inf; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -97,7 +97,7 @@ Java_nsk_jvmti_GetThreadGroupInfo_thrgrpinfo001_check(JNIEnv *env, jclass cls, j (inf.is_daemon == JNI_TRUE) ? "true" : "false"); } - if (inf.name == NULL || strcmp(inf.name, expName) != 0) { + if (inf.name == nullptr || strcmp(inf.name, expName) != 0) { printf("(%d) unexpected name: \"%s\",", stage, inf.name); printf(" expected: \"%s\"\n", expName); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo002/thrgrpinfo002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo002/thrgrpinfo002.cpp index 0a57ad0ea8f..02a4161f64e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo002/thrgrpinfo002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo002/thrgrpinfo002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_thrgrpinfo002(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -71,7 +71,7 @@ Java_nsk_jvmti_GetThreadGroupInfo_thrgrpinfo002_check(JNIEnv *env, jclass cls) { jthreadGroup *groups; jvmtiThreadGroupInfo inf; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -89,7 +89,7 @@ Java_nsk_jvmti_GetThreadGroupInfo_thrgrpinfo002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid group check ...\n"); } - err = jvmti->GetThreadGroupInfo(NULL, &inf); + err = jvmti->GetThreadGroupInfo(nullptr, &inf); if (err != JVMTI_ERROR_INVALID_THREAD_GROUP) { printf("Error expected: JVMTI_ERROR_INVALID_THREAD_GROUP,\n"); printf(" got: %s (%d)\n", TranslateError(err), err); @@ -99,7 +99,7 @@ Java_nsk_jvmti_GetThreadGroupInfo_thrgrpinfo002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetThreadGroupInfo(*groups, NULL); + err = jvmti->GetThreadGroupInfo(*groups, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf(" got: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadLocalStorage/getthrdstor001/getthrdstor001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadLocalStorage/getthrdstor001/getthrdstor001.cpp index a37007735d0..aa962164c15 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadLocalStorage/getthrdstor001/getthrdstor001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadLocalStorage/getthrdstor001/getthrdstor001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,12 +48,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthread testedThread = NULL; - void* storage = NULL; + jthread testedThread = nullptr; + void* storage = nullptr; NSK_DISPLAY1("Find thread: %s\n", THREAD_NAME); if (!NSK_VERIFY((testedThread = - nsk_jvmti_threadByName(THREAD_NAME)) != NULL)) + nsk_jvmti_threadByName(THREAD_NAME)) != nullptr)) return; NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread); @@ -65,9 +65,9 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY1(" ... got storage: %p\n", (void*)storage); - NSK_DISPLAY0("Check obtained storage pointer against NULL\n"); - if (storage != NULL) { - NSK_COMPLAIN2("GetThreadLocalStorage() returned NOT NULL storage for tested thread:\n" + NSK_DISPLAY0("Check obtained storage pointer against null\n"); + if (storage != nullptr) { + NSK_COMPLAIN2("GetThreadLocalStorage() returned NOT null storage for tested thread:\n" "# thread: %p\n" "# storage: %p\n", (void*)testedThread, (void*)storage); @@ -76,15 +76,15 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("GetThreadLocalStorage() for current agent thread\n"); if (!NSK_JVMTI_VERIFY( - jvmti->GetThreadLocalStorage(NULL, &storage))) { + jvmti->GetThreadLocalStorage(nullptr, &storage))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1(" ... got storage: %p\n", (void*)storage); - NSK_DISPLAY0("Check obtained storage pointer against NULL\n"); - if (storage != NULL) { - NSK_COMPLAIN1("GetThreadLocalStorage() returned NOT NULL storage for current agent thread:\n" + NSK_DISPLAY0("Check obtained storage pointer against null\n"); + if (storage != nullptr) { + NSK_COMPLAIN1("GetThreadLocalStorage() returned NOT null storage for current agent thread:\n" "# storage: %p\n", (void*)storage); nsk_jvmti_setFailStatus(); @@ -114,7 +114,7 @@ JNIEXPORT jint JNI_OnLoad_getthrdstor001(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -124,11 +124,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTime/gettime001/gettime001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTime/gettime001/gettime001.cpp index 3ed38448feb..df8312be312 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTime/gettime001/gettime001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTime/gettime001/gettime001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -64,7 +64,7 @@ static bool checkTime(jvmtiEnv* jvmti, julong* time, } NSK_DISPLAY1(" ... got time: %s\n", julong_to_string(*time, buf)); - if (prevTime != NULL) { + if (prevTime != nullptr) { julong diff = *time - *prevTime; NSK_DISPLAY1("Compare with previous time: %s\n", @@ -141,7 +141,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { } NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = false; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -168,7 +168,7 @@ JNIEXPORT jint JNI_OnLoad_gettime001(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -176,7 +176,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -192,18 +192,18 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check initial time in Agent_OnLoad()\n"); { - if (!checkTime(jvmti, &prevTime, NULL, "Agent_OnLoad()")) { + if (!checkTime(jvmti, &prevTime, nullptr, "Agent_OnLoad()")) { nsk_jvmti_setFailStatus(); } } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTimerInfo/timerinfo001/timerinfo001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTimerInfo/timerinfo001/timerinfo001.cpp index daa5778d194..eebbfa837b6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTimerInfo/timerinfo001/timerinfo001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTimerInfo/timerinfo001/timerinfo001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -69,7 +69,7 @@ static bool checkTimerInfo(jvmtiEnv* jvmti, jvmtiTimerInfo* info, NSK_DISPLAY1(" may_skip_forward: %d\n", (int)info->may_skip_forward); NSK_DISPLAY1(" may_skip_backward: %d\n", (int)info->may_skip_backward); - if (initInfo != NULL) { + if (initInfo != nullptr) { NSK_DISPLAY0("Compare with initial timer info\n"); if (info->max_value != initInfo->max_value) { NSK_COMPLAIN4("In %s GetTimerInfo() returned different info:\n" @@ -158,7 +158,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { } NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = false; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -185,7 +185,7 @@ JNIEXPORT jint JNI_OnLoad_timerinfo001(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -193,7 +193,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -209,18 +209,18 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check initial timer info in Agent_OnLoad()\n"); { - if (!checkTimerInfo(jvmti, &initInfo, NULL, "Agent_OnLoad()")) { + if (!checkTimerInfo(jvmti, &initInfo, nullptr, "Agent_OnLoad()")) { nsk_jvmti_setFailStatus(); } } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp001/topthrgrp001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp001/topthrgrp001.cpp index 748880fee41..69baf58e6a7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp001/topthrgrp001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp001/topthrgrp001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_topthrgrp001(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,10 +68,10 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetTopThreadGroups_topthrgrp001_check(JNIEnv *env, jclass cls) { jvmtiError err; jint i, groupCount = 0; - jthreadGroup *groups = NULL; + jthreadGroup *groups = nullptr; jvmtiThreadGroupInfo inf; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -105,7 +105,7 @@ Java_nsk_jvmti_GetTopThreadGroups_topthrgrp001_check(JNIEnv *env, jclass cls) { printf(">>> is daemon: %s\n", (inf.is_daemon == JNI_TRUE) ? "true" : "false"); } - if (inf.parent != NULL) { + if (inf.parent != nullptr) { printf("ERROR: thread group is not parentless!\n"); printf(" group name: %s\n", inf.name); printf(" parent: 0x%p\n", inf.parent); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp002/topthrgrp002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp002/topthrgrp002.cpp index 50b23125dfa..b8817fcc1be 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp002/topthrgrp002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp002/topthrgrp002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_topthrgrp002(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetTopThreadGroups_topthrgrp002_check(JNIEnv *env, jclass cls) { jint groupCount; jthreadGroup *groups; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -78,7 +78,7 @@ Java_nsk_jvmti_GetTopThreadGroups_topthrgrp002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (groupCountPtr) null pointer check ...\n"); } - err = jvmti->GetTopThreadGroups(NULL, &groups); + err = jvmti->GetTopThreadGroups(nullptr, &groups); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(groupCountPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf(" got: %s (%d)\n", TranslateError(err), err); @@ -88,7 +88,7 @@ Java_nsk_jvmti_GetTopThreadGroups_topthrgrp002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (groupsPtr) null pointer check ...\n"); } - err = jvmti->GetTopThreadGroups(&groupCount, NULL); + err = jvmti->GetTopThreadGroups(&groupCount, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(groupsPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf(" got: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetVersionNumber/getvern001/getvern001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetVersionNumber/getvern001/getvern001.cpp index 1d8071891fc..80ba1ffe5c7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetVersionNumber/getvern001/getvern001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetVersionNumber/getvern001/getvern001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getvern001(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetVersionNumber_getvern001_check(JNIEnv * jvmtiError err; jint ver = 0; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -90,7 +90,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetVersionNumber_getvern001_check(JNIEnv * if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetVersionNumber(NULL); + err = jvmti->GetVersionNumber(nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER, got: %s\n", TranslateError(err)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp index 2bdfea11a6f..e89a4ea7b4f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,9 +38,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread runningThread = NULL; -static jthread waitingThread = NULL; -static jthread sleepingThread = NULL; +static jthread runningThread = nullptr; +static jthread waitingThread = nullptr; +static jthread sleepingThread = nullptr; /* ========================================================================== */ @@ -49,7 +49,7 @@ static int prepare(jvmtiEnv* jvmti) { const char* WAITING_THREAD_NAME = "DebuggeeWaitingThread"; const char* SLEEPING_THREAD_NAME = "DebuggeeSleepingThread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -60,12 +60,12 @@ static int prepare(jvmtiEnv* jvmti) { jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -76,7 +76,7 @@ static int prepare(jvmtiEnv* jvmti) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL) { + if (info.name != nullptr) { if (strcmp(info.name, RUNNING_THREAD_NAME) == 0) { runningThread = threads[i]; } else if (strcmp(info.name, WAITING_THREAD_NAME) == 0) { @@ -109,7 +109,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #1: call InterruptThread for runningThread\n"); - if (!NSK_VERIFY(runningThread != NULL)) { + if (!NSK_VERIFY(runningThread != nullptr)) { nsk_jvmti_setFailStatus(); } else { if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(runningThread))) @@ -117,7 +117,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #2: call InterruptThread for waitingThread\n"); - if (!NSK_VERIFY(waitingThread != NULL)) { + if (!NSK_VERIFY(waitingThread != nullptr)) { nsk_jvmti_setFailStatus(); } else { if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(waitingThread))) @@ -125,7 +125,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #3: call InterruptThread for sleepingThread\n"); - if (!NSK_VERIFY(sleepingThread != NULL)) { + if (!NSK_VERIFY(sleepingThread != nullptr)) { nsk_jvmti_setFailStatus(); } else { if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(sleepingThread))) @@ -151,7 +151,7 @@ JNIEXPORT jint JNI_OnLoad_intrpthrd001(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -162,10 +162,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd002/intrpthrd002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd002/intrpthrd002.cpp index 60c2384b1c1..9411e9365d4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd002/intrpthrd002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd002/intrpthrd002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd003/intrpthrd003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd003/intrpthrd003.cpp index b05c5d5cd7d..dd81a65cb21 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd003/intrpthrd003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd003/intrpthrd003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,7 +55,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray004/isarray004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray004/isarray004.cpp index 30277bcc619..ac14708af83 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray004/isarray004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray004/isarray004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_isarray004(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_IsArrayClass_isarray004_check(JNIEnv *env, jclass cls) { jvmtiError err; jboolean isArrayClass; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_IsArrayClass_isarray004_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->IsArrayClass(NULL, &isArrayClass); + err = jvmti->IsArrayClass(nullptr, &isArrayClass); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -87,7 +87,7 @@ Java_nsk_jvmti_IsArrayClass_isarray004_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->IsArrayClass(cls, NULL); + err = jvmti->IsArrayClass(cls, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray005/isarray005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray005/isarray005.cpp index 4aacc6f21fe..774ec0574be 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray005/isarray005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray005/isarray005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_isarray005(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -75,7 +75,7 @@ Java_nsk_jvmti_IsArrayClass_isarray005_check(JNIEnv *env, jboolean isArrayClass; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin002/isfldsin002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin002/isfldsin002.cpp index ca52e5801d2..1d4a737551d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin002/isfldsin002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin002/isfldsin002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,13 +97,13 @@ Java_nsk_jvmti_IsFieldSynthetic_isfldsin002_check(JNIEnv *env, jclass cls) { jfieldID fid; jboolean isSynthetic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } fid = env->GetFieldID(cls, "fld", "I"); - if (fid == NULL) { + if (fid == nullptr) { printf("Cannot get field ID!\n"); return STATUS_FAILED; } @@ -111,7 +111,7 @@ Java_nsk_jvmti_IsFieldSynthetic_isfldsin002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->IsFieldSynthetic(NULL, fid, &isSynthetic); + err = jvmti->IsFieldSynthetic(nullptr, fid, &isSynthetic); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_synthetic_attribute) { /* It is OK */ @@ -124,7 +124,7 @@ Java_nsk_jvmti_IsFieldSynthetic_isfldsin002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid field check ...\n"); } - err = jvmti->IsFieldSynthetic(cls, NULL, &isSynthetic); + err = jvmti->IsFieldSynthetic(cls, nullptr, &isSynthetic); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_synthetic_attribute) { /* It is OK */ @@ -137,7 +137,7 @@ Java_nsk_jvmti_IsFieldSynthetic_isfldsin002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->IsFieldSynthetic(cls, fid, NULL); + err = jvmti->IsFieldSynthetic(cls, fid, nullptr); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_synthetic_attribute) { /* It is OK */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin003/isfldsin003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin003/isfldsin003.cpp index a06e1fd1dff..0089b0e6f70 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin003/isfldsin003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin003/isfldsin003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ typedef struct { jboolean is_synthetic; } field_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -64,12 +64,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -114,14 +114,14 @@ Java_nsk_jvmti_IsFieldSynthetic_isfldsin003a_check(JNIEnv *env, jboolean isSynthetic; size_t i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } for (i = 0; i < sizeof(fields) / sizeof(field_info); i++) { fid = env->GetFieldID(clazz, fields[i].name, fields[i].sig); - if (fid == NULL) { + if (fid == nullptr) { printf("(%" PRIuPTR ") cannot get field ID for %s:\"%s\"\n", i, fields[i].name, fields[i].sig); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf004/isintrf004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf004/isintrf004.cpp index 01c232547f7..fdc8da2bc78 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf004/isintrf004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf004/isintrf004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_isintrf004(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_IsInterface_isintrf004_check(JNIEnv *env, jclass cls) { jvmtiError err; jboolean isInterface; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_IsInterface_isintrf004_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->IsInterface(NULL, &isInterface); + err = jvmti->IsInterface(nullptr, &isInterface); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -87,7 +87,7 @@ Java_nsk_jvmti_IsInterface_isintrf004_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->IsInterface(cls, NULL); + err = jvmti->IsInterface(cls, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf005/isintrf005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf005/isintrf005.cpp index 887cd625052..57f0386f2a9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf005/isintrf005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf005/isintrf005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_isintrf005(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -74,7 +74,7 @@ Java_nsk_jvmti_IsInterface_isintrf005_check(JNIEnv *env, jclass cls, jclass claz jboolean isInterface; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative001/isnative001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative001/isnative001.cpp index f4af7621adb..4e2b49fa0a3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative001/isnative001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative001/isnative001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_isnative001(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -79,7 +79,7 @@ void checkMeth(JNIEnv *env, jclass cl, } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find MethodID for \"%s%s\"\n", name, sig); result = STATUS_FAILED; return; @@ -116,7 +116,7 @@ Java_nsk_jvmti_IsMethodNative_isnative001_check(JNIEnv *env, jclass cls) { checkMeth(env, cls, "check", "()I", 1, JNI_TRUE); clsId = env->FindClass("nsk/jvmti/IsMethodNative/isnative001$Inn"); - if (clsId == NULL) { + if (clsId == nullptr) { printf("Cannot find nsk.jvmti.IsMethodNative.isnative001$Inn class!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative002/isnative002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative002/isnative002.cpp index 99528346766..3160237fb47 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative002/isnative002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative002/isnative002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_isnative002(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,13 +70,13 @@ Java_nsk_jvmti_IsMethodNative_isnative002_check(JNIEnv *env, jclass cls) { jmethodID mid; jboolean isNative; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_IsMethodNative_isnative002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->IsMethodNative(NULL, &isNative); + err = jvmti->IsMethodNative(nullptr, &isNative); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -94,7 +94,7 @@ Java_nsk_jvmti_IsMethodNative_isnative002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->IsMethodNative(mid, NULL); + err = jvmti->IsMethodNative(mid, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp index 399d894f9b4..fcc857134bf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,10 +95,10 @@ static void checkStackMethodsObsolete(jvmtiEnv* jvmti, jthread thread, int i; for (i = 0; i < frameCount; i++) { - char* name = NULL; - char* signature = NULL; - char* generic = NULL; - char* kind = NULL; + char* name = nullptr; + char* signature = nullptr; + char* generic = nullptr; + char* kind = nullptr; NSK_DISPLAY1(" frame #%i:\n", i); NSK_DISPLAY1(" methodID: %p\n", (void*)frameStack[i].method); @@ -110,7 +110,7 @@ static void checkStackMethodsObsolete(jvmtiEnv* jvmti, jthread thread, NSK_DISPLAY1(" name: %s\n", nsk_null_string(name)); NSK_DISPLAY1(" signature: %s\n", nsk_null_string(signature)); NSK_DISPLAY1(" generic: %s\n", nsk_null_string(generic)); - if (name != NULL + if (name != nullptr && (strcmp(STATIC_METHOD_NAME, name) == 0 || strcmp(INSTANCE_METHOD_NAME, name) == 0)) { found++; @@ -166,15 +166,15 @@ static int redefineClass(jvmtiEnv* jvmti, jclass klass, const char className[], /** Get classfile bytes to redefine. */ static int getClassfileBytes(JNIEnv* jni, jvmtiEnv* jvmti, jint* size, unsigned char* *bytes) { - jclass debugeeClass = NULL; - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jclass debugeeClass = nullptr; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -182,7 +182,7 @@ static int getClassfileBytes(JNIEnv* jni, jvmtiEnv* jvmti, NSK_DISPLAY1("Find static field: %s\n", CLASSFILE_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(debugeeClass, CLASSFILE_FIELD_NAME, CLASSFILE_FIELD_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, CLASSFILE_FIELD_NAME, CLASSFILE_FIELD_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -190,7 +190,7 @@ static int getClassfileBytes(JNIEnv* jni, jvmtiEnv* jvmti, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", CLASSFILE_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(debugeeClass, fieldID)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -206,7 +206,7 @@ static int getClassfileBytes(JNIEnv* jni, jvmtiEnv* jvmti, { jboolean isCopy; if (!NSK_JNI_VERIFY(jni, (elements = - jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -242,11 +242,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jclass testedClass = NULL; - jobject testedThread = NULL; - jmethodID staticMethodID = NULL; - jmethodID instanceMethodID = NULL; - unsigned char* classfileBytes = NULL; + jclass testedClass = nullptr; + jobject testedThread = nullptr; + jmethodID staticMethodID = nullptr; + jmethodID instanceMethodID = nullptr; + unsigned char* classfileBytes = nullptr; jint classfileSize = 0; NSK_DISPLAY0(">>> Obtain bytes for class file redefinition\n"); @@ -259,7 +259,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { NSK_DISPLAY1("Find tested class: %s\n", TESTED_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (testedClass = - jni->FindClass(TESTED_CLASS_NAME)) != NULL)) { + jni->FindClass(TESTED_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -267,7 +267,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Make global reference for class object: %p\n", (void*)testedClass); if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) - jni->NewGlobalRef(testedClass)) != NULL)) { + jni->NewGlobalRef(testedClass)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -275,7 +275,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Get static methodID: %s\n", STATIC_METHOD_NAME); if (!NSK_JNI_VERIFY(jni, (staticMethodID = - jni->GetStaticMethodID(testedClass, STATIC_METHOD_NAME, STATIC_METHOD_SIG)) != NULL)) { + jni->GetStaticMethodID(testedClass, STATIC_METHOD_NAME, STATIC_METHOD_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -283,7 +283,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Get instance methodID: %s\n", INSTANCE_METHOD_NAME); if (!NSK_JNI_VERIFY(jni, (instanceMethodID = - jni->GetMethodID(testedClass, INSTANCE_METHOD_NAME, INSTANCE_METHOD_SIG)) != NULL)) { + jni->GetMethodID(testedClass, INSTANCE_METHOD_NAME, INSTANCE_METHOD_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -291,7 +291,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find thread with running methods by name: %s\n", TESTED_THREAD_NAME); if (!NSK_VERIFY((testedThread = - nsk_jvmti_threadByName(TESTED_THREAD_NAME)) != NULL)) { + nsk_jvmti_threadByName(TESTED_THREAD_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -367,7 +367,7 @@ JNIEXPORT jint JNI_OnLoad_isobsolete001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -377,7 +377,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add required capabilities */ @@ -393,7 +393,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth001/issynth001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth001/issynth001.cpp index e9088348e02..a10f3b8e0ee 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth001/issynth001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth001/issynth001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ typedef struct { jboolean is_synthetic; } method_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -76,12 +76,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -139,7 +139,7 @@ Java_nsk_jvmti_IsMethodSynthetic_issynth001a_check(JNIEnv *env, } else { mid = env->GetMethodID(cl, methods[i].name, methods[i].signature); } - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find MethodID for \"%s%s\"\n", methods[i].name, methods[i].signature); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth002/issynth002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth002/issynth002.cpp index 96eb657d238..ab344596ab7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth002/issynth002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth002/issynth002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,13 +97,13 @@ Java_nsk_jvmti_IsMethodSynthetic_issynth002_check(JNIEnv *env, jclass cls) { jmethodID mid; jboolean isSynthetic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find method \"()V\"!\n"); return STATUS_FAILED; } @@ -111,7 +111,7 @@ Java_nsk_jvmti_IsMethodSynthetic_issynth002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->IsMethodSynthetic(NULL, &isSynthetic); + err = jvmti->IsMethodSynthetic(nullptr, &isSynthetic); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_synthetic_attribute) { /* It is OK */ @@ -124,7 +124,7 @@ Java_nsk_jvmti_IsMethodSynthetic_issynth002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->IsMethodSynthetic(mid, NULL); + err = jvmti->IsMethodSynthetic(mid, nullptr); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_synthetic_attribute) { /* It is OK */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp index 3d54b28b6c8..fbfaac26708 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,7 +65,7 @@ typedef struct ObjectDescStruct { static int chainLength = 0; static int objectsCount = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static volatile int foundUntagged = 0; @@ -82,7 +82,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jlong tag, int reachable) { int success = NSK_TRUE; - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (!reachable ? -tag : (tag % 2 != 0) ? tag : (jlong)0); if (count <= 0) @@ -92,7 +92,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, tag++; if (!NSK_JNI_VERIFY(jni, (obj = - jni->GetObjectField(firstObject, firstField)) != NULL)) { + jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -118,16 +118,16 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, /** Obtain all tested objects from debugee class and tag them recursively. */ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; - jobject rootObject = NULL; + jobject rootObject = nullptr; jlong chainObjectTag = 100; @@ -151,7 +151,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -159,7 +159,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (rootObjectClass = - jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -167,7 +167,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -175,7 +175,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -183,7 +183,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -191,7 +191,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -199,7 +199,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -207,7 +207,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -302,7 +302,7 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList) { - if (objectDescList != NULL) { + if (objectDescList != nullptr) { NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY( jvmti->Deallocate((unsigned char*)objectDescList))) { @@ -322,9 +322,9 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) if (info & INFO_HEAPOBJ) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr)); + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr)); } else if ((info & INFO_TAGGED) != 0 && - tag_ptr != NULL && *tag_ptr != 0) { + tag_ptr != nullptr && *tag_ptr != 0) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, (long)*tag_ptr); @@ -341,8 +341,8 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) nsk_jvmti_setFailStatus(); } - if (tag_ptr == NULL) { - NSK_COMPLAIN3("NULL tag_ptr is passed to heapObjectCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN3("null tag_ptr is passed to heapObjectCallback:\n" "# tag_ptr: 0x%p\n" "# class_tag: %ld\n" "# size: %ld\n", @@ -411,7 +411,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Enable OBJECT_FREE event and let debugee to clean links to unreachable objects\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; if (!NSK_VERIFY(nsk_jvmti_resumeSync())) @@ -432,7 +432,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Disable OBJECT_FREE event and check if tagged/untagged objects were iterated:\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) return; if (!checkTestedObjects(jvmti, jni, chainLength, objectDescList)) { @@ -487,7 +487,7 @@ JNIEXPORT jint JNI_OnLoad_iterheap001(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -496,7 +496,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -523,7 +523,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -547,7 +547,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp index 9d4171ef71c..e1d5a366266 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,7 +65,7 @@ typedef struct ObjectDescStruct { static int chainLength = 0; static int objectsCount = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static volatile int foundUntagged = 0; @@ -82,7 +82,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jlong tag, int reachable) { int success = NSK_TRUE; - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (!reachable ? -tag : (tag % 2 != 0) ? tag : (jlong)0); if (count <= 0) @@ -92,7 +92,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, tag++; if (!NSK_JNI_VERIFY(jni, (obj = - jni->GetObjectField(firstObject, firstField)) != NULL)) { + jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -118,16 +118,16 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, /** Obtain all tested objects from debugee class and tag them recursively. */ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; - jobject rootObject = NULL; + jobject rootObject = nullptr; jlong chainObjectTag = 100; @@ -151,7 +151,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -159,7 +159,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (rootObjectClass = - jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -167,7 +167,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -175,7 +175,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -183,7 +183,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -191,7 +191,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -199,7 +199,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -207,7 +207,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -302,7 +302,7 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList) { - if (objectDescList != NULL) { + if (objectDescList != nullptr) { NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY( jvmti->Deallocate((unsigned char*)objectDescList))) { @@ -322,9 +322,9 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) if (info & INFO_HEAPOBJ) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr)); + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr)); } else if ((info & INFO_TAGGED) != 0 && - tag_ptr != NULL && *tag_ptr != 0) { + tag_ptr != nullptr && *tag_ptr != 0) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, (long)*tag_ptr); @@ -341,8 +341,8 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) nsk_jvmti_setFailStatus(); } - if (tag_ptr == NULL) { - NSK_COMPLAIN3("NULL tag_ptr is passed to heapObjectCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN3("null tag_ptr is passed to heapObjectCallback:\n" "# tag_ptr: 0x%p\n" "# class_tag: %ld\n" "# size: %ld\n", @@ -419,7 +419,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Enable OBJECT_FREE event and let debugee to clean links to unreachable objects\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; if (!NSK_VERIFY(nsk_jvmti_resumeSync())) @@ -440,7 +440,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Disable OBJECT_FREE event and check if tagged objects were iterated:\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) return; if (!checkTestedObjects(jvmti, jni, chainLength, objectDescList)) { @@ -495,7 +495,7 @@ JNIEXPORT jint JNI_OnLoad_iterheap002(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -504,7 +504,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -531,7 +531,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -555,7 +555,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp index a485c4bb6ee..488ce612a1b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,7 +65,7 @@ typedef struct ObjectDescStruct { static int chainLength = 0; static int objectsCount = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static volatile int foundUntagged = 0; @@ -82,7 +82,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jlong tag, int reachable) { int success = NSK_TRUE; - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (!reachable ? -tag : (tag % 2 != 0) ? tag : (jlong)0); if (count <= 0) @@ -92,7 +92,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, tag++; if (!NSK_JNI_VERIFY(jni, (obj = - jni->GetObjectField(firstObject, firstField)) != NULL)) { + jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -118,16 +118,16 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, /** Obtain all tested objects from debugee class and tag them recursively. */ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; - jobject rootObject = NULL; + jobject rootObject = nullptr; jlong chainObjectTag = 100; @@ -151,7 +151,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -159,7 +159,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (rootObjectClass = - jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -167,7 +167,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -175,7 +175,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -183,7 +183,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -191,7 +191,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -199,7 +199,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -207,7 +207,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -302,7 +302,7 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList) { - if (objectDescList != NULL) { + if (objectDescList != nullptr) { NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY( jvmti->Deallocate((unsigned char*)objectDescList))) { @@ -322,9 +322,9 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) if (info & INFO_HEAPOBJ) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr)); + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr)); } else if ((info & INFO_TAGGED) != 0 && - tag_ptr != NULL && *tag_ptr != 0) { + tag_ptr != nullptr && *tag_ptr != 0) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, (long)*tag_ptr); @@ -341,8 +341,8 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) nsk_jvmti_setFailStatus(); } - if (tag_ptr == NULL) { - NSK_COMPLAIN3("NULL tag_ptr is passed to heapObjectCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN3("null tag_ptr is passed to heapObjectCallback:\n" "# tag_ptr: 0x%p\n" "# class_tag: %ld\n" "# size: %ld\n", @@ -420,7 +420,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Enable OBJECT_FREE event and let debugee to clean links to unreachable objects\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; if (!NSK_VERIFY(nsk_jvmti_resumeSync())) @@ -441,7 +441,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Disable OBJECT_FREE event and check if untagged objects were iterated:\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) return; if (!checkTestedObjects(jvmti, jni, chainLength, objectDescList)) { @@ -496,7 +496,7 @@ JNIEXPORT jint JNI_OnLoad_iterheap003(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -505,7 +505,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -532,7 +532,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -556,7 +556,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp index 54eb590a962..8e30927f00b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,8 +29,8 @@ extern "C" { -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jlong timeout = 0; @@ -126,7 +126,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { do { - objectDescList = NULL; + objectDescList = nullptr; NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_UNTAGGED\n"); { @@ -170,7 +170,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } /* Verify objectDescCount and objectDescList length in agreement */ - if (!NSK_VERIFY(objectDesc == NULL)) { + if (!NSK_VERIFY(objectDesc == nullptr)) { nsk_jvmti_setFailStatus(); break; } @@ -242,7 +242,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -258,7 +258,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!caps.can_tag_objects) NSK_DISPLAY0("Warning: tagging objects is not available\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp index d2ccacfe2d2..86b1c537a2c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { static jlong timeout = 0; static int fakeUserData = 0, objCounter = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; /* ============================================================================= */ @@ -44,7 +44,7 @@ heapObjectCallback(jlong class_tag, void* user_data) { const char* name = "monitorName"; - jrawMonitorID monitor_ptr = NULL; + jrawMonitorID monitor_ptr = nullptr; /* Check RawMonitor functions for first 10 objects */ if (objCounter >= 10) return JVMTI_ITERATION_ABORT; @@ -150,7 +150,7 @@ JNIEXPORT jint JNI_OnLoad_iterheap005(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -158,7 +158,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -175,7 +175,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp index 9e387542ca3..cc8da20efcc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,9 +32,9 @@ extern "C" { /* ============================================================================= */ static jlong timeout = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static const char *storage_data = "local_storage_data"; -static void *storage_ptr = NULL; +static void *storage_ptr = nullptr; /* ============================================================================= */ @@ -111,7 +111,7 @@ JNIEXPORT jint JNI_OnLoad_iterheap006(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -119,7 +119,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -136,7 +136,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp index 467fd6bc796..7075025ec09 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { /* ============================================================================= */ static jlong timeout = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static jlong nanos = 0; static jvmtiTimerInfo timer_info1, timer_info2; static int *user_data = 0; @@ -135,7 +135,7 @@ JNIEXPORT jint JNI_OnLoad_iterheap007(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -143,7 +143,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -160,7 +160,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp index c9a0acc33ee..32b7adc30de 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,7 +65,7 @@ typedef struct ObjectDescStruct { static int chainLength = 0; static int objectsCount = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static volatile int foundUntagged = 0; @@ -82,7 +82,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jlong tag, int reachable) { int success = NSK_TRUE; - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (!reachable ? -tag : (tag % 2 != 0) ? tag : (jlong)0); if (count <= 0) @@ -92,7 +92,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, tag++; if (!NSK_JNI_VERIFY(jni, (obj = - jni->GetObjectField(firstObject, firstField)) != NULL)) { + jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -119,16 +119,16 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList, jclass *testedClass) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; - jobject rootObject = NULL; + jobject rootObject = nullptr; jlong testedClassTag = 1; jlong chainObjectTag = 100; @@ -153,7 +153,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -161,7 +161,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (rootObjectClass = - jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -169,7 +169,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -177,7 +177,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Create global ref to tested class: 0x%p\n", chainObjectClass); if (!NSK_JNI_VERIFY(jni, (*testedClass = (jclass) - jni->NewGlobalRef(chainObjectClass)) != NULL)) { + jni->NewGlobalRef(chainObjectClass)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -185,7 +185,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -193,7 +193,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -201,7 +201,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -209,7 +209,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -217,7 +217,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -320,12 +320,12 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList, jclass testedClass) { - if (testedClass != NULL) { + if (testedClass != nullptr) { NSK_DISPLAY1("Release object reference to tested class: 0x%p\n", testedClass); NSK_TRACE(jni->DeleteGlobalRef(testedClass)); } - if (objectDescList != NULL) { + if (objectDescList != nullptr) { NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY( jvmti->Deallocate((unsigned char*)objectDescList))) { @@ -345,7 +345,7 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) if (info & INFO_HEAPOBJ) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr)); + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr)); } if (class_tag != 1) { @@ -359,8 +359,8 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) nsk_jvmti_setFailStatus(); } - if (tag_ptr == NULL) { - NSK_COMPLAIN3("NULL tag_ptr is passed to heapObjectCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN3("null tag_ptr is passed to heapObjectCallback:\n" "# tag_ptr: 0x%p\n" "# class_tag: %ld\n" "# size: %ld\n", @@ -419,7 +419,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; { - jclass testedClass = NULL; + jclass testedClass = nullptr; NSK_DISPLAY0(">>> Obtain and tag tested objects from debugee class\n"); { @@ -431,7 +431,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Enable OBJECT_FREE event and let debugee to clean links to unreachable objects\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; if (!NSK_VERIFY(nsk_jvmti_resumeSync())) @@ -452,7 +452,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Disable OBJECT_FREE event and check if tagged/untagged objects were iterated:\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) return; if (!checkTestedObjects(jvmti, jni, chainLength, objectDescList)) { @@ -508,7 +508,7 @@ JNIEXPORT jint JNI_OnLoad_iterinstcls001(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -517,7 +517,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -542,7 +542,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -566,7 +566,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp index 13288e2fd5e..b048103203b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,7 +65,7 @@ typedef struct ObjectDescStruct { static int chainLength = 0; static int objectsCount = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static volatile int foundUntagged = 0; @@ -82,7 +82,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jlong tag, int reachable) { int success = NSK_TRUE; - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (!reachable ? -tag : (tag % 2 != 0) ? tag : (jlong)0); if (count <= 0) @@ -92,7 +92,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, tag++; if (!NSK_JNI_VERIFY(jni, (obj = - jni->GetObjectField(firstObject, firstField)) != NULL)) { + jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -119,16 +119,16 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList, jclass *testedClass) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; - jobject rootObject = NULL; + jobject rootObject = nullptr; jlong testedClassTag = 1; jlong chainObjectTag = 100; @@ -153,7 +153,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -161,7 +161,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (rootObjectClass = - jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -169,7 +169,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -177,7 +177,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Create global ref to tested class: 0x%p\n", chainObjectClass); if (!NSK_JNI_VERIFY(jni, (*testedClass = (jclass) - jni->NewGlobalRef(chainObjectClass)) != NULL)) { + jni->NewGlobalRef(chainObjectClass)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -185,7 +185,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -193,7 +193,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -201,7 +201,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -209,7 +209,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -217,7 +217,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -320,12 +320,12 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList, jclass testedClass) { - if (testedClass != NULL) { + if (testedClass != nullptr) { NSK_DISPLAY1("Release object reference to tested class: 0x%p\n", testedClass); NSK_TRACE(jni->DeleteGlobalRef(testedClass)); } - if (objectDescList != NULL) { + if (objectDescList != nullptr) { NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY( jvmti->Deallocate((unsigned char*)objectDescList))) { @@ -345,7 +345,7 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) if (info & INFO_HEAPOBJ) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr)); + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr)); } if (class_tag != 1) { @@ -359,8 +359,8 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) nsk_jvmti_setFailStatus(); } - if (tag_ptr == NULL) { - NSK_COMPLAIN3("NULL tag_ptr is passed to heapObjectCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN3("null tag_ptr is passed to heapObjectCallback:\n" "# tag_ptr: 0x%p\n" "# class_tag: %ld\n" "# size: %ld\n", @@ -427,7 +427,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; { - jclass testedClass = NULL; + jclass testedClass = nullptr; NSK_DISPLAY0(">>> Obtain and tag tested objects from debugee class\n"); { @@ -439,7 +439,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Enable OBJECT_FREE event and let debugee to clean links to unreachable objects\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; if (!NSK_VERIFY(nsk_jvmti_resumeSync())) @@ -460,7 +460,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Disable OBJECT_FREE event and check if tagged objects were iterated:\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) return; if (!checkTestedObjects(jvmti, jni, chainLength, objectDescList)) { @@ -516,7 +516,7 @@ JNIEXPORT jint JNI_OnLoad_iterinstcls002(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -525,7 +525,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -550,7 +550,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -574,7 +574,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp index e552dc0b3b9..147003ff77f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,7 +65,7 @@ typedef struct ObjectDescStruct { static int chainLength = 0; static int objectsCount = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static volatile int foundUntagged = 0; @@ -82,7 +82,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jlong tag, int reachable) { int success = NSK_TRUE; - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (!reachable ? -tag : (tag % 2 != 0) ? tag : (jlong)0); if (count <= 0) @@ -92,7 +92,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, tag++; if (!NSK_JNI_VERIFY(jni, (obj = - jni->GetObjectField(firstObject, firstField)) != NULL)) { + jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -119,16 +119,16 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList, jclass *testedClass) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; - jobject rootObject = NULL; + jobject rootObject = nullptr; jlong testedClassTag = 1; jlong chainObjectTag = 100; @@ -153,7 +153,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -161,7 +161,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (rootObjectClass = - jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -169,7 +169,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -177,7 +177,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Create global ref to tested class: 0x%p\n", chainObjectClass); if (!NSK_JNI_VERIFY(jni, (*testedClass = (jclass) - jni->NewGlobalRef(chainObjectClass)) != NULL)) { + jni->NewGlobalRef(chainObjectClass)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -185,7 +185,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -193,7 +193,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -201,7 +201,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -209,7 +209,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -217,7 +217,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -320,12 +320,12 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList, jclass testedClass) { - if (testedClass != NULL) { + if (testedClass != nullptr) { NSK_DISPLAY1("Release object reference to tested class: 0x%p\n", testedClass); NSK_TRACE(jni->DeleteGlobalRef(testedClass)); } - if (objectDescList != NULL) { + if (objectDescList != nullptr) { NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY( jvmti->Deallocate((unsigned char*)objectDescList))) { @@ -345,7 +345,7 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) if (info & INFO_HEAPOBJ) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr)); + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr)); } if (class_tag != 1) { @@ -359,8 +359,8 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) nsk_jvmti_setFailStatus(); } - if (tag_ptr == NULL) { - NSK_COMPLAIN3("NULL tag_ptr is passed to heapObjectCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN3("null tag_ptr is passed to heapObjectCallback:\n" "# tag_ptr: 0x%p\n" "# class_tag: %ld\n" "# size: %ld\n", @@ -428,7 +428,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; { - jclass testedClass = NULL; + jclass testedClass = nullptr; NSK_DISPLAY0(">>> Obtain and tag tested objects from debugee class\n"); { @@ -440,7 +440,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Enable OBJECT_FREE event and let debugee to clean links to unreachable objects\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; if (!NSK_VERIFY(nsk_jvmti_resumeSync())) @@ -461,7 +461,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Disable OBJECT_FREE event and check if untagged objects were iterated:\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) return; if (!checkTestedObjects(jvmti, jni, chainLength, objectDescList)) { @@ -517,7 +517,7 @@ JNIEXPORT jint JNI_OnLoad_iterinstcls003(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -526,7 +526,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -551,7 +551,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -575,7 +575,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp index 43e378571f4..6790635654c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ typedef struct ObjectDescStruct { } ObjectDesc; static ObjectDesc *objectDescBuf; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static const char debugeeClassSignature[] = "Lnsk/jvmti/IterateOverInstancesOfClass/iterinstcls004;"; /* ============================================================================= */ @@ -99,12 +99,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; do { NSK_DISPLAY1("Find debugee class: %s\n", debugeeClassSignature); debugeeClass = nsk_jvmti_classBySignature(debugeeClassSignature); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } @@ -167,7 +167,7 @@ JNIEXPORT jint JNI_OnLoad_iterinstcls004(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -175,7 +175,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -192,7 +192,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp index 0907650299a..7e7d6ff85be 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { static jlong timeout = 0; static int fakeUserData = 0, objCounter = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static const char debugeeClassSignature[] = "Lnsk/jvmti/IterateOverInstancesOfClass/iterinstcls005;"; /* ============================================================================= */ @@ -45,7 +45,7 @@ heapObjectCallback(jlong class_tag, void* user_data) { const char* name = "monitorName"; - jrawMonitorID monitor_ptr = NULL; + jrawMonitorID monitor_ptr = nullptr; objCounter++; @@ -106,11 +106,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; do { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", debugeeClassSignature); debugeeClass = nsk_jvmti_classBySignature(debugeeClassSignature); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } @@ -152,7 +152,7 @@ JNIEXPORT jint JNI_OnLoad_iterinstcls005(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -160,7 +160,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -176,7 +176,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp index 56868adb9b7..9129af82476 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,9 +32,9 @@ extern "C" { /* ============================================================================= */ static jlong timeout = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static const char *storage_data = "local_storage_data"; -static void *storage_ptr = NULL; +static void *storage_ptr = nullptr; static const char debugeeClassSignature[] = "Lnsk/jvmti/IterateOverInstancesOfClass/iterinstcls006;"; /* ============================================================================= */ @@ -68,11 +68,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; do { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", debugeeClassSignature); debugeeClass = nsk_jvmti_classBySignature(debugeeClassSignature); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } @@ -121,7 +121,7 @@ JNIEXPORT jint JNI_OnLoad_iterinstcls006(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -129,7 +129,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -145,7 +145,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp index 5e93a860167..01026bad68e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { /* ============================================================================= */ static jlong timeout = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static int *user_data = 0; static const char debugeeClassSignature[] = "Lnsk/jvmti/IterateOverInstancesOfClass/iterinstcls007;"; static jlong nanos = 0; @@ -109,11 +109,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { do { NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_EITHER\n"); { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", debugeeClassSignature); debugeeClass = nsk_jvmti_classBySignature(debugeeClassSignature); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } @@ -148,7 +148,7 @@ JNIEXPORT jint JNI_OnLoad_iterinstcls007(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -156,7 +156,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -173,7 +173,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp index 487ca0fd703..ba158a475ae 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,7 +63,7 @@ typedef struct ObjectDescStruct { static int chainLength = 0; static int objectsCount = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static int fakeUserData = 0; static int userDataError = 0; @@ -76,7 +76,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jfieldID nextField, const char nextFieldName[], int count, ObjectDesc objectDescList[], jlong tag, int reachable) { - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (reachable ? tag : -tag); if (count <= 0) @@ -85,7 +85,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, count--; tag++; - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -110,14 +110,14 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList, jobject* rootObject) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; jlong rootObjectTag = 1; jlong chainObjectTag = 100; @@ -141,14 +141,14 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, } NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } NSK_DISPLAY1(" ... found class: 0x%p\n", (void*)debugeeClass); NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -156,7 +156,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -164,7 +164,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID( - debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -172,7 +172,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (reachableChainField = jni->GetFieldID( - rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -180,7 +180,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (unreachableChainField = jni->GetFieldID( - rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -188,7 +188,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -196,13 +196,13 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (*rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)*rootObject); - if (!NSK_JNI_VERIFY(jni, (*rootObject = jni->NewGlobalRef(*rootObject)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (*rootObject = jni->NewGlobalRef(*rootObject)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -290,12 +290,12 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList, jobject rootObject) { - if (rootObject != NULL) { + if (rootObject != nullptr) { NSK_DISPLAY1("Release object reference to root tested object: 0x%p\n", rootObject); NSK_TRACE(jni->DeleteGlobalRef(rootObject)); } - if (objectDescList != NULL) { + if (objectDescList != nullptr) { NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescList))) { nsk_jvmti_setFailStatus(); @@ -318,12 +318,12 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, NSK_DISPLAY6(" objectReferenceCallback: ref_kind=%1d class_tag=%-3ld size=%-3ld" " *tag_ptr=%-5ld ref_tag=%-5ld ref_idx=%d\n", (int)reference_kind, (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr), + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr), (long)refferrer_tag, (int)refferrer_index); } - if (tag_ptr == NULL) { - NSK_COMPLAIN6("NULL tag_ptr is passed to objectReferenceCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN6("null tag_ptr is passed to objectReferenceCallback:\n" "# tag_ptr: 0x%p\n" "# reference_kind: %d\n" "# class_tag: %ld\n" @@ -339,7 +339,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, nsk_jvmti_setFailStatus(); } - if (tag_ptr != NULL && *tag_ptr != 0) { + if (tag_ptr != nullptr && *tag_ptr != 0) { int found = 0; int i; @@ -412,7 +412,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; { - jobject rootObject = NULL; + jobject rootObject = nullptr; NSK_DISPLAY0(">>> Obtain and tag tested objects from debugee class\n"); { @@ -474,7 +474,7 @@ JNIEXPORT jint JNI_OnLoad_iterobjreachobj001(JavaVM *jvm, char *options, void *r } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -483,7 +483,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -508,7 +508,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -521,7 +521,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp index 2bc628d73d2..9f5e130341d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ static jlong timeout = 0; static long objectCount = 0; static int userData = 0, allocationError = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static const char* debugeeClassSignature = "Lnsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002;"; static const char* objectFieldName = "object"; @@ -108,28 +108,28 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; - jobject object = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; + jobject object = nullptr; do { NSK_DISPLAY1("Find debugee class: %s\n", debugeeClassSignature); debugeeClass = nsk_jvmti_classBySignature(debugeeClassSignature); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } NSK_DISPLAY1("Find static field in debugee class: %s\n", objectFieldName); if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID( - debugeeClass, objectFieldName, debugeeClassSignature)) != NULL)) { + debugeeClass, objectFieldName, debugeeClassSignature)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } NSK_DISPLAY1("Find value of static field in debugee class: %s\n", objectFieldName); if (!NSK_JNI_VERIFY(jni, (object = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } @@ -190,7 +190,7 @@ JNIEXPORT jint JNI_OnLoad_iterobjreachobj002(JavaVM *jvm, char *options, void *r } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -198,7 +198,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -214,7 +214,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp index 0bca38f4ada..0681864d99a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { static jlong timeout = 0; static int fakeUserData = 0, objCounter = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static const char* debugeeClassSignature = "Lnsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003;"; static const char* objectFieldName = "object"; @@ -49,7 +49,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, void* user_data) { const char* name = "monitorName"; - jrawMonitorID monitor_ptr = NULL; + jrawMonitorID monitor_ptr = nullptr; objCounter++; @@ -110,27 +110,27 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; do { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; - jobject object = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; + jobject object = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", debugeeClassSignature); debugeeClass = nsk_jvmti_classBySignature(debugeeClassSignature); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } NSK_DISPLAY1("Find static field in debugee class: %s\n", objectFieldName); if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID( - debugeeClass, objectFieldName, debugeeClassSignature)) != NULL)) { + debugeeClass, objectFieldName, debugeeClassSignature)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } NSK_DISPLAY1("Find value of static field in debugee class: %s\n", objectFieldName); if (!NSK_JNI_VERIFY(jni, (object = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } @@ -169,7 +169,7 @@ JNIEXPORT jint JNI_OnLoad_iterobjreachobj003(JavaVM *jvm, char *options, void *r } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -177,7 +177,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -193,7 +193,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp index d363e18c754..44ae2c3e327 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,9 +33,9 @@ extern "C" { static jlong timeout = 0; static int fakeUserData = 0, objCounter = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static const char *storage_data = "local_storage_data"; -static void *storage_ptr = NULL; +static void *storage_ptr = nullptr; static const char* debugeeClassSignature = "Lnsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004;"; static const char* objectFieldName = "object"; @@ -75,27 +75,27 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; do { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; - jobject object = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; + jobject object = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", debugeeClassSignature); debugeeClass = nsk_jvmti_classBySignature(debugeeClassSignature); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } NSK_DISPLAY1("Find static field in debugee class: %s\n", objectFieldName); if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID( - debugeeClass, objectFieldName, debugeeClassSignature)) != NULL)) { + debugeeClass, objectFieldName, debugeeClassSignature)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } NSK_DISPLAY1("Find value of static field in debugee class: %s\n", objectFieldName); if (!NSK_JNI_VERIFY(jni, (object = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } @@ -146,7 +146,7 @@ JNIEXPORT jint JNI_OnLoad_iterobjreachobj004(JavaVM *jvm, char *options, void *r } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -154,7 +154,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -170,7 +170,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp index cbba7ba2902..5da3d9fa52c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { /* ============================================================================= */ static jlong timeout = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static int *user_data = 0, objCounter = 0; static jlong nanos = 0; static jvmtiTimerInfo timer_info1, timer_info2; @@ -115,27 +115,27 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { do { NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_EITHER\n"); { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; - jobject object = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; + jobject object = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", debugeeClassSignature); debugeeClass = nsk_jvmti_classBySignature(debugeeClassSignature); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } NSK_DISPLAY1("Find static field in debugee class: %s\n", objectFieldName); if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID( - debugeeClass, objectFieldName, debugeeClassSignature)) != NULL)) { + debugeeClass, objectFieldName, debugeeClassSignature)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } NSK_DISPLAY1("Find value of static field in debugee class: %s\n", objectFieldName); if (!NSK_JNI_VERIFY(jni, (object = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } @@ -175,7 +175,7 @@ JNIEXPORT jint JNI_OnLoad_iterobjreachobj005(JavaVM *jvm, char *options, void *r } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -183,7 +183,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -200,7 +200,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp index 9052297cacf..a30d854ee0d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,7 +63,7 @@ typedef struct ObjectDescStruct { static int chainLength = 0; static int objectsCount = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static int fakeUserData = 0; static int userDataError = 0; @@ -78,7 +78,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jlong tag, int reachable) { int success = NSK_TRUE; - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (reachable ? tag : -tag); if (count <= 0) @@ -87,7 +87,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, count--; tag++; - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -112,16 +112,16 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, /** Obtain all tested objects from debugee class and tag them recursively. */ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; - jobject rootObject = NULL; + jobject rootObject = nullptr; jlong rootObjectTag = 1; jlong chainObjectTag = 100; @@ -145,14 +145,14 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, } NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } NSK_DISPLAY1(" ... found class: 0x%p\n", (void*)debugeeClass); NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -160,7 +160,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -168,7 +168,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID( - debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -176,7 +176,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (reachableChainField = jni->GetFieldID( - rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -184,7 +184,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (unreachableChainField = jni->GetFieldID( - rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -192,7 +192,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -200,7 +200,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -276,7 +276,7 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList) { - if (objectDescList != NULL) { + if (objectDescList != nullptr) { NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescList))) { nsk_jvmti_setFailStatus(); @@ -297,11 +297,11 @@ heapRootCallback(jvmtiHeapRootKind root_kind, if (info & INFO_HEAPROOT) { NSK_DISPLAY4(" heapRootCallback: root_kind=%2d class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (int)root_kind, (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr)); + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr)); } - if (tag_ptr == NULL) { - NSK_COMPLAIN4("NULL tag_ptr is passed to heapRootCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN4("null tag_ptr is passed to heapRootCallback:\n" "# tag_ptr: 0x%p\n" "# root_kind: %d\n" "# class_tag: %ld\n" @@ -313,7 +313,7 @@ heapRootCallback(jvmtiHeapRootKind root_kind, nsk_jvmti_setFailStatus(); } - if (tag_ptr != NULL && *tag_ptr != 0) { + if (tag_ptr != nullptr && *tag_ptr != 0) { int found = 0; int i; @@ -389,12 +389,12 @@ stackReferenceCallback(jvmtiHeapRootKind root_kind, NSK_DISPLAY8(" stackReferenceCallback: root_kind=%1d class_tag=%-3ld size=%-3ld" " *tag_ptr=%-5ld thread_tag=%-3ld depth=%3d method=0x%p slot=%d\n", (int)root_kind, (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr), + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr), (long)thread_tag, (int)depth, (void*)method, (int)slot); } - if (tag_ptr == NULL) { - NSK_COMPLAIN8("NULL tag_ptr is passed to stackReferenceCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN8("null tag_ptr is passed to stackReferenceCallback:\n" "# tag_ptr: 0x%p\n" "# root_kind: %d\n" "# class_tag: %ld\n" @@ -414,7 +414,7 @@ stackReferenceCallback(jvmtiHeapRootKind root_kind, nsk_jvmti_setFailStatus(); } - if (tag_ptr != NULL && *tag_ptr != 0) { + if (tag_ptr != nullptr && *tag_ptr != 0) { int found = 0; int i; @@ -514,12 +514,12 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, NSK_DISPLAY6(" objectReferenceCallback: ref_kind=%1d class_tag=%-3ld size=%-3ld" " *tag_ptr=%-5ld ref_tag=%-5ld ref_idx=%d\n", (int)reference_kind, (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr), + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr), (long)refferrer_tag, (int)refferrer_index); } - if (tag_ptr == NULL) { - NSK_COMPLAIN6("NULL tag_ptr is passed to objectReferenceCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN6("null tag_ptr is passed to objectReferenceCallback:\n" "# tag_ptr: 0x%p\n" "# reference_kind: %d\n" "# class_tag: %ld\n" @@ -535,7 +535,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, nsk_jvmti_setFailStatus(); } - if (tag_ptr != NULL && *tag_ptr != 0) { + if (tag_ptr != nullptr && *tag_ptr != 0) { int found = 0; int i; @@ -670,7 +670,7 @@ JNIEXPORT jint JNI_OnLoad_iterreachobj001(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -679,7 +679,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -704,7 +704,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -717,7 +717,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp index f732196a778..549a1f3370f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,8 +29,8 @@ extern "C" { -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jlong timeout = 0; @@ -446,7 +446,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -477,11 +477,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("enabling JVMTI events ...\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) + nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done.\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp index 2f8ba14ad66..296fddccb97 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ static jlong timeout = 0; static long objCounter = 0; static int userData = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; /* ============================================================================= */ @@ -50,7 +50,7 @@ heapRootCallback(jvmtiHeapRootKind root_kind, jlong* tag_ptr, void* user_data) { - jrawMonitorID monitor_ptr = NULL; + jrawMonitorID monitor_ptr = nullptr; *tag_ptr = (jlong)++objCounter; @@ -114,7 +114,7 @@ stackReferenceCallback(jvmtiHeapRootKind root_kind, jint slot, void* user_data) { - jrawMonitorID monitor_ptr = NULL; + jrawMonitorID monitor_ptr = nullptr; *tag_ptr = (jlong)++objCounter; @@ -177,7 +177,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, jint referrer_index, void* user_data) { - jrawMonitorID monitor_ptr = NULL; + jrawMonitorID monitor_ptr = nullptr; *tag_ptr = (jlong)++objCounter; @@ -285,7 +285,7 @@ JNIEXPORT jint JNI_OnLoad_iterreachobj003(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -293,7 +293,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -309,7 +309,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp index 6557dbf9d5b..b6299fc09cb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,9 +35,9 @@ static jlong timeout = 0; static long objCounter = 0; static int userData = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static const char *storage_data = "local_storage_data"; -static void *storage_ptr = NULL; +static void *storage_ptr = nullptr; /* ============================================================================= */ @@ -226,7 +226,7 @@ JNIEXPORT jint JNI_OnLoad_iterreachobj004(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -234,7 +234,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -250,7 +250,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp index 27137426b19..b3a3a6fc288 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ static jlong timeout = 0; static long objCounter = 0; static int userData = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static jlong nanos = 0; static jvmtiTimerInfo timer_info1, timer_info2; @@ -295,7 +295,7 @@ JNIEXPORT jint JNI_OnLoad_iterreachobj005(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -303,7 +303,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -320,7 +320,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp index 9e1bd12bcc1..b019be65f49 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,7 +81,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { int invocations = 0; NSK_DISPLAY0("Waiting debugee.\n"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) { return; } if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) { @@ -95,7 +95,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { primitive_callbacks.heap_iteration_callback = &heap_callback; NSK_DISPLAY0("Iterating over reachable objects.\n"); - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, &invocations))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, nullptr, &primitive_callbacks, &invocations))) { nsk_jvmti_setFailStatus(); return; } @@ -127,7 +127,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiEventCallbacks event_callbacks; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) { + if (!NSK_VERIFY(jvmti != nullptr)) { return JNI_ERR; } @@ -148,7 +148,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp index 315a07f38e2..b1438acceb0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -368,13 +368,13 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { jobjectArray testObjects; int object; - if (!NSK_VERIFY(NULL != (debugee = jni->FindClass(className)))) + if (!NSK_VERIFY(nullptr != (debugee = jni->FindClass(className)))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (testObjectsField = jni->GetStaticFieldID(debugee, fieldName, fieldSig)))) + if (!NSK_VERIFY(nullptr != (testObjectsField = jni->GetStaticFieldID(debugee, fieldName, fieldSig)))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (testObjects = (jobjectArray)(jni->GetStaticObjectField( + if (!NSK_VERIFY(nullptr != (testObjects = (jobjectArray)(jni->GetStaticObjectField( debugee, testObjectsField))))) return JNI_ERR; @@ -386,13 +386,13 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { jint field; memset(&objects_info[object],0,sizeof(object_info_t)); - if (!NSK_VERIFY(NULL != (target = jni->GetObjectArrayElement(testObjects, object)))) + if (!NSK_VERIFY(nullptr != (target = jni->GetObjectArrayElement(testObjects, object)))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (targetClass = jni->GetObjectClass(target)))) + if (!NSK_VERIFY(nullptr != (targetClass = jni->GetObjectClass(target)))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(targetClass, &(objects_info[object].name), NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(targetClass, &(objects_info[object].name), nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->GetClassFields( @@ -407,7 +407,7 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { targetFields[field], &objects_info[object].fields[field].name, &objects_info[object].fields[field].signature, - NULL))) + nullptr))) return JNI_ERR; if (is_primitive_type(objects_info[object].fields[field].signature)) { objects_info[object].fields[field].primitive = 1; @@ -420,12 +420,12 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { return JNI_ERR; } if (modifiers & STATIC_FIELD) { - if (!NSK_VERIFY(NULL != (value = jni->GetStaticObjectField(targetClass, + if (!NSK_VERIFY(nullptr != (value = jni->GetStaticObjectField(targetClass, targetFields[field])))) { return JNI_ERR; } } else { - if (!NSK_VERIFY(NULL != (value = jni->GetObjectField(target, targetFields[field])))) { + if (!NSK_VERIFY(nullptr != (value = jni->GetObjectField(target, targetFields[field])))) { return JNI_ERR; } } @@ -515,7 +515,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiHeapCallbacks primitive_callbacks; NSK_DISPLAY0("Waiting debugee.\n"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) { return; } if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) { @@ -534,7 +534,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { primitive_callbacks.heap_iteration_callback = &heap_callback; NSK_DISPLAY0("Iterating over reachable objects.\n"); - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, nullptr, &primitive_callbacks, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -551,7 +551,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Iterating over unreachable objects.\n"); - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, nullptr, &primitive_callbacks, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -559,7 +559,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Verifying that all filds were found.\n"); verify_objects(); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { return; } @@ -586,7 +586,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiEventCallbacks event_callbacks; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) { + if (!NSK_VERIFY(jvmti != nullptr)) { return JNI_ERR; } @@ -608,7 +608,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp index 599f95bc479..1886e1cc3d6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -152,16 +152,16 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { jobject testObject; jclass testObjectClass; - if (!NSK_VERIFY(NULL != (debugee = jni->FindClass(className)))) + if (!NSK_VERIFY(nullptr != (debugee = jni->FindClass(className)))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (testObjectField = jni->GetStaticFieldID(debugee, fieldName, fieldSig)))) + if (!NSK_VERIFY(nullptr != (testObjectField = jni->GetStaticFieldID(debugee, fieldName, fieldSig)))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (testObject = (jni->GetStaticObjectField(debugee, testObjectField))))) + if (!NSK_VERIFY(nullptr != (testObject = (jni->GetStaticObjectField(debugee, testObjectField))))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (testObjectClass = (jni->GetObjectClass(testObject))))) + if (!NSK_VERIFY(nullptr != (testObjectClass = (jni->GetObjectClass(testObject))))) return JNI_ERR; // tag class and it's instance to pass this tag into primitive field callback @@ -197,14 +197,14 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiHeapCallbacks primitive_callbacks; jclass klass; - if (!NSK_VERIFY(NULL != (klass = jni->FindClass(testClassName)))) { + if (!NSK_VERIFY(nullptr != (klass = jni->FindClass(testClassName)))) { NSK_COMPLAIN1("Can't find class %s.\n",testClassName); nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY0("Waiting debugee.\n"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) { return; } if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) { @@ -223,7 +223,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { primitive_callbacks.heap_iteration_callback = &heap_callback; NSK_DISPLAY0("Iterating over reachable objects.\n"); - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -240,7 +240,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Iterating over unreachable objects.\n"); - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -269,7 +269,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiEventCallbacks event_callbacks; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) { + if (!NSK_VERIFY(jvmti != nullptr)) { return JNI_ERR; } @@ -291,7 +291,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp index 983aa4a122d..ea3ad39b92a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -294,13 +294,13 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { jobjectArray testObjects; int object; - if (!NSK_VERIFY(NULL != (debugee = jni->FindClass(className)))) + if (!NSK_VERIFY(nullptr != (debugee = jni->FindClass(className)))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (testObjectsField = jni->GetStaticFieldID(debugee, fieldName, fieldSig)))) + if (!NSK_VERIFY(nullptr != (testObjectsField = jni->GetStaticFieldID(debugee, fieldName, fieldSig)))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (testObjects = (jobjectArray)(jni->GetStaticObjectField( + if (!NSK_VERIFY(nullptr != (testObjects = (jobjectArray)(jni->GetStaticObjectField( debugee, testObjectsField))))) return JNI_ERR; @@ -313,13 +313,13 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { int tagged = object == 0; memset(&objects_info[object],0,sizeof(object_info_t)); - if (!NSK_VERIFY(NULL != (target = jni->GetObjectArrayElement(testObjects, object)))) + if (!NSK_VERIFY(nullptr != (target = jni->GetObjectArrayElement(testObjects, object)))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (targetClass = jni->GetObjectClass(target)))) + if (!NSK_VERIFY(nullptr != (targetClass = jni->GetObjectClass(target)))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(targetClass, &(objects_info[object].name), NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(targetClass, &(objects_info[object].name), nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->GetClassFields( @@ -337,7 +337,7 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { targetFields[field], &objects_info[object].fields[field].name, &objects_info[object].fields[field].signature, - NULL))) + nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->GetFieldModifiers( targetClass, targetFields[field], &modifiers))) { @@ -362,12 +362,12 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { return JNI_ERR; } if (is_static) { - if (!NSK_VERIFY(NULL != (value = jni->GetStaticObjectField( + if (!NSK_VERIFY(nullptr != (value = jni->GetStaticObjectField( targetClass, targetFields[field])))) { return JNI_ERR; } } else { - if (!NSK_VERIFY(NULL != (value = jni->GetObjectField(target, targetFields[field])))) { + if (!NSK_VERIFY(nullptr != (value = jni->GetObjectField(target, targetFields[field])))) { return JNI_ERR; } } @@ -456,7 +456,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEventCallbacks event_callbacks; NSK_DISPLAY0("Waiting debugee.\n"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) { return; } if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) { @@ -475,7 +475,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { primitive_callbacks.heap_iteration_callback = &heap_callback; NSK_DISPLAY0("Iterating over reachable objects.\n"); - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(filter_type, NULL, &primitive_callbacks, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(filter_type, nullptr, &primitive_callbacks, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -492,7 +492,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Iterating over unreachable objects.\n"); - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(filter_type, NULL, &primitive_callbacks, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(filter_type, nullptr, &primitive_callbacks, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -533,14 +533,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { const char *type; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) { + if (!NSK_VERIFY(jvmti != nullptr)) { return JNI_ERR; } nsk_jvmti_parseOptions(options); type = nsk_jvmti_findOptionValue("filter"); - if (type != NULL) { + if (type != nullptr) { if (0 == strcmp(type, "JVMTI_HEAP_FILTER_TAGGED")) { filter_type = JVMTI_HEAP_FILTER_TAGGED; } else if (0 == strcmp(type, "JVMTI_HEAP_FILTER_UNTAGGED")) { @@ -574,7 +574,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp index b0617bce297..20515df1b86 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -141,7 +141,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { int i; NSK_DISPLAY0("Waiting debugee.\n"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) { return; } if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) { @@ -156,13 +156,13 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { phase = ZERO_INVOCATIONS_PHASE; for (i = 0; i < FILTER_COUNT; i++) { - if (!NSK_VERIFY(NULL != (klass = jni->FindClass(types[i])))) { + if (!NSK_VERIFY(nullptr != (klass = jni->FindClass(types[i])))) { NSK_COMPLAIN1("Can't find class %s.\n",types[i]); nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1("Iterating through heap with klass-filter '%s'.\n",types[i]); - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -170,12 +170,12 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { phase = STATIC_FIELDS_FINDING_PHASE; NSK_DISPLAY0("Iterating through heap with klass-filter 'java/lang/Class'.\n"); - if (!NSK_VERIFY(NULL != (klass = jni->FindClass("java/lang/Class")))) { + if (!NSK_VERIFY(nullptr != (klass = jni->FindClass("java/lang/Class")))) { NSK_COMPLAIN0("Can't find class java/lang/Class.\n"); nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -209,7 +209,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiEventCallbacks event_callbacks; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) { + if (!NSK_VERIFY(jvmti != nullptr)) { return JNI_ERR; } @@ -230,7 +230,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop001/nframepop001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop001/nframepop001.cpp index 31e569a39aa..50f52d7c0cf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop001/nframepop001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop001/nframepop001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,15 +33,15 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jmethodID mid1, mid2; -static jthread currThread = NULL, popThread = NULL; -static jclass currClass = NULL, popClass = NULL; -static jmethodID currMethod = NULL, popMethod = NULL; +static jthread currThread = nullptr, popThread = nullptr; +static jclass currClass = nullptr, popClass = nullptr; +static jmethodID currMethod = nullptr, popMethod = nullptr; static jboolean currFlag = JNI_FALSE, popFlag = JNI_FALSE; static jint currLoc = 0, popLoc = 0; @@ -133,7 +133,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -190,7 +190,7 @@ Java_nsk_jvmti_NotifyFramePop_nframepop001_getMethIds(JNIEnv *env, jclass cl) { if (caps.can_generate_frame_pop_events) { err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FRAME_POP, NULL); + JVMTI_EVENT_FRAME_POP, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable FRAME_POP event: %s (%d)\n", TranslateError(err), err); @@ -200,14 +200,14 @@ Java_nsk_jvmti_NotifyFramePop_nframepop001_getMethIds(JNIEnv *env, jclass cl) { } mid1 = env->GetMethodID(cl, "meth01", "(I)V"); - if (mid1 == NULL) { + if (mid1 == nullptr) { printf("Cannot find method \"meth01\"\n"); result = STATUS_FAILED; return; } mid2 = env->GetMethodID(cl, "meth02", "(I)V"); - if (mid2 == NULL) { + if (mid2 == nullptr) { printf("Cannot find method \"meth02\"\n"); result = STATUS_FAILED; return; @@ -215,7 +215,7 @@ Java_nsk_jvmti_NotifyFramePop_nframepop001_getMethIds(JNIEnv *env, jclass cl) { if (caps.can_generate_exception_events) { err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_EXCEPTION_CATCH, NULL); + JVMTI_EVENT_EXCEPTION_CATCH, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable EXCEPTION_CATCH event: %s (%d)\n", TranslateError(err), err); @@ -245,7 +245,7 @@ Java_nsk_jvmti_NotifyFramePop_nframepop001_setFramePopNotif(JNIEnv *env, currThread = env->NewGlobalRef(thr); currClass = env->FindClass("nsk/jvmti/NotifyFramePop/nframepop001a"); - if (currClass == NULL) { + if (currClass == nullptr) { printf("Cannot find nsk.jvmti.NotifyFramePop.nframepop001a class!\n"); result = STATUS_FAILED; return; @@ -253,7 +253,7 @@ Java_nsk_jvmti_NotifyFramePop_nframepop001_setFramePopNotif(JNIEnv *env, currClass = (jclass) env->NewGlobalRef(currClass); currMethod = env->GetMethodID(currClass, "run", "()V"); - if (currMethod == NULL) { + if (currMethod == nullptr) { printf("Cannot find method \"run\"\n"); result = STATUS_FAILED; } @@ -319,9 +319,9 @@ Java_nsk_jvmti_NotifyFramePop_nframepop001_checkFrame(JNIEnv *env, result = STATUS_FAILED; } - currThread = NULL; popThread = NULL; - currClass = NULL; popClass = NULL; - currMethod = NULL; popMethod = NULL; + currThread = nullptr; popThread = nullptr; + currClass = nullptr; popClass = nullptr; + currMethod = nullptr; popMethod = nullptr; currFlag = JNI_FALSE; popFlag = JNI_FALSE; currLoc = 0; popLoc = 0; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop002/nframepop002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop002/nframepop002.cpp index 8faa9177cb5..09f6da40b33 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop002/nframepop002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop002/nframepop002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -91,7 +91,7 @@ Java_nsk_jvmti_NotifyFramePop_nframepop002_check(JNIEnv *env, jclass cls, jthread thread) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop003/nframepop003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop003/nframepop003.cpp index 201a7cd26b9..325eb23f3b9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop003/nframepop003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop003/nframepop003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -91,7 +91,7 @@ Java_nsk_jvmti_NotifyFramePop_nframepop003_check(JNIEnv *env, jclass cls, jthread thread) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp index 2a14eee0629..b81c2c9a43e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ extern "C" { static const char *CLASS_SIG = "Lnsk/jvmti/ObjectFree/objfree001u;"; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static volatile jint result = PASSED; @@ -131,7 +131,7 @@ static void memoryFunc(jvmtiEnv *jvmti_env, const char *msg) { } static void envStorageFunc(jvmtiEnv *jvmti_env, const char *msg) { - LocalStorage* obtainedData = NULL; + LocalStorage* obtainedData = nullptr; LocalStorage* storedData = &stor; NSK_DISPLAY2("%s: setting an environment local storage 0x%p ...\n", @@ -253,7 +253,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to generate compiled method events */ @@ -282,11 +282,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, - NULL))) + nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) + nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp index 7e1be9da537..c3fc8621feb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ extern "C" { #define MEM_SIZE 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -161,7 +161,7 @@ static void memoryFunc(jvmtiEnv *jvmti_env, const char *msg) { } static void envStorageFunc(jvmtiEnv *jvmti_env, const char *msg) { - LocalStorage* obtainedData = NULL; + LocalStorage* obtainedData = nullptr; LocalStorage* storedData = &stor; NSK_DISPLAY2("%s: setting an environment local storage 0x%p ...\n", @@ -273,7 +273,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to generate compiled method events */ @@ -302,11 +302,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, - NULL))) + nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) + nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp index 4d3332c2079..661219e3174 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define STATUS_FAILED 2 #define PASSED 0 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static int watch_ev = 0; /* ignore JVMTI events by default */ @@ -175,7 +175,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp index 429af71866a..6be72a9ee18 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -102,12 +102,12 @@ Java_nsk_jvmti_PopFrame_popframe002_doPopFrame(JNIEnv *env, } switch (t_case) { - /* NULL pointer to the thread*/ + /* nullptr pointer to the thread*/ case 1: - printf("\nInvoke PopFrame() with NULL pointer to a thread...\n"); + printf("\nInvoke PopFrame() with null pointer to a thread...\n"); fflush(stdout); set_watch_ev(1); /* watch JVMTI events */ - err = (jvmti->PopFrame(NULL)); /* explode the bomb */ + err = (jvmti->PopFrame(nullptr)); /* explode the bomb */ if (err != JVMTI_ERROR_INVALID_THREAD) { printf("TEST FAILED: the function PopFrame() returned the error %d: %s\n", err, TranslateError(err)); @@ -193,7 +193,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp index f956c01f3aa..958d14a52c2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -177,7 +177,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp index 3c8f1743d0d..46457aced4d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -219,7 +219,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -286,10 +286,10 @@ Java_nsk_jvmti_PopFrame_popframe004_getResult(JNIEnv *env, jclass cls) { void nativeMeth2(JNIEnv *env, jobject obj, jobject frameThr) { jclass cls = env->GetObjectClass(frameThr); - jmethodID mid = NULL; + jmethodID mid = nullptr; mid = env->GetMethodID(cls, "activeMethod", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("TEST FAILURE: nativeMeth2(): Unable to get method ID\n"); tot_result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp index ca918df7575..089c4dd5514 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { // Deallocate memory region allocated by VM #define DEALLOCATE(p) \ - if (p != NULL) \ + if (p != nullptr) \ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(p))) \ { \ NSK_COMPLAIN0("Failed to deallocate: ##p##\n"); \ @@ -106,12 +106,12 @@ MethodExit( break; } - if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &class_signature, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &class_signature, nullptr))) { break; } - if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(method, &entry_name, &entry_sig, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(method, &entry_name, &entry_sig, nullptr))) { break; } @@ -119,7 +119,7 @@ MethodExit( failure = 0; NSK_COMPLAIN5("#### MethodExit event occurred: (tid: %d), thread: %s, %s %s %s\n" , thread - , thr_info.name == NULL ? "" : thr_info.name + , thr_info.name == nullptr ? "" : thr_info.name , class_signature , entry_name , entry_sig @@ -254,7 +254,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) } if (!NSK_VERIFY( - (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL + (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr )) { return JNI_ERR; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe006/popframe006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe006/popframe006.cpp index 2c288f29d94..324160b40d7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe006/popframe006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe006/popframe006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ typedef struct { jlocation loc; } check_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -109,17 +109,17 @@ void check(jvmtiEnv *jvmti_env, jmethodID mid, jlocation loc, int i) { return; } - if (sigClass == NULL || strcmp(sigClass, checks[i].cls) != 0) { + if (sigClass == nullptr || strcmp(sigClass, checks[i].cls) != 0) { printf("(%s, %d) wrong class sig: \"%s\",\n", note, i, sigClass); printf(" expected: \"%s\"\n", checks[i].cls); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, checks[i].name) != 0) { + if (name == nullptr || strcmp(name, checks[i].name) != 0) { printf("(%s, %d) wrong method name: \"%s\",", note, i, name); printf(" expected: \"%s\"\n", checks[i].name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, checks[i].sig) != 0) { + if (sig == nullptr || strcmp(sig, checks[i].sig) != 0) { printf("(%s, %d) wrong method sig: \"%s\",", note, i, sig); printf(" expected: \"%s\"\n", checks[i].sig); result = STATUS_FAILED; @@ -349,12 +349,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -409,7 +409,7 @@ Java_nsk_jvmti_PopFrame_popframe006_getReady(JNIEnv *env, jvmtiError err; jclass clazz; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -424,35 +424,35 @@ Java_nsk_jvmti_PopFrame_popframe006_getReady(JNIEnv *env, } clazz = env->GetObjectClass(thr); - if (clazz == NULL) { + if (clazz == nullptr) { printf("Cannot get the class of thread object\n"); result = STATUS_FAILED; return; } mid_run = env->GetMethodID(clazz, "run", "()V"); - if (mid_run == NULL) { + if (mid_run == nullptr) { printf("Cannot find Method ID for method \"run\"\n"); result = STATUS_FAILED; return; } mid_A = env->GetStaticMethodID(clazz, "A", "()V"); - if (mid_A == NULL) { + if (mid_A == nullptr) { printf("Cannot find Method ID for method \"A\"\n"); result = STATUS_FAILED; return; } mid_B = env->GetStaticMethodID(clazz, "B", "()V"); - if (mid_B == NULL) { + if (mid_B == nullptr) { printf("Cannot find Method ID for method \"B\"\n"); result = STATUS_FAILED; return; } mid_C = env->GetStaticMethodID(clazz, "C", "()V"); - if (mid_C == NULL) { + if (mid_C == nullptr) { printf("Cannot find Method ID for method \"C\"\n"); result = STATUS_FAILED; return; @@ -467,7 +467,7 @@ Java_nsk_jvmti_PopFrame_popframe006_getReady(JNIEnv *env, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); @@ -481,7 +481,7 @@ Java_nsk_jvmti_PopFrame_popframe006_getReady(JNIEnv *env, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FRAME_POP, NULL); + JVMTI_EVENT_FRAME_POP, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable FRAME_POP event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe007/popframe007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe007/popframe007.cpp index ca4b9004595..db699216695 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe007/popframe007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe007/popframe007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -86,12 +86,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -142,7 +142,7 @@ Java_nsk_jvmti_PopFrame_popframe007_getReady(JNIEnv *env, jvmtiError err; jclass clazz; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -153,14 +153,14 @@ Java_nsk_jvmti_PopFrame_popframe007_getReady(JNIEnv *env, } clazz = env->GetObjectClass(thr); - if (clazz == NULL) { + if (clazz == nullptr) { printf("Cannot get class of the thread object\n"); result = STATUS_FAILED; return; } mid = env->GetStaticMethodID(clazz, "C", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for method \"C\"\n"); result = STATUS_FAILED; return; @@ -175,7 +175,7 @@ Java_nsk_jvmti_PopFrame_popframe007_getReady(JNIEnv *env, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); @@ -190,7 +190,7 @@ Java_nsk_jvmti_PopFrame_popframe007_getRes(JNIEnv *env, jclass cls) { JNIEXPORT void JNICALL Java_nsk_jvmti_PopFrame_popframe007_B(JNIEnv *env, jclass cls) { - if (mid != NULL) { + if (mid != nullptr) { env->CallStaticVoidMethod(cls, mid); } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe008/popframe008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe008/popframe008.cpp index 8c669c20318..430f19624d0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe008/popframe008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe008/popframe008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,13 +40,13 @@ typedef struct { jlocation loc; } frame_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jmethodID midD = NULL; -static jmethodID midRun = NULL; +static jmethodID midD = nullptr; +static jmethodID midRun = nullptr; static int framesExpected = 0; static int framesCount = 0; static frame_info frames[] = { @@ -83,17 +83,17 @@ void check(jvmtiEnv *jvmti_env, jmethodID mid, jlocation loc, int i) { result = STATUS_FAILED; } - if (sigClass == NULL || strcmp(sigClass, frames[i].cls) != 0) { + if (sigClass == nullptr || strcmp(sigClass, frames[i].cls) != 0) { printf("(%d) wrong class sig: \"%s\",\n", i, sigClass); printf(" expected: \"%s\"\n", frames[i].cls); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, frames[i].name) != 0) { + if (name == nullptr || strcmp(name, frames[i].name) != 0) { printf("(%d) wrong method name: \"%s\",", i, name); printf(" expected: \"%s\"\n", frames[i].name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, frames[i].sig) != 0) { + if (sig == nullptr || strcmp(sig, frames[i].sig) != 0) { printf("(%d) wrong method sig: \"%s\",", i, sig); printf(" expected: \"%s\"\n", frames[i].sig); result = STATUS_FAILED; @@ -195,12 +195,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -253,7 +253,7 @@ Java_nsk_jvmti_PopFrame_popframe008_getReady(JNIEnv *env, jvmtiError err; jclass clazz; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -266,21 +266,21 @@ Java_nsk_jvmti_PopFrame_popframe008_getReady(JNIEnv *env, } clazz = env->GetObjectClass(thr); - if (clazz == NULL) { + if (clazz == nullptr) { printf("Cannot get class of the thread object\n"); result = STATUS_FAILED; return; } midD = env->GetMethodID(clazz, "D", "()V"); - if (midD == NULL) { + if (midD == nullptr) { printf("Cannot get Method ID for method \"D\"\n"); result = STATUS_FAILED; return; } midRun = env->GetMethodID(clazz, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot get Method ID for method \"run\"\n"); result = STATUS_FAILED; return; @@ -295,7 +295,7 @@ Java_nsk_jvmti_PopFrame_popframe008_getReady(JNIEnv *env, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe009/popframe009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe009/popframe009.cpp index 2e72d3858b3..c15146e660f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe009/popframe009.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe009/popframe009.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,17 +34,17 @@ extern "C" { #define STATUS_FAILED 2 #define WAIT_FOREVER ((jlong)(3600*1000)) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; -static jrawMonitorID breakpointLock = NULL; -static jrawMonitorID popFrameLock = NULL; -static jrawMonitorID suspendLock = NULL; +static jrawMonitorID breakpointLock = nullptr; +static jrawMonitorID popFrameLock = nullptr; +static jrawMonitorID suspendLock = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jboolean popDone = JNI_FALSE; -static jmethodID midCheckPoint = NULL; -static jmethodID midRun = NULL; +static jmethodID midCheckPoint = nullptr; +static jmethodID midRun = nullptr; static int bpCount = 0; static int framesCount = 0; @@ -165,12 +165,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -225,7 +225,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_PopFrame_popframe009_getReady(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -238,7 +238,7 @@ Java_nsk_jvmti_PopFrame_popframe009_getReady(JNIEnv *env, jclass cls) { } midCheckPoint = env->GetStaticMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); result = STATUS_FAILED; return; @@ -261,7 +261,7 @@ Java_nsk_jvmti_PopFrame_popframe009_getReady(JNIEnv *env, jclass cls) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); @@ -331,14 +331,14 @@ Java_nsk_jvmti_PopFrame_popframe009_check(JNIEnv *env, jclass cls, jthread thr) jvmtiError err; jmethodID midFibonacci; jclass clazz; - jmethodID method = NULL; + jmethodID method = nullptr; jlocation loc; char *name, *sig, *generic; jlong delayTime = 1; int popCount = 0; int i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -412,19 +412,19 @@ Java_nsk_jvmti_PopFrame_popframe009_check(JNIEnv *env, jclass cls, jthread thr) } midFibonacci = env->GetStaticMethodID(cls, "fibonacci", "(I)I"); - if (midFibonacci == NULL) { + if (midFibonacci == nullptr) { printf("Cannot get method ID for method \"fibonacci\"\n"); result = STATUS_FAILED; } clazz = env->GetObjectClass(thr); - if (clazz == NULL) { + if (clazz == nullptr) { printf("Cannot get class of thread object\n"); return STATUS_FAILED; } midRun = env->GetMethodID(clazz, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot get method ID for \"run\"\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe010/popframe010.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe010/popframe010.cpp index c0b3f8924fd..68e0aa7c7bd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe010/popframe010.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe010/popframe010.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,13 +33,13 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jmethodID midCheckPoint = NULL; -static jmethodID midRun = NULL; +static jmethodID midCheckPoint = nullptr; +static jmethodID midRun = nullptr; static jint framesExpected = 0; static jint framesCount = 0; static const char *cls_exp = "Lnsk/jvmti/PopFrame/popframe010$TestThread;"; @@ -52,7 +52,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jlocation loc, jint jclass cls; jlocation loc_exp = (i == 0) ? 15 : 8; char *sigClass, *name, *sig, *generic; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jint argValue; jint j; @@ -85,7 +85,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jlocation loc, jint i, TranslateError(err), err); result = STATUS_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, argName) == 0) { err = jvmti_env->GetLocalInt(thr, 0, @@ -105,17 +105,17 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jlocation loc, jint printf(", arg value: %d\n", argValue); } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(step %d) wrong class sig: \"%s\",\n", i, sigClass); printf(" expected: \"%s\"\n", cls_exp); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, name_exp) != 0) { + if (name == nullptr || strcmp(name, name_exp) != 0) { printf("(step %d) wrong method name: \"%s\",", i, name); printf(" expected: \"%s\"\n", name_exp); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, sig_exp) != 0) { + if (sig == nullptr || strcmp(sig, sig_exp) != 0) { printf("(step %d) wrong method sig: \"%s\",", i, sig); printf(" expected: \"%s\"\n", sig_exp); result = STATUS_FAILED; @@ -132,16 +132,16 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jlocation loc, jint result = STATUS_FAILED; } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -232,12 +232,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -288,7 +288,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_PopFrame_popframe010_getReady(JNIEnv *env, jclass c, jclass cls, jint depth) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -301,14 +301,14 @@ Java_nsk_jvmti_PopFrame_popframe010_getReady(JNIEnv *env, jclass c, jclass cls, } midRun = env->GetMethodID(cls, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); result = STATUS_FAILED; return; } midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); result = STATUS_FAILED; return; @@ -323,7 +323,7 @@ Java_nsk_jvmti_PopFrame_popframe010_getReady(JNIEnv *env, jclass c, jclass cls, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp index 114f7cd1d71..32bf69ea853 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -111,15 +111,15 @@ Java_nsk_jvmti_PopFrame_popframe011_doPopFrame(JNIEnv *env, } switch (t_case) { -/* NULL pointer to the thread in debug mode */ +/* nullptr pointer to the thread in debug mode */ case 1: - printf("\nInvoke PopFrame() with NULL pointer to a thread...\n"); + printf("\nInvoke PopFrame() with null pointer to a thread...\n"); fflush(stdout); // fallthrough -/* NULL pointer to the thread */ +/* nullptr pointer to the thread */ case 0: set_watch_ev(1); /* watch JVMTI events */ - popframe_err = (jvmti->PopFrame(NULL)); /* explode the bomb */ + popframe_err = (jvmti->PopFrame(nullptr)); /* explode the bomb */ if (popframe_err != JVMTI_ERROR_INVALID_THREAD) { printf("TEST FAILED: the function PopFrame() returned the error %d: %s\n", popframe_err, TranslateError(popframe_err)); @@ -245,7 +245,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter001/rawmonenter001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter001/rawmonenter001.cpp index 337de1e3cc8..aeb2f3c4cd7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter001/rawmonenter001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter001/rawmonenter001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define RAW_MONITORS_NUMBER 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -102,12 +102,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -121,7 +121,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter002/rawmonenter002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter002/rawmonenter002.cpp index 8588fa65636..790cafb1cfc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter002/rawmonenter002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter002/rawmonenter002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_rawmonenter002(JavaVM *jvm, char *options, void *reser jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorEnter_rawmonenter002_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_RawMonitorEnter_rawmonenter002_check(JNIEnv *env, jclass cls) { printf(">>> invalid monitor check ...\n"); } - err = jvmti->RawMonitorEnter(NULL); + err = jvmti->RawMonitorEnter(nullptr); if (err != JVMTI_ERROR_INVALID_MONITOR) { printf("Error expected: JVMTI_ERROR_INVALID_MONITOR,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter003/rawmonenter003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter003/rawmonenter003.cpp index 984c73cb0f7..36aaa1cdbfb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter003/rawmonenter003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter003/rawmonenter003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static char bad_buf[] = "this is a bad raw monitor"; @@ -53,12 +53,12 @@ JNIEXPORT jint JNI_OnLoad_rawmonenter003(JavaVM *jvm, char *options, void *reser jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorEnter_rawmonenter003_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter004/rawmonenter004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter004/rawmonenter004.cpp index 2c9fdb8f2f0..b2c5b8a929f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter004/rawmonenter004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter004/rawmonenter004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ extern "C" { #define INCREMENT_LIMIT 1000 #define DELAY 100 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jrawMonitorID monitor; @@ -57,12 +57,12 @@ JNIEXPORT jint JNI_OnLoad_rawmonenter004(JavaVM *jvm, char *options, void *reser jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -104,7 +104,7 @@ Java_nsk_jvmti_RawMonitorEnter_rawmonenter004_check(JNIEnv *env, jclass cls, job jthread thr; jint wait_time = wtime * 60000; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -131,7 +131,7 @@ Java_nsk_jvmti_RawMonitorEnter_rawmonenter004_check(JNIEnv *env, jclass cls, job for (i = 0; i < threads_limit; i++) { thr = env->GetObjectArrayElement(threads, i); - err = jvmti->RunAgentThread(thr, increment_thread, NULL, + err = jvmti->RunAgentThread(thr, increment_thread, nullptr, JVMTI_THREAD_NORM_PRIORITY); if (err != JVMTI_ERROR_NONE) { printf("(RunDebugThread) unexpected error: %s (%d)\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit001/rawmonexit001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit001/rawmonexit001.cpp index 6fcd8db139e..fd1a2c47f6a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit001/rawmonexit001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit001/rawmonexit001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define RAW_MONITORS_NUMBER 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -115,12 +115,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -134,7 +134,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit002/rawmonexit002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit002/rawmonexit002.cpp index b378bef82df..50fed1c7f1a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit002/rawmonexit002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit002/rawmonexit002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_rawmonexit002(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorExit_rawmonexit002_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_RawMonitorExit_rawmonexit002_check(JNIEnv *env, jclass cls) { printf(">>> invalid monitor check ...\n"); } - err = jvmti->RawMonitorExit(NULL); + err = jvmti->RawMonitorExit(nullptr); if (err != JVMTI_ERROR_INVALID_MONITOR) { printf("Error expected: JVMTI_ERROR_INVALID_MONITOR,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit003/rawmonexit003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit003/rawmonexit003.cpp index 2c9a1847c3b..31221547a08 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit003/rawmonexit003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit003/rawmonexit003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static char bad_buf[] = "this is a bad raw monitor"; @@ -53,12 +53,12 @@ JNIEXPORT jint JNI_OnLoad_rawmonexit003(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorExit_rawmonexit003_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit005/rawmonexit005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit005/rawmonexit005.cpp index 58c60ca1561..11b8a83e03b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit005/rawmonexit005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit005/rawmonexit005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_rawmonexit005(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_RawMonitorExit_rawmonexit005_check(JNIEnv *env, jclass cls) { jvmtiError err; jrawMonitorID monitor; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy001/rawmnntfy001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy001/rawmnntfy001.cpp index f0824faf11c..d7070469880 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy001/rawmnntfy001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy001/rawmnntfy001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define RAW_MONITORS_NUMBER 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -128,12 +128,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -147,7 +147,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy002/rawmnntfy002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy002/rawmnntfy002.cpp index a06fd549572..5900fa46ac8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy002/rawmnntfy002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy002/rawmnntfy002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnntfy002(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorNotify_rawmnntfy002_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_RawMonitorNotify_rawmnntfy002_check(JNIEnv *env, jclass cls) { printf(">>> invalid monitor check ...\n"); } - err = jvmti->RawMonitorNotify(NULL); + err = jvmti->RawMonitorNotify(nullptr); if (err != JVMTI_ERROR_INVALID_MONITOR) { printf("Error expected: JVMTI_ERROR_INVALID_MONITOR,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy003/rawmnntfy003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy003/rawmnntfy003.cpp index 0250ed50ae7..2ab8362bd13 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy003/rawmnntfy003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy003/rawmnntfy003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static char bad_buf[] = "this is a bad raw monitor"; @@ -53,12 +53,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnntfy003(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorNotify_rawmnntfy003_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy004/rawmnntfy004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy004/rawmnntfy004.cpp index 5e210000407..259f0b526b3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy004/rawmnntfy004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy004/rawmnntfy004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnntfy004(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_RawMonitorNotify_rawmnntfy004_check(JNIEnv *env, jclass cls) { jvmtiError err; jrawMonitorID monitor; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall001/rawmnntfyall001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall001/rawmnntfyall001.cpp index c669763560d..42da7b3606c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall001/rawmnntfyall001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall001/rawmnntfyall001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define RAW_MONITORS_NUMBER 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -128,12 +128,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -147,7 +147,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall002/rawmnntfyall002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall002/rawmnntfyall002.cpp index 6801be39731..74559aefd80 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall002/rawmnntfyall002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall002/rawmnntfyall002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnntfyall002(JavaVM *jvm, char *options, void *rese jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorNotifyAll_rawmnntfyall002_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_RawMonitorNotifyAll_rawmnntfyall002_check(JNIEnv *env, jclass cls printf(">>> invalid monitor check ...\n"); } - err = jvmti->RawMonitorNotifyAll(NULL); + err = jvmti->RawMonitorNotifyAll(nullptr); if (err != JVMTI_ERROR_INVALID_MONITOR) { printf("Error expected: JVMTI_ERROR_INVALID_MONITOR,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall003/rawmnntfyall003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall003/rawmnntfyall003.cpp index b5bfb676385..71aaa848a74 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall003/rawmnntfyall003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall003/rawmnntfyall003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static char bad_buf[] = "this is a bad raw monitor"; @@ -53,12 +53,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnntfyall003(JavaVM *jvm, char *options, void *rese jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorNotifyAll_rawmnntfyall003_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall004/rawmnntfyall004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall004/rawmnntfyall004.cpp index 96c0a2545d7..163d46e9e54 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall004/rawmnntfyall004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall004/rawmnntfyall004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnntfyall004(JavaVM *jvm, char *options, void *rese jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_RawMonitorNotifyAll_rawmnntfyall004_check(JNIEnv *env, jclass cls jvmtiError err; jrawMonitorID monitor; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait001/rawmnwait001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait001/rawmnwait001.cpp index 155e4e7e513..589090ba211 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait001/rawmnwait001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait001/rawmnwait001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ extern "C" { #define RAW_MONITORS_NUMBER 1024 #define MONITOR_WAIT_TIMEOUT ((jlong)10) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -129,12 +129,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -148,7 +148,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait002/rawmnwait002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait002/rawmnwait002.cpp index 2b2ad239c16..f0efca275f3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait002/rawmnwait002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait002/rawmnwait002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define MONITOR_WAIT_TIMEOUT ((jlong)100) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -52,12 +52,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnwait002(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorWait_rawmnwait002_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -78,7 +78,7 @@ Java_nsk_jvmti_RawMonitorWait_rawmnwait002_check(JNIEnv *env, jclass cls) { printf(">>> invalid monitor check ...\n"); } - err = jvmti->RawMonitorWait(NULL, MONITOR_WAIT_TIMEOUT); + err = jvmti->RawMonitorWait(nullptr, MONITOR_WAIT_TIMEOUT); if (err != JVMTI_ERROR_INVALID_MONITOR) { printf("Error expected: JVMTI_ERROR_INVALID_MONITOR,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait003/rawmnwait003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait003/rawmnwait003.cpp index c4d307dbcc7..74778ffcadf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait003/rawmnwait003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait003/rawmnwait003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define MONITOR_WAIT_TIMEOUT ((jlong)100) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static char bad_buf[] = "this is a bad raw monitor"; @@ -54,12 +54,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnwait003(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -71,7 +71,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorWait_rawmnwait003_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait004/rawmnwait004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait004/rawmnwait004.cpp index e1e7db5c7b8..c356e9007e6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait004/rawmnwait004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait004/rawmnwait004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define MONITOR_WAIT_TIMEOUT ((jlong)100) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -52,12 +52,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnwait004(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_RawMonitorWait_rawmnwait004_check(JNIEnv *env, jclass cls) { jvmtiError err; jrawMonitorID monitor; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait005/rawmnwait005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait005/rawmnwait005.cpp index ba861bd9757..4df5817fcb5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait005/rawmnwait005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait005/rawmnwait005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define MILLIS_PER_MINUTE (60 * 1000) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_TRUE; @@ -57,12 +57,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -206,7 +206,7 @@ Java_nsk_jvmti_RawMonitorWait_rawmnwait005_check(JNIEnv *env, wait_time = wtime * MILLIS_PER_MINUTE; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -261,7 +261,7 @@ Java_nsk_jvmti_RawMonitorWait_rawmnwait005_check(JNIEnv *env, // before we terminate - else the test will end before it checks // it was interrupted! - err = jvmti->RunAgentThread(thr, test_thread, NULL, + err = jvmti->RunAgentThread(thr, test_thread, nullptr, JVMTI_THREAD_NORM_PRIORITY); if (err != JVMTI_ERROR_NONE) { printf("(RunDebugThread) unexpected error: %s (%d)\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp index e186ee1be6a..56f5e5af1fe 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define STATUS_FAILED 2 #define PASSED 0 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { @@ -80,7 +80,7 @@ Java_nsk_jvmti_RedefineClasses_StressRedefine_makeRedefinition(JNIEnv *env, jvmtiClassDefinition classDef; jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -92,7 +92,7 @@ Java_nsk_jvmti_RedefineClasses_StressRedefine_makeRedefinition(JNIEnv *env, /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (fl == 2) { printf(">>>>>>>> Invoke RedefineClasses():\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp index 0bf04741b57..8b1992d011c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define STATUS_FAILED 2 #define PASSED 0 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; #ifdef STATIC_BUILD @@ -91,7 +91,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass001_makeRedefinition(JNIEnv *env, jvmtiClassDefinition classDef; jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -103,7 +103,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass001_makeRedefinition(JNIEnv *env, /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (fl == 2) { printf(">>>>>>>> Invoke RedefineClasses():\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp index 2ad16a006bb..31732b1566f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define STATUS_FAILED 2 #define PASSED 0 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; #ifdef STATIC_BUILD @@ -133,7 +133,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass002_makeRedefinition(JNIEnv *env, jclas jvmtiClassDefinition classDef; jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -145,7 +145,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass002_makeRedefinition(JNIEnv *env, jclas /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (vrb == 1) printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp index 77fbacb64cd..44654ac13ef 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ extern "C" { #define PASSED 0 #define NO_RESULTS 3 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; #ifdef STATIC_BUILD @@ -94,7 +94,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass003_makeRedefinition(JNIEnv *env, jclas jvmtiClassDefinition classDef; int no_results = 0; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -106,7 +106,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass003_makeRedefinition(JNIEnv *env, jclas /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (vrb == 1) printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n", @@ -140,7 +140,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass003_checkNewFields(JNIEnv *env, jlong longFld; fid = env->GetStaticFieldID(redefCls, "intComplNewFld", "I"); - if (fid == NULL) { + if (fid == nullptr) { printf("%s: Failed to get the field ID for the static field \"intComplNewFld\"\n", __FILE__); return STATUS_FAILED; @@ -148,7 +148,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass003_checkNewFields(JNIEnv *env, intFld = env->GetStaticIntField(redefCls, fid); fid = env->GetStaticFieldID(redefCls, "longComplNewFld", "J"); - if (fid == NULL) { + if (fid == nullptr) { printf("%s: Failed to get the field ID for the static field \"longComplNewFld\"\n", __FILE__); return STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp index baef48d901e..68ca36f6959 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ static jint INTFLD = 333; static jlong LONGFLD = 444; #define STRFLD "completely new String field" -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; #ifdef STATIC_BUILD @@ -99,7 +99,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass004_makeRedefinition(JNIEnv *env, jvmtiClassDefinition classDef; int no_results = 0; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -111,7 +111,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass004_makeRedefinition(JNIEnv *env, /* fill the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (vrb == 1) printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n", @@ -146,11 +146,11 @@ Java_nsk_jvmti_RedefineClasses_redefclass004_checkNewFields(JNIEnv *env, jint intFld; jlong longFld; jstring stringObj; - const char *strFld = NULL; + const char *strFld = nullptr; /* get value of new instance field "intComplNewFld" */ fid = env->GetFieldID(redefCls, "intComplNewFld", "I"); - if (fid == NULL) { + if (fid == nullptr) { printf("%s: Failed to get the field ID for the field \"intComplNewFld\"\n", __FILE__); return STATUS_FAILED; @@ -159,7 +159,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass004_checkNewFields(JNIEnv *env, /* get value of new instance field "longComplNewFld" */ fid = env->GetFieldID(redefCls, "longComplNewFld", "J"); - if (fid == NULL) { + if (fid == nullptr) { printf("%s: Failed to get the field ID for the field \"longComplNewFld\"\n", __FILE__); return STATUS_FAILED; @@ -168,7 +168,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass004_checkNewFields(JNIEnv *env, /* get value of new instance field "stringComplNewFld" */ fid = env->GetFieldID(redefCls, "stringComplNewFld", "Ljava/lang/String;"); - if (fid == NULL) { + if (fid == nullptr) { printf("%s: Failed to get the field ID for the field \"stringComplNewFld\"\n", __FILE__); return STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp index 6e932a9551f..0e7d2703eb3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define STATUS_FAILED 2 #define PASSED 0 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static int watch_ev = 0; /* ignore JVMTI events by default */ @@ -59,7 +59,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *env, jclass class_being_redefined jvmti->RawMonitorEnter(watch_ev_monitor); - if (watch_ev && class_being_redefined != NULL) { + if (watch_ev && class_being_redefined != nullptr) { printf("#### JVMTI_EVENT_CLASS_FILE_LOAD_HOOK occurred ####\n"); CFLH_gen_ev++; } @@ -164,7 +164,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass005_makeRedefinition(JNIEnv *env, jthread thread; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -180,7 +180,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass005_makeRedefinition(JNIEnv *env, return STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable event JVMTI_EVENT_CLASS_FILE_LOAD_HOOK: %s (%d)\n", TranslateError(err), err); @@ -202,7 +202,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass005_makeRedefinition(JNIEnv *env, /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); set_watch_ev(1); /* watch JVMTI events */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp index 7f140b73182..9eea0a6e2d7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define STATUS_FAILED 2 #define PASSED 0 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; #ifdef STATIC_BUILD @@ -90,9 +90,9 @@ Java_nsk_jvmti_RedefineClasses_redefclass006_makeRedefinition(JNIEnv *env, jclass cls, jint t_case, jclass redefCls, jbyteArray classBytes) { jvmtiError err; jvmtiClassDefinition classDef; - jvmtiClassDefinition* classDefPtr = NULL; + jvmtiClassDefinition* classDefPtr = nullptr; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -102,25 +102,25 @@ Java_nsk_jvmti_RedefineClasses_redefclass006_makeRedefinition(JNIEnv *env, } switch (t_case) { -/* NULL pointer to the jvmtiClassDefinition */ +/* nullptr pointer to the jvmtiClassDefinition */ case 0: break; -/* NULL pointer to the jvmtiClassDefinition in debug mode */ +/* nullptr pointer to the jvmtiClassDefinition in debug mode */ case 1: - printf("Invoke RedefineClasses() with NULL pointer to the structure jvmtiClassDefinition\n"); + printf("Invoke RedefineClasses() with null pointer to the structure jvmtiClassDefinition\n"); fflush(stdout); break; -/* NULL pointer to the jvmtiClassDefinition->class_bytes in debug mode */ +/* nullptr pointer to the jvmtiClassDefinition->class_bytes in debug mode */ case 3: - printf("Invoke RedefineClasses() with NULL pointer to the field jvmtiClassDefinition->class_bytes\n"); + printf("Invoke RedefineClasses() with null pointer to the field jvmtiClassDefinition->class_bytes\n"); fflush(stdout); // fallthrough -/* NULL pointer to the jvmtiClassDefinition->class_bytes */ +/* nullptr pointer to the jvmtiClassDefinition->class_bytes */ case 2: /* partly fill the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = NULL; + classDef.class_bytes = nullptr; classDefPtr = &classDef; break; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp index a5ac03291ab..92094c887bd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,16 +45,16 @@ typedef struct { /* list of breakpoints */ static breakpoint breakpoints[] = { - { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 0, NULL }, - { 1, (char*) "finMethod", (char*) "(JIJ)V", 5, NULL }, - { 1, (char*) "finMethod", (char*) "(JIJ)V", 4, NULL }, - { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 1, NULL }, - { 0, (char*) "statMethod", (char*) "(III)I", 1, NULL } + { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 0, nullptr }, + { 1, (char*) "finMethod", (char*) "(JIJ)V", 5, nullptr }, + { 1, (char*) "finMethod", (char*) "(JIJ)V", 4, nullptr }, + { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 1, nullptr }, + { 0, (char*) "statMethod", (char*) "(III)I", 1, nullptr } }; static jclass redefCls; /* JNI's Java class object */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; @@ -141,7 +141,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass008_setBreakpoints(JNIEnv *env, if (breakpoints[i].inst) { /* an instance method */ breakpoints[i].mid = env->GetMethodID( redefCls, breakpoints[i].m_name, breakpoints[i].m_sign); - if (breakpoints[i].mid == NULL) { + if (breakpoints[i].mid == nullptr) { printf( "%s: Failed to get the method ID for the instance method \"%s\" with signature \"%s\"\n", __FILE__, breakpoints[i].m_name, breakpoints[i].m_sign); @@ -150,7 +150,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass008_setBreakpoints(JNIEnv *env, } else { /* a static method */ breakpoints[i].mid = env->GetStaticMethodID( redefCls, breakpoints[i].m_name, breakpoints[i].m_sign); - if (breakpoints[i].mid == NULL) { + if (breakpoints[i].mid == nullptr) { printf( "%s: Failed to get the method ID for the static method \"%s\" with signature \"%s\"\n", __FILE__, breakpoints[i].m_name, breakpoints[i].m_sign); @@ -174,7 +174,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass008_setBreakpoints(JNIEnv *env, return STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); @@ -193,7 +193,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass008_makeRedefinition(JNIEnv *env, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -205,7 +205,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass008_makeRedefinition(JNIEnv *env, /* fill the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (vrb == 1) printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n", @@ -243,7 +243,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass008_getResult(JNIEnv *env, if (breakpoints[i].inst) { /* an instance method */ breakpoints[i].mid = env->GetMethodID( redefCls, breakpoints[i].m_name, breakpoints[i].m_sign); - if (breakpoints[i].mid == NULL) { + if (breakpoints[i].mid == nullptr) { printf( "%s: getResult: Failed to get the method ID for the instance method" "\"%s\" with signature \"%s\"\n", @@ -253,7 +253,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass008_getResult(JNIEnv *env, } else { /* a static method */ breakpoints[i].mid = env->GetStaticMethodID( redefCls, breakpoints[i].m_name, breakpoints[i].m_sign); - if (breakpoints[i].mid == NULL) { + if (breakpoints[i].mid == nullptr) { printf( "%s: getResult: Failed to get the method ID for the static method" "\"%s\" with signature \"%s\"\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp index b324acf12fd..e91f9f5e895 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -80,23 +80,23 @@ typedef struct { /* local variables of a method */ jmethodID mid; /* JNI's method ID */ } methInfo; -/* list of original methods with NULL pointers to localVar */ +/* list of original methods with nullptr pointers to localVar */ static methInfo origMethInfo[] = { - { 1, (char*) "", (char*) "()V", 1, NULL, NULL }, - { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 4, NULL, NULL }, - { 1, (char*) "finMethod", (char*) "(CJIJ)V", 5, NULL, NULL }, - { 0, (char*) "statMethod", (char*) "(III)D", 3, NULL, NULL } + { 1, (char*) "", (char*) "()V", 1, nullptr, nullptr }, + { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 4, nullptr, nullptr }, + { 1, (char*) "finMethod", (char*) "(CJIJ)V", 5, nullptr, nullptr }, + { 0, (char*) "statMethod", (char*) "(III)D", 3, nullptr, nullptr } }; /* list of redefined methods */ static methInfo redefMethInfo[] = { - { 1, (char*) "", (char*) "()V", 6, constr_lv, NULL }, - { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 3, checkIt_lv, NULL }, - { 1, (char*) "finMethod", (char*) "(CJIJ)V", 7, finMeth_lv, NULL }, - { 0, (char*) "statMethod", (char*) "(III)D", 5, statMeth_lv, NULL } + { 1, (char*) "", (char*) "()V", 6, constr_lv, nullptr }, + { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 3, checkIt_lv, nullptr }, + { 1, (char*) "finMethod", (char*) "(CJIJ)V", 7, finMeth_lv, nullptr }, + { 0, (char*) "statMethod", (char*) "(III)D", 5, statMeth_lv, nullptr } }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; #ifdef STATIC_BUILD @@ -174,7 +174,7 @@ int checkAttr(JNIEnv *env, jclass redefCls, methInfo methodsInfo[], methodsInfo[i].mid = env->GetStaticMethodID(redefCls, methodsInfo[i].m_name, methodsInfo[i].m_sign); } - if (methodsInfo[i].mid == NULL) { + if (methodsInfo[i].mid == nullptr) { printf("%s: Failed to get the method ID for the%s%s method \"%s\", signature \"%s\"\n", __FILE__, full ? " " : " original ", methodsInfo[i].inst ? "instance":"static", methodsInfo[i].m_name, methodsInfo[i].m_sign); @@ -250,7 +250,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass009_makeRedefinition(JNIEnv *env, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -262,7 +262,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass009_makeRedefinition(JNIEnv *env, /* fill the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (vrb) printf("\n>>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp index 91620d38fe9..8d0831dfcb3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,21 +61,21 @@ typedef struct { /* line numbers of a method */ /* list of original methods */ static methInfo origMethInfo[] = { - { 1, (char*) "", (char*) "()V", 1, NULL }, - { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 3, NULL }, - { 1, (char*) "finMethod", (char*) "(CJIJ)V", 1, NULL }, - { 0, (char*) "statMethod", (char*) "(III)D", 5, NULL } + { 1, (char*) "", (char*) "()V", 1, nullptr }, + { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 3, nullptr }, + { 1, (char*) "finMethod", (char*) "(CJIJ)V", 1, nullptr }, + { 0, (char*) "statMethod", (char*) "(III)D", 5, nullptr } }; /* list of redefined methods */ static methInfo redefMethInfo[] = { - { 1, (char*) "", (char*) "()V", 8, NULL }, - { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 3, NULL }, - { 1, (char*) "finMethod", (char*) "(CJIJ)V", 7, NULL }, - { 0, (char*) "statMethod", (char*) "(III)D", 1, NULL } + { 1, (char*) "", (char*) "()V", 8, nullptr }, + { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 3, nullptr }, + { 1, (char*) "finMethod", (char*) "(CJIJ)V", 7, nullptr }, + { 0, (char*) "statMethod", (char*) "(III)D", 1, nullptr } }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; #ifdef STATIC_BUILD @@ -152,7 +152,7 @@ int checkAttr(JNIEnv *env, jclass redefCls, methInfo methodsInfo[], jint vrb) { methodsInfo[i].mid = env->GetStaticMethodID(redefCls, methodsInfo[i].m_name, methodsInfo[i].m_sign); } - if (methodsInfo[i].mid == NULL) { + if (methodsInfo[i].mid == nullptr) { printf("%s: Failed to get the method ID for the%s%s method \"%s\", signature \"%s\"\n", __FILE__, (vrb == 2) ? " original " : " ", methodsInfo[i].inst ? "instance" : "static", @@ -227,7 +227,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass010_makeRedefinition(JNIEnv *env, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -239,7 +239,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass010_makeRedefinition(JNIEnv *env, /* fill the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (vrb) printf("\n>>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass011/redefclass011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass011/redefclass011.cpp index 2aaef98a0f2..af4ca7ec417 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass011/redefclass011.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass011/redefclass011.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass011_check(JNIEnv *env, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } - classDef.klass = NULL; + classDef.klass = nullptr; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass012/redefclass012.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass012/redefclass012.cpp index c1a79e1fef9..1fe8077d6b7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass012/redefclass012.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass012/redefclass012.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -98,14 +98,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass012_check(JNIEnv *env, unsigned char *bytes; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = cls; classDef.class_byte_count = env->GetArrayLength(jbytes); - bytes = (unsigned char *) env->GetByteArrayElements(jbytes, NULL); + bytes = (unsigned char *) env->GetByteArrayElements(jbytes, nullptr); /* put 0,0 into version fields */ bytes[4] = 0; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass013/redefclass013.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass013/redefclass013.cpp index c525e6c20e3..c3612a7aab1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass013/redefclass013.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass013/redefclass013.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -98,14 +98,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass013_check(JNIEnv *env, unsigned char *bytes; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = cls; classDef.class_byte_count = env->GetArrayLength(jbytes); - bytes = (unsigned char *) env->GetByteArrayElements(jbytes, NULL); + bytes = (unsigned char *) env->GetByteArrayElements(jbytes, nullptr); /* put 0 into magic field */ bytes[0] = 0; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp index 9c6170b6904..90080ef43d8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass014_check(JNIEnv *env, jclass cls, jbyt jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -111,7 +111,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass014_check(JNIEnv *env, jclass cls, jbyt classDef.klass = cls; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> circularity error check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass015/redefclass015.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass015/redefclass015.cpp index 1df2cb4a1eb..5e18751e53a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass015/redefclass015.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass015/redefclass015.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass015_check(JNIEnv *env, jclass cls, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = clazz; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> verify error check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass016/redefclass016.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass016/redefclass016.cpp index 4e266edd3db..82e72f8befa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass016/redefclass016.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass016/redefclass016.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,12 +33,12 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jmethodID mid = NULL; +static jmethodID mid = nullptr; static jint bpeakpointsExpected = 0; static jint bpeakpointsCount = 0; static jlocation loc = 0; @@ -48,7 +48,7 @@ static jint magicNumber; void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, jint i) { jvmtiError err; char *sigClass, *name, *sig, *generic; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jint varValue = -1; jint j; @@ -77,7 +77,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, jint i) result = STATUS_FAILED; return; } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, "localVar") == 0) { err = jvmti_env->GetLocalInt(thr, 0, @@ -102,16 +102,16 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, jint i) result = STATUS_FAILED; } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -148,7 +148,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, classDef.klass = klass; classDef.class_byte_count = env->GetArrayLength(classBytes); - bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); for (i = 0; i < classDef.class_byte_count - 3; i++) { if (((jint)bytes[i+3] | @@ -202,12 +202,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -264,10 +264,10 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_RedefineClasses_redefclass016_getReady(JNIEnv *env, jclass cls, jclass clazz, jbyteArray bytes, jint magic, jint line) { jvmtiError err; - jvmtiLineNumberEntry *lines = NULL; + jvmtiLineNumberEntry *lines = nullptr; jint i = 0, entryCount = 0; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -279,7 +279,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass016_getReady(JNIEnv *env, jclass cls, !caps.can_access_local_variables) return; mid = env->GetMethodID(clazz, "run", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for method run\n"); result = STATUS_FAILED; return; @@ -295,7 +295,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass016_getReady(JNIEnv *env, jclass cls, return; } - if (lines != NULL && entryCount > 0) { + if (lines != nullptr && entryCount > 0) { for (i = 0; i < entryCount; i++) { if (line == lines[i].line_number) { loc = lines[i].start_location; @@ -318,7 +318,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass016_getReady(JNIEnv *env, jclass cls, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass017/redefclass017.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass017/redefclass017.cpp index cd2076cf9a7..65fe8b5572c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass017/redefclass017.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass017/redefclass017.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,12 +33,12 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jmethodID mid = NULL; +static jmethodID mid = nullptr; static jbyteArray classBytes; void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, @@ -64,7 +64,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, classDef.klass = klass; classDef.class_byte_count = env->GetArrayLength(classBytes); classDef.class_bytes = (unsigned char *) - env->GetByteArrayElements(classBytes, NULL); + env->GetByteArrayElements(classBytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> bp: about to call RedefineClasses\n"); @@ -93,12 +93,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -148,7 +148,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass017_getReady(JNIEnv *env, jclass cls, jclass clazz, jbyteArray bytes) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -158,7 +158,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass017_getReady(JNIEnv *env, jclass cls, !caps.can_generate_breakpoint_events) return; mid = env->GetMethodID(clazz, "checkPoint", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for method run\n"); result = STATUS_FAILED; return; @@ -175,7 +175,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass017_getReady(JNIEnv *env, jclass cls, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp index 68d2ac89263..37fc8d71108 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -49,7 +49,7 @@ Exception(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jvmtiClassDefinition classDef; err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, - JVMTI_EVENT_EXCEPTION, NULL); + JVMTI_EVENT_EXCEPTION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to disable JVMTI_EVENT_EXCEPTION: %s (%d)\n", TranslateError(err), err); @@ -66,7 +66,7 @@ Exception(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, classDef.klass = klass; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> about to call RedefineClasses\n"); @@ -95,12 +95,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -151,7 +151,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass018_getReady(JNIEnv *env, jclass cls, jvmtiError err; jthread thread; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass019/redefclass019.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass019/redefclass019.cpp index 414005124eb..ee650ff1914 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass019/redefclass019.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass019/redefclass019.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,14 +48,14 @@ typedef struct { var_info *vars; } frame_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jbyteArray classBytes; -static jmethodID midCheckPoint = NULL; -static jmethodID midRun = NULL; +static jmethodID midCheckPoint = nullptr; +static jmethodID midRun = nullptr; static jint framesExpected = 0; static jint framesCount = 0; @@ -96,10 +96,10 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jint i) { jvmtiError err; jclass cls; jlocation loc; - char *sigClass, *name = NULL, *sig = NULL, *generic; + char *sigClass, *name = nullptr, *sig = nullptr, *generic; jboolean is_obsolete; - jvmtiLineNumberEntry *lines = NULL; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLineNumberEntry *lines = nullptr; + jvmtiLocalVariableEntry *table = nullptr; jint line = -1; jint entryCount = 0; jint varValue = -1; @@ -135,10 +135,10 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jint i) { return; } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(pop %d) wrong class sig: \"%s\",", i, sigClass); printf(" expected: \"%s\"\n", cls_exp); - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } result = STATUS_FAILED; @@ -167,12 +167,12 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jint i) { (is_obsolete == JNI_TRUE) ? "unexpected" : "should be"); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, frames[i].name) != 0) { + if (name == nullptr || strcmp(name, frames[i].name) != 0) { printf("(pop %d) wrong method name: \"%s\",", i, name); printf(" expected: \"%s\"\n", frames[i].name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, frames[i].sig) != 0) { + if (sig == nullptr || strcmp(sig, frames[i].sig) != 0) { printf("(pop %d) wrong method sig: \"%s\",", i, sig); printf(" expected: \"%s\"\n", frames[i].sig); result = STATUS_FAILED; @@ -187,7 +187,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jint i) { return; } - if (lines != NULL && entryCount > 0) { + if (lines != nullptr && entryCount > 0) { for (k = 0; k < entryCount; k++) { if (loc < lines[k].start_location) { break; @@ -216,7 +216,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jint i) { result = STATUS_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (k = 0; k < frames[i].count; k++) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, frames[i].vars[k].name) == 0 && @@ -256,19 +256,19 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jint i) { } } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (lines != NULL) { + if (lines != nullptr) { jvmti_env->Deallocate((unsigned char*)lines); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -311,7 +311,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, classDef.klass = klass; classDef.class_byte_count = env->GetArrayLength(classBytes); classDef.class_bytes = (unsigned char *) - env->GetByteArrayElements(classBytes, NULL); + env->GetByteArrayElements(classBytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> about to call RedefineClasses\n"); @@ -368,12 +368,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -433,7 +433,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass019_getReady(JNIEnv *env, jclass cls, jclass clazz, jbyteArray bytes, jint depth) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -448,14 +448,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass019_getReady(JNIEnv *env, jclass cls, classBytes = (jbyteArray) env->NewGlobalRef(bytes); midRun = env->GetMethodID(clazz, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); result = STATUS_FAILED; return; } midCheckPoint = env->GetMethodID(clazz, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); result = STATUS_FAILED; return; @@ -470,7 +470,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass019_getReady(JNIEnv *env, jclass cls, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); @@ -479,7 +479,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass019_getReady(JNIEnv *env, jclass cls, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FRAME_POP, NULL); + JVMTI_EVENT_FRAME_POP, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable FRAME_POP event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp index 955fd841aaa..c8eee73de4d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass020_check(JNIEnv *env, jclass cls, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = clazz; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> add method capability check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp index e44872125f6..8e8f75e344f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass021_check(JNIEnv *env, jclass cls, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = clazz; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> delete method capability check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp index e931801f560..dfda41c4b84 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass022_check(JNIEnv *env, jclass cls, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = clazz; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> change fields capability check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp index 4d118e726d3..7a10b9dc5ee 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass023_check(JNIEnv *env, jclass cls, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = clazz; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> change implemented interface capability check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp index 41c4a849275..bd877d2e0b3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass024_check(JNIEnv *env, jclass cls, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = clazz; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> change class modifiers capability check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp index ee5b364dc7e..d992762d4ca 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass025_check(JNIEnv *env, jclass cls, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = clazz; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> change method modifiers capability check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp index 68366880a65..efa2b86fa10 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass026_check(JNIEnv *env, jclass cls, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = clazz; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> changed class name check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp index cdcf5f4868e..badd984de77 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,17 +50,17 @@ typedef struct { const char *desc; } frame_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jbyteArray classBytes; -static jmethodID midRun = NULL; -static jmethodID mid1 = NULL; -static jmethodID mid2 = NULL; -static jfieldID fid1 = NULL; -static jfieldID fid2 = NULL; +static jmethodID midRun = nullptr; +static jmethodID mid1 = nullptr; +static jmethodID mid2 = nullptr; +static jfieldID fid1 = nullptr; +static jfieldID fid2 = nullptr; static jint stepEventsExpected = 0; static jint bpEventsExpected = 0; static jint popEventsExpected = 0; @@ -118,11 +118,11 @@ static frame_info frames[] = { void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, jlocation loc, jint i) { jvmtiError err; - char *sigClass, *name = NULL, *sig = NULL, *generic; + char *sigClass, *name = nullptr, *sig = nullptr, *generic; const char *desc; jboolean is_obsolete; - jvmtiLineNumberEntry *lines = NULL; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLineNumberEntry *lines = nullptr; + jvmtiLocalVariableEntry *table = nullptr; jint line = -1; jint entryCount = 0; jint varValue = -1; @@ -144,10 +144,10 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, result = STATUS_FAILED; } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(%s) wrong class sig: \"%s\",", desc, sigClass); printf(" expected: \"%s\"\n", cls_exp); - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char *)sigClass); } result = STATUS_FAILED; @@ -176,12 +176,12 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, (is_obsolete == JNI_TRUE) ? "unexpected" : "should be"); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, frames[i].name) != 0) { + if (name == nullptr || strcmp(name, frames[i].name) != 0) { printf("(%s) wrong method name: \"%s\",", desc, name); printf(" expected: \"%s\"\n", frames[i].name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, frames[i].sig) != 0) { + if (sig == nullptr || strcmp(sig, frames[i].sig) != 0) { printf("(%s) wrong method sig: \"%s\",", desc, sig); printf(" expected: \"%s\"\n", frames[i].sig); result = STATUS_FAILED; @@ -195,7 +195,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, result = STATUS_FAILED; } - if (lines != NULL && entryCount > 0) { + if (lines != nullptr && entryCount > 0) { for (k = 0; k < entryCount; k++) { if (loc < lines[k].start_location) { break; @@ -223,7 +223,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, result = STATUS_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (k = 0; k < frames[i].count; k++) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, frames[i].vars[k].name) == 0 && @@ -272,19 +272,19 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, } } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char *)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char *)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char *)sig); } - if (lines != NULL) { + if (lines != nullptr) { jvmti_env->Deallocate((unsigned char *)lines); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char *)(table[j].name)); jvmti_env->Deallocate((unsigned char *)(table[j].signature)); @@ -299,7 +299,7 @@ void redefine(jvmtiEnv *jvmti_env, JNIEnv *env, jclass cls) { classDef.klass = cls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> about to call RedefineClasses %d\n", redefinesCount); @@ -531,7 +531,7 @@ void JNICALL ExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv *env, if (caps.can_generate_frame_pop_events) { err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FRAME_POP, NULL); + JVMTI_EVENT_FRAME_POP, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable FRAME_POP event: %s (%d)\n", TranslateError(err), err); @@ -596,12 +596,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -687,7 +687,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, jclass clazz, jbyteArray bytes) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -700,24 +700,24 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, classBytes = (jbyteArray) env->NewGlobalRef(bytes); midRun = env->GetMethodID(clazz, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); result = STATUS_FAILED; } mid1 = env->GetMethodID(clazz, "method1", "(I)V"); - if (mid1 == NULL) { + if (mid1 == nullptr) { printf("Cannot find Method ID for method1\n"); result = STATUS_FAILED; } mid2 = env->GetMethodID(clazz, "method2", "(I)V"); - if (mid2 == NULL) { + if (mid2 == nullptr) { printf("Cannot find Method ID for method2\n"); result = STATUS_FAILED; } - if (caps.can_generate_breakpoint_events && midRun != NULL) { + if (caps.can_generate_breakpoint_events && midRun != nullptr) { err = jvmti->SetBreakpoint(midRun, 0); if (err != JVMTI_ERROR_NONE) { printf("(SetBreakpoint) unexpected error: %s (%d)\n", @@ -725,7 +725,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, result = STATUS_FAILED; } else { err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); @@ -737,12 +737,12 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, } fid1 = env->GetStaticFieldID(clazz, "staticInt", "I"); - if (fid1 == NULL) { + if (fid1 == nullptr) { printf("Cannot find Field ID for staticInt\n"); result = STATUS_FAILED; } - if (caps.can_generate_field_modification_events && fid1 != NULL) { + if (caps.can_generate_field_modification_events && fid1 != nullptr) { err = jvmti->SetFieldModificationWatch(clazz, fid1); if (err != JVMTI_ERROR_NONE) { printf("(SetFieldModificationWatch) unexpected error: %s (%d)\n", @@ -750,7 +750,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, result = STATUS_FAILED; } else { err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable FIELD_MODIFICATION event: %s (%d)\n", TranslateError(err), err); @@ -762,12 +762,12 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, } fid2 = env->GetFieldID(clazz, "instanceInt", "I"); - if (fid2 == NULL) { + if (fid2 == nullptr) { printf("Cannot find Field ID for instanceInt\n"); result = STATUS_FAILED; } - if (caps.can_generate_field_access_events && fid2 != NULL) { + if (caps.can_generate_field_access_events && fid2 != nullptr) { err = jvmti->SetFieldAccessWatch(clazz, fid2); if (err != JVMTI_ERROR_NONE) { printf("(SetFieldAccessWatch) unexpected error: %s (%d)\n", @@ -775,7 +775,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, result = STATUS_FAILED; } else { err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable FIELD_ACCESS event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp index 09a8467c355..a00888c4d5b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,7 +49,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { JVMTI_EVENT_COMPILED_METHOD_UNLOAD }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; static volatile int fire = 0; /* CompiledMethodLoad received for hotspot method */ static jmethodID hsMethodID; /* hotspot method ID */ @@ -100,7 +100,7 @@ CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, char *sig; NSK_DISPLAY0("CompiledMethodLoad event received for:\n"); - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -133,7 +133,7 @@ CompiledMethodUnload(jvmtiEnv* jvmti_env, jmethodID method, NSK_DISPLAY0("CompiledMethodUnload event received\n"); // Check for the case that the class has been unloaded - err = jvmti_env->GetMethodName(method, &name, &sig, NULL); + err = jvmti_env->GetMethodName(method, &name, &sig, nullptr); if (err == JVMTI_ERROR_NONE) { NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n", name, sig, code_addr); @@ -188,7 +188,7 @@ agentProc(jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg) { nsk_jvmti_resumeSync(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, nullptr))) { nsk_jvmti_setFailStatus(); nsk_jvmti_resumeSync(); return; @@ -249,7 +249,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add required capabilities */ @@ -269,12 +269,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n"); if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, - eventsList, NULL)) + eventsList, nullptr)) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); /* register agent proc */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp index 9f7fc1fc5a5..8662e65a4b6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,7 +49,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { JVMTI_EVENT_COMPILED_METHOD_UNLOAD }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; static volatile int fire = 0; /* CompiledMethodLoad received for hotspot method */ static jmethodID hsMethodID; /* hotspot method ID */ @@ -99,7 +99,7 @@ CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, char *sig; NSK_DISPLAY0("CompiledMethodLoad event received for:\n"); - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -132,7 +132,7 @@ CompiledMethodUnload(jvmtiEnv* jvmti_env, jmethodID method, NSK_DISPLAY0("CompiledMethodUnload event received\n"); // Check for the case that the class has been unloaded - err = jvmti_env->GetMethodName(method, &name, &sig, NULL); + err = jvmti_env->GetMethodName(method, &name, &sig, nullptr); if (err == JVMTI_ERROR_NONE) { NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n", name, sig, code_addr); @@ -187,7 +187,7 @@ agentProc(jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg) { nsk_jvmti_resumeSync(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, nullptr))) { nsk_jvmti_setFailStatus(); nsk_jvmti_resumeSync(); return; @@ -248,7 +248,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add required capabilities */ @@ -268,12 +268,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n"); if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, - eventsList, NULL)) + eventsList, nullptr)) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); /* register agent proc */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp index b7d6daafbbd..04d3c1b2361 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,7 +49,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { JVMTI_EVENT_COMPILED_METHOD_UNLOAD }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; static volatile int fire = 0; /* CompiledMethodLoad received for hotspot method */ static jmethodID hsMethodID; /* hotspot method ID */ @@ -100,7 +100,7 @@ CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, char *sig; NSK_DISPLAY0("CompiledMethodLoad event received for:\n"); - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -133,7 +133,7 @@ CompiledMethodUnload(jvmtiEnv* jvmti_env, jmethodID method, NSK_DISPLAY0("CompiledMethodUnload event received\n"); // Check for the case that the class has been unloaded - err = jvmti_env->GetMethodName(method, &name, &sig, NULL); + err = jvmti_env->GetMethodName(method, &name, &sig, nullptr); if (err == JVMTI_ERROR_NONE) { NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n", name, sig, code_addr); @@ -188,7 +188,7 @@ agentProc(jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg) { nsk_jvmti_resumeSync(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, nullptr))) { nsk_jvmti_setFailStatus(); nsk_jvmti_resumeSync(); return; @@ -249,7 +249,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add required capabilities */ @@ -269,12 +269,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n"); if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, - eventsList, NULL)) + eventsList, nullptr)) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); /* register agent proc */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp index 9d242130a0f..34a98b5f875 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,13 +33,13 @@ extern "C" { #define STATUS_FAILED 2 #define PASSED 0 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static int watch_ev = 0; /* ignore JVMTI events by default */ static int gen_ev = 0; /* number of generated events */ static int result = PASSED; /* total result of the test */ -static jthread test_thread = NULL; +static jthread test_thread = nullptr; static jrawMonitorID watch_ev_monitor; @@ -54,9 +54,9 @@ static void set_watch_ev(JNIEnv *env, int value) { } else { test_thread = env->NewGlobalRef(test_thread); } - } else if (test_thread != NULL) { + } else if (test_thread != nullptr) { env->DeleteGlobalRef(test_thread); - test_thread = NULL; + test_thread = nullptr; } watch_ev = value; @@ -85,10 +85,10 @@ NativeMethodBind(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID method } else { printf("got JVMTI_EVENT_NATIVE_METHOD_BIND event on thread '%s', ignoring", inf.name); jvmti_env->Deallocate((unsigned char *)inf.name); - if (inf.thread_group != NULL) { + if (inf.thread_group != nullptr) { env->DeleteLocalRef(inf.thread_group); } - if (inf.context_class_loader != NULL) { + if (inf.context_class_loader != nullptr) { env->DeleteLocalRef(inf.context_class_loader); } } @@ -168,7 +168,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass031_makeRedefinition(JNIEnv *env, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -177,7 +177,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass031_makeRedefinition(JNIEnv *env, return PASSED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_NATIVE_METHOD_BIND: %s (%d)\n", TranslateError(err), err); @@ -187,7 +187,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass031_makeRedefinition(JNIEnv *env, /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); set_watch_ev(env, 1); /* watch JVMTI events */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp index 736715c2ab6..52e076741a3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -302,7 +302,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkCapabilities(jvmti, &initCaps, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = false; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -329,7 +329,7 @@ JNIEXPORT jint JNI_OnLoad_relcaps001(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -337,7 +337,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -352,7 +352,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&initCaps, 0, sizeof(jvmtiCapabilities)); @@ -375,7 +375,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp index 8ff71c76c7a..c5ad887f7f3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -301,7 +301,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkCapabilities(jvmti, &initCaps, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = false; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -328,7 +328,7 @@ JNIEXPORT jint JNI_OnLoad_relcaps002(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -336,7 +336,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -351,7 +351,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&initCaps, 0, sizeof(jvmtiCapabilities)); @@ -364,7 +364,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp index b3c6304ee0c..f5a68c17ec7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { -static jvmtiEnv* gJvmti = NULL; +static jvmtiEnv* gJvmti = nullptr; static volatile jint gEventFlags = 0; void JNICALL @@ -80,7 +80,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; - if (!NSK_VERIFY((gJvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL)) + if (!NSK_VERIFY((gJvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr)) return JNI_ERR; memset(&capabilities, 0, sizeof(jvmtiCapabilities)); @@ -96,7 +96,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) if (!NSK_JVMTI_VERIFY(gJvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_RESOURCE_EXHAUSTED, - NULL))) + nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp index 97689802db3..a3e0ee7e80d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,11 +49,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthread testedThread = NULL; + jthread testedThread = nullptr; NSK_DISPLAY1("Find thread: %s\n", THREAD_NAME); if (!NSK_VERIFY((testedThread = - nsk_jvmti_threadByName(THREAD_NAME)) != NULL)) + nsk_jvmti_threadByName(THREAD_NAME)) != nullptr)) return; NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread); @@ -118,7 +118,7 @@ JNIEXPORT jint JNI_OnLoad_resumethrd001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -128,7 +128,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -141,7 +141,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp index 55a06f21bbc..9afbc2a22d9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { }; static volatile int eventsReceived = 0; -static jthread testedThread = NULL; +static jthread testedThread = nullptr; /* ============================================================================= */ @@ -62,13 +62,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { NSK_DISPLAY1("Find thread: %s\n", THREAD_NAME); if (!NSK_VERIFY((testedThread = - nsk_jvmti_threadByName(THREAD_NAME)) != NULL)) + nsk_jvmti_threadByName(THREAD_NAME)) != nullptr)) return; NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread); eventsReceived = 0; NSK_DISPLAY1("Enable event: %s\n", "THREAD_END"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY1("Suspend thread: %p\n", (void*)testedThread); @@ -102,7 +102,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY1("Disable event: %s\n", "THREAD_END"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY0("Wait for thread to finish\n"); @@ -124,7 +124,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { JNIEXPORT void JNICALL callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ - if (thread != NULL && + if (thread != nullptr && jni->IsSameObject(testedThread, thread)) { NSK_DISPLAY1(" ... received THREAD_END event for tested thread: %p\n", (void*)thread); eventsReceived++; @@ -148,7 +148,7 @@ JNIEXPORT jint JNI_OnLoad_resumethrd002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -158,7 +158,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -180,7 +180,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp index b513fa47ec0..f0c21a7643d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,8 +57,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthread* threads = NULL; - jvmtiError* results = NULL; + jthread* threads = nullptr; + jvmtiError* results = nullptr; int i; NSK_DISPLAY1("Allocate threads array: %d threads\n", threadsCount); @@ -138,7 +138,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Delete threads references\n"); for (i = 0; i < threadsCount; i++) { - if (threads[i] != NULL) + if (threads[i] != nullptr) NSK_TRACE(jni->DeleteGlobalRef(threads[i])); } @@ -164,14 +164,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, const char name[], int foundCount, jthread foundThreads[]) { jint count = 0; - jthread* threads = NULL; + jthread* threads = nullptr; size_t len = strlen(name); int found = 0; int i; for (i = 0; i < foundCount; i++) { - foundThreads[i] = NULL; + foundThreads[i] = nullptr; } if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&count, &threads))) { @@ -188,7 +188,7 @@ static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, break; } - if (info.name != NULL && strncmp(name, info.name, len) == 0) { + if (info.name != nullptr && strncmp(name, info.name, len) == 0) { NSK_DISPLAY3(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name); if (found < foundCount) @@ -216,7 +216,7 @@ static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, NSK_DISPLAY1("Make global references for threads: %d threads\n", foundCount); for (i = 0; i < foundCount; i++) { if (!NSK_JNI_VERIFY(jni, (foundThreads[i] = (jthread) - jni->NewGlobalRef(foundThreads[i])) != NULL)) { + jni->NewGlobalRef(foundThreads[i])) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -241,7 +241,7 @@ JNIEXPORT jint JNI_OnLoad_resumethrdlst001(JavaVM *jvm, char *options, void *res } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -256,7 +256,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -269,7 +269,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp index 36caf52c147..f1508b152ce 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { }; static int threadsCount = 0; -static jthread* threads = NULL; +static jthread* threads = nullptr; static volatile int eventsReceived = 0; static jrawMonitorID eventsReceivedMtx = 0; @@ -67,7 +67,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jvmtiError* results = NULL; + jvmtiError* results = nullptr; int i; NSK_DISPLAY1("Allocate threads array: %d threads\n", threadsCount); @@ -106,7 +106,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { eventsReceived = 0; NSK_DISPLAY1("Enable event: %s\n", "THREAD_END"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY0("Let threads to run and finish\n"); @@ -145,7 +145,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY1("Disable event: %s\n", "THREAD_END"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY0("Wait for thread to finish\n"); @@ -154,7 +154,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Delete threads references\n"); for (i = 0; i < threadsCount; i++) { - if (threads[i] != NULL) + if (threads[i] != nullptr) NSK_TRACE(jni->DeleteGlobalRef(threads[i])); } @@ -180,14 +180,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, const char name[], int foundCount, jthread foundThreads[]) { jint count = 0; - jthread* threads = NULL; + jthread* threads = nullptr; size_t len = strlen(name); int found = 0; int i; for (i = 0; i < foundCount; i++) { - foundThreads[i] = NULL; + foundThreads[i] = nullptr; } if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&count, &threads))) { @@ -204,7 +204,7 @@ static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, break; } - if (info.name != NULL && strncmp(name, info.name, len) == 0) { + if (info.name != nullptr && strncmp(name, info.name, len) == 0) { NSK_DISPLAY3(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name); if (found < foundCount) @@ -232,7 +232,7 @@ static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, NSK_DISPLAY1("Make global references for threads: %d threads\n", foundCount); for (i = 0; i < foundCount; i++) { if (!NSK_JNI_VERIFY(jni, (foundThreads[i] = (jthread) - jni->NewGlobalRef(foundThreads[i])) != NULL)) { + jni->NewGlobalRef(foundThreads[i])) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -257,7 +257,7 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ for (i = 0; i < threadsCount; i++) { - if (thread != NULL && + if (thread != nullptr && jni->IsSameObject(threads[i], thread)) { NSK_DISPLAY2(" ... received THREAD_END event for thread #%d: %p\n", i, (void*)thread); @@ -285,7 +285,7 @@ JNIEXPORT jint JNI_OnLoad_resumethrdlst002(JavaVM *jvm, char *options, void *res } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -300,7 +300,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -329,7 +329,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp index c9078ea5784..e3bb7f6d611 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; /* ============================================================================= */ @@ -101,7 +101,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) return JNI_ERR; if (!NSK_VERIFY( - (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL + (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr ) ) return JNI_ERR; @@ -125,7 +125,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) // Enable class retransformation if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) + nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp index 4034dc558f8..69800c848e8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { /* ============================================================================= */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; /* Class, which contains the following callback method: * static public void callback(String className, int agentID) */ @@ -93,31 +93,31 @@ ClassFileLoadHook ( jstring class_name_string; // Check whether currently retransformed class belongs to the package we are interested in - if (name == NULL || strncmp(TRIGGER, name,strlen(name) < strlen(TRIGGER) ? strlen(name) : strlen(TRIGGER))) + if (name == nullptr || strncmp(TRIGGER, name,strlen(name) < strlen(TRIGGER) ? strlen(name) : strlen(TRIGGER))) { return; } // Get ant the invoke callback function - if (!NSK_VERIFY((loader_class = jni->GetObjectClass(loader)) != NULL)) + if (!NSK_VERIFY((loader_class = jni->GetObjectClass(loader)) != nullptr)) return; if (!NSK_VERIFY((method_id = jni->GetMethodID( - loader_class, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;")) != NULL)) + loader_class, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;")) != nullptr)) return; - if (!NSK_VERIFY((class_name_string = jni->NewStringUTF(CALLBACK_CLASS_NAME)) != NULL)) + if (!NSK_VERIFY((class_name_string = jni->NewStringUTF(CALLBACK_CLASS_NAME)) != nullptr)) return; if (!NSK_VERIFY((callback_class = (jclass) jni->CallObjectMethod( - loader, method_id, class_name_string)) != NULL)) + loader, method_id, class_name_string)) != nullptr)) return; if (!NSK_VERIFY((method_id = jni->GetStaticMethodID( - callback_class, "callback", "(Ljava/lang/String;I)V")) != NULL)) + callback_class, "callback", "(Ljava/lang/String;I)V")) != nullptr)) return; - if (!NSK_VERIFY((class_name_string = jni->NewStringUTF(name)) != NULL)) + if (!NSK_VERIFY((class_name_string = jni->NewStringUTF(name)) != nullptr)) return; jni->CallStaticObjectMethod(callback_class, method_id, class_name_string, agent_id); @@ -151,7 +151,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) agent_id= nsk_jvmti_findOptionIntValue("id", -1); - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL)) + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) @@ -179,7 +179,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) + nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp index 78a4b31d36f..f6f6b9136f4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { /* ============================================================================= */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; /* ============================================================================= */ @@ -106,7 +106,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) jvmtiCapabilities caps; if (!NSK_VERIFY( - (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL + (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr ) ) return JNI_ERR; @@ -131,7 +131,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) + nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp index 775f564f465..bf19ddb4903 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define WAIT_TIME (jlong)100 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -92,7 +92,7 @@ sys_thread_1(jvmtiEnv* jvmti, JNIEnv* jni, void *p) { } count |= 0x01; - err = jvmti->RunAgentThread(jthr(jni), sys_thread_4, NULL, + err = jvmti->RunAgentThread(jthr(jni), sys_thread_4, nullptr, JVMTI_THREAD_MAX_PRIORITY); if (err != JVMTI_ERROR_NONE) { printf("(RunAgentThread#4) unexpected error: %s (%d)\n", @@ -178,7 +178,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) { } err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_THREAD_START, NULL); + JVMTI_EVENT_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err); @@ -206,21 +206,21 @@ ThreadStart(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread) { if (strcmp(thrInfo.name, "thr1") == 0 && !thr1_was_started) { thr1_was_started = 1; err = jvmti_env->RunAgentThread(jthr((JNIEnv *)env), - sys_thread_1, NULL, JVMTI_THREAD_MAX_PRIORITY); + sys_thread_1, nullptr, JVMTI_THREAD_MAX_PRIORITY); if (err != JVMTI_ERROR_NONE) { printf("(RunAgentThread#1) unexpected error: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; } err = jvmti_env->RunAgentThread(jthr((JNIEnv *)env), - sys_thread_2, NULL, JVMTI_THREAD_NORM_PRIORITY); + sys_thread_2, nullptr, JVMTI_THREAD_NORM_PRIORITY); if (err != JVMTI_ERROR_NONE) { printf("(RunAgentThread#2) unexpected error: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; } err = jvmti_env->RunAgentThread(jthr((JNIEnv *)env), - sys_thread_3, NULL, JVMTI_THREAD_MIN_PRIORITY); + sys_thread_3, nullptr, JVMTI_THREAD_MIN_PRIORITY); if (err != JVMTI_ERROR_NONE) { printf("(RunAgentThread#3) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -244,12 +244,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -271,7 +271,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); @@ -285,7 +285,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_RunAgentThread_agentthr001_startSysThr(JNIEnv *env, jclass cls) { jvmtiError err; - err = jvmti->RunAgentThread(jthr(env), sys_thread_5, NULL, + err = jvmti->RunAgentThread(jthr(env), sys_thread_5, nullptr, JVMTI_THREAD_MAX_PRIORITY); if (err != JVMTI_ERROR_NONE) { printf("(RunAgentThread#5) unexpected error: %s (%d)\n", @@ -308,7 +308,7 @@ Java_nsk_jvmti_RunAgentThread_agentthr001_getRes(JNIEnv *env, jclass cls) { } err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, - JVMTI_EVENT_THREAD_START, NULL); + JVMTI_EVENT_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to disable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp index b66836e8ed3..f155561f129 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jrawMonitorID wait_lock; @@ -52,12 +52,12 @@ JNIEXPORT jint JNI_OnLoad_agentthr002(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -94,7 +94,7 @@ Java_nsk_jvmti_RunAgentThread_agentthr002_check(JNIEnv *env, jclass cls, jthread jvmtiError err; jvmtiThreadInfo inf; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -109,7 +109,7 @@ Java_nsk_jvmti_RunAgentThread_agentthr002_check(JNIEnv *env, jclass cls, jthread if (printdump == JNI_TRUE) { printf(">>> starting debug thread ...\n"); } - err = jvmti->RunAgentThread(thr, debug_thread, NULL, + err = jvmti->RunAgentThread(thr, debug_thread, nullptr, JVMTI_THREAD_NORM_PRIORITY); if (err != JVMTI_ERROR_NONE) { printf("(RunAgentThread) unexpected error: %s (%d)\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp index 607b9f00557..95bb3e30fa1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_agentthr003(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -75,7 +75,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RunAgentThread_agentthr003_check(JNIEnv *env, jclass cls, jthread thr) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -83,7 +83,7 @@ Java_nsk_jvmti_RunAgentThread_agentthr003_check(JNIEnv *env, jclass cls, jthread if (printdump == JNI_TRUE) { printf(">>> invalid thread check ...\n"); } - err = jvmti->RunAgentThread(NULL, agent_thread, NULL, + err = jvmti->RunAgentThread(nullptr, agent_thread, nullptr, JVMTI_THREAD_NORM_PRIORITY); if (err != JVMTI_ERROR_INVALID_THREAD) { printf("Error expected: JVMTI_ERROR_INVALID_THREAD,\n"); @@ -94,7 +94,7 @@ Java_nsk_jvmti_RunAgentThread_agentthr003_check(JNIEnv *env, jclass cls, jthread if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->RunAgentThread(thr, NULL, NULL, + err = jvmti->RunAgentThread(thr, nullptr, nullptr, JVMTI_THREAD_NORM_PRIORITY); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); @@ -105,7 +105,7 @@ Java_nsk_jvmti_RunAgentThread_agentthr003_check(JNIEnv *env, jclass cls, jthread if (printdump == JNI_TRUE) { printf(">>> less than JVMTI_THREAD_MIN_PRIORITY check ...\n"); } - err = jvmti->RunAgentThread(thr, agent_thread, NULL, + err = jvmti->RunAgentThread(thr, agent_thread, nullptr, JVMTI_THREAD_MIN_PRIORITY - 1); if (err != JVMTI_ERROR_INVALID_PRIORITY) { printf("Error expected: JVMTI_ERROR_INVALID_PRIORITY,\n"); @@ -116,7 +116,7 @@ Java_nsk_jvmti_RunAgentThread_agentthr003_check(JNIEnv *env, jclass cls, jthread if (printdump == JNI_TRUE) { printf(">>> greater than JVMTI_THREAD_MAX_PRIORITY check ...\n"); } - err = jvmti->RunAgentThread(thr, agent_thread, NULL, + err = jvmti->RunAgentThread(thr, agent_thread, nullptr, JVMTI_THREAD_MAX_PRIORITY + 1); if (err != JVMTI_ERROR_INVALID_PRIORITY) { printf("Error expected: JVMTI_ERROR_INVALID_PRIORITY,\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp index 5bee6195805..51a2c0ca72c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,7 +97,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk002_check(JNIEnv *env, jclass cls) { jlocation start; jlocation end; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -107,7 +107,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk002_check(JNIEnv *env, jclass cls) { } mid = env->GetStaticMethodID(cls, "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find method run\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp index b996ed3f021..3f61346a1ea 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk003_check(JNIEnv *env, jclass cls) { jvmtiError err; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -106,7 +106,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk003_check(JNIEnv *env, jclass cls) { } mid = env->GetStaticMethodID(cls, "check", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find method check\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp index 462cbe0417b..8c6d5051420 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk005_check(JNIEnv *env, jclass cls) { jvmtiError err; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -106,7 +106,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk005_check(JNIEnv *env, jclass cls) { } mid = env->GetStaticMethodID(cls, "trial", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find method trial\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp index 79b93a9fbf7..60d56f40aae 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk007_check(JNIEnv *env, jclass cls) { jvmtiError err; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -114,7 +114,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk007_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->SetBreakpoint(NULL, 0); + err = jvmti->SetBreakpoint(nullptr, 0); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp index 7d893b36a50..b002b2ce371 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -82,17 +82,17 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, printf(">>> method: \"%s%s\"\n", name, sig); printf(">>> location: 0x%x%08x\n", (jint)(loc >> 32), (jint)loc); } - if (name == NULL || strcmp(cls_sig, exp_csig) != 0) { + if (name == nullptr || strcmp(cls_sig, exp_csig) != 0) { printf("(bp#%d) wrong class: \"%s\"", eventsCount, cls_sig); printf(", expected: \"%s\"\n", exp_csig); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, exp_name) != 0) { + if (name == nullptr || strcmp(name, exp_name) != 0) { printf("(bp#%d) wrong method name: \"%s\"", eventsCount, name); printf(", expected: \"%s\"\n", exp_name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, exp_sig) != 0) { + if (sig == nullptr || strcmp(sig, exp_sig) != 0) { printf("(bp#%d) wrong method sig: \"%s\"", eventsCount, sig); printf(", expected: \"%s\"\n", exp_sig); result = STATUS_FAILED; @@ -119,12 +119,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -171,7 +171,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk008_getReady(JNIEnv *env, jvmtiError err; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -182,7 +182,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk008_getReady(JNIEnv *env, } mid = env->GetStaticMethodID(cls, exp_name, exp_sig); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); result = STATUS_FAILED; return; @@ -201,7 +201,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk008_getReady(JNIEnv *env, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor001/setenvstor001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor001/setenvstor001.cpp index 98400d75bf7..265b10c1083 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor001/setenvstor001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor001/setenvstor001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -85,7 +85,7 @@ static int setEnvStorage(jvmtiEnv* jvmti, StorageStructure* storage, const char * @returns NSK_FALSE if any error occured. */ static int checkEnvStorage(jvmtiEnv* jvmti, StorageStructure* initialStorage, const char where[]) { - StorageStructure* storage = NULL; + StorageStructure* storage = nullptr; NSK_DISPLAY0("Get local storage for current JVMTI env\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage((void**)&storage))) { @@ -170,7 +170,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkEnvStorage(jvmti, initialStorage, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -197,7 +197,7 @@ JNIEXPORT jint JNI_OnLoad_setenvstor001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -205,7 +205,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -220,7 +220,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY1(">>> Prepare storage data at pointer: 0x%p\n", initialStorage); @@ -237,7 +237,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor002/setenvstor002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor002/setenvstor002.cpp index 9d53a2ad37a..7194016b9aa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor002/setenvstor002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor002/setenvstor002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -85,7 +85,7 @@ static int setEnvStorage(jvmtiEnv* jvmti, StorageStructure* storage, const char * @returns NSK_FALSE if any error occured. */ static int checkEnvStorage(jvmtiEnv* jvmti, StorageStructure* initialStorage, const char where[]) { - StorageStructure* storage = NULL; + StorageStructure* storage = nullptr; NSK_DISPLAY0("Get local storage for current JVMTI env\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage((void**)&storage))) { @@ -175,7 +175,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkEnvStorage(jvmti, initialStorage, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -202,7 +202,7 @@ JNIEXPORT jint JNI_OnLoad_setenvstor002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -210,7 +210,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -225,14 +225,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY1(">>> Prepare storage data at pointer: 0x%p\n", initialStorage); fillEnvStorage(initialStorage); NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor003/setenvstor003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor003/setenvstor003.cpp index 6c3ec2145a3..89ee7cc2887 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor003/setenvstor003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor003/setenvstor003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -85,7 +85,7 @@ static int setEnvStorage(jvmtiEnv* jvmti, StorageStructure* storage, const char * @returns NSK_FALSE if any error occured. */ static int checkEnvStorage(jvmtiEnv* jvmti, StorageStructure* initialStorage, const char where[]) { - StorageStructure* storage = NULL; + StorageStructure* storage = nullptr; NSK_DISPLAY0("Get local storage for current JVMTI env\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage((void**)&storage))) { @@ -178,7 +178,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkEnvStorage(jvmti, initialStorage, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -205,7 +205,7 @@ JNIEXPORT jint JNI_OnLoad_setenvstor003(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -213,7 +213,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -228,14 +228,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY1(">>> Prepare storage data at pointer: 0x%p\n", initialStorage); fillEnvStorage(initialStorage); NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb001/setevntcallb001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb001/setevntcallb001.cpp index 9b15148fe19..06fe61853f5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb001/setevntcallb001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb001/setevntcallb001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -101,7 +101,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Disable events\n"); - nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL); + nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr); NSK_DISPLAY0("Let debugee to finish\n"); if (!nsk_jvmti_resumeSync()) @@ -146,7 +146,7 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) { nsk_jvmti_setFailStatus(); } else { - nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT - 1, eventsList + 1, NULL); + nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT - 1, eventsList + 1, nullptr); } } } @@ -166,7 +166,7 @@ JNIEXPORT jint JNI_OnLoad_setevntcallb001(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -174,10 +174,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Set callbacks for VM_INIT event\n"); @@ -191,7 +191,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) { nsk_jvmti_setFailStatus(); } else { - nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, eventsList, NULL); + nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, eventsList, nullptr); } } return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb002/setevntcallb002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb002/setevntcallb002.cpp index 65f8a2fd3f4..44535b30c11 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb002/setevntcallb002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb002/setevntcallb002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -83,7 +83,7 @@ static int checkEventCounts() { for (i = 1; i < EVENTS_COUNT; i++) { if (eventsCountList[i] > 0) { - NSK_COMPLAIN2("# %s event callback was invoked after SetEventCallbacks(NULL):\n" + NSK_COMPLAIN2("# %s event callback was invoked after SetEventCallbacks(null):\n" "# invoked: %d times\n", eventsNameList[i], eventsCountList[i]); success = NSK_FALSE; @@ -108,7 +108,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Disable events\n"); - nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL); + nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr); NSK_DISPLAY0("Let debugee to finish\n"); if (!nsk_jvmti_resumeSync()) @@ -143,13 +143,13 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY1(" : thread: 0x%p\n", (void*)thread); eventsCountList[0]++; - NSK_DISPLAY0(">>> Testcase #2: Set NULL for events callbacks\n"); + NSK_DISPLAY0(">>> Testcase #2: Set null for events callbacks\n"); { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(NULL, 0))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(nullptr, 0))) { nsk_jvmti_setFailStatus(); } - nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT - 1, eventsList + 1, NULL); + nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT - 1, eventsList + 1, nullptr); } } @@ -168,7 +168,7 @@ JNIEXPORT jint JNI_OnLoad_setevntcallb002(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -176,10 +176,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Set callbacks for all tested events\n"); @@ -195,7 +195,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) { nsk_jvmti_setFailStatus(); } else { - nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, eventsList, NULL); + nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, eventsList, nullptr); } } return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb003/setevntcallb003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb003/setevntcallb003.cpp index 72511c6776d..2b4d9aa05c5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb003/setevntcallb003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb003/setevntcallb003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -108,7 +108,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Disable events\n"); - nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL); + nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr); NSK_DISPLAY0("Let debugee to finish\n"); if (!nsk_jvmti_resumeSync()) @@ -155,7 +155,7 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { nsk_jvmti_setFailStatus(); } - nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT - 1, eventsList + 1, NULL); + nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT - 1, eventsList + 1, nullptr); } } @@ -174,7 +174,7 @@ JNIEXPORT jint JNI_OnLoad_setevntcallb003(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -182,10 +182,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Set callbacks for all tested events\n"); @@ -199,7 +199,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) { nsk_jvmti_setFailStatus(); } else { - nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, eventsList, NULL); + nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, eventsList, nullptr); } } return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp index 135f51a86f9..bd2c5ab397e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,11 +34,11 @@ extern "C" { #define STATUS_FAILED 2 #define SCALE_SIZE (JVMTI_MAX_EVENT_TYPE_VAL + 1) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jrawMonitorID access_lock; -static jobject notifyFramePopThread = NULL; +static jobject notifyFramePopThread = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static int flag = 0; @@ -78,7 +78,7 @@ void disable(jvmtiEnv *jvmti_env, jvmtiEvent kind) { printf(">>> disabling %s\n", TranslateEvent(kind)); } err = jvmti_env->SetEventNotificationMode( - JVMTI_DISABLE, kind, NULL); + JVMTI_DISABLE, kind, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Fail to disable %s: %s (%d)\n", TranslateEvent(kind), TranslateError(err), err); @@ -99,7 +99,7 @@ void enable(jvmtiEnv *jvmti_env, jvmtiEvent kind) { result = STATUS_FAILED; } err = jvmti_env->SetEventNotificationMode( - JVMTI_ENABLE, kind, NULL); + JVMTI_ENABLE, kind, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Fail to enable %s: %s (%d)\n", TranslateEvent(kind), TranslateError(err), err); @@ -121,8 +121,8 @@ void setWatches(jvmtiEnv *jvmti_env, JNIEnv *env, jclass cls) { jmethodID mid; mid = env->GetStaticMethodID(cls, "meth01", "(I)V"); - if (mid == NULL) { - printf("(GetStaticMethodID) returns NULL"); + if (mid == nullptr) { + printf("(GetStaticMethodID) returns null"); result = STATUS_FAILED; return; } @@ -309,7 +309,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } @@ -317,7 +317,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(ev_scale, 0, SCALE_SIZE); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetExtensionEventCallback/setextevent001/setextevent001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetExtensionEventCallback/setextevent001/setextevent001.cpp index 9088e6047f2..fc32a11a0ad 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetExtensionEventCallback/setextevent001/setextevent001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetExtensionEventCallback/setextevent001/setextevent001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ callbackExtensionEvent(jvmtiEnv* jvmti, ...) { static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { int success = NSK_TRUE; jint extCount = 0; - jvmtiExtensionEventInfo* extList = NULL; + jvmtiExtensionEventInfo* extList = nullptr; int i; NSK_DISPLAY0("Get extension events list\n"); @@ -58,7 +58,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { NSK_DISPLAY1("# WARNING: No extension events implemented to check: %d\n", extCount); } else { - if (!NSK_VERIFY(extList != NULL)) + if (!NSK_VERIFY(extList != nullptr)) return NSK_FALSE; NSK_DISPLAY1("Set/clear callback for each extension event: %d events\n", (int)extCount); @@ -76,9 +76,9 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { } NSK_DISPLAY0(" ... done\n"); - NSK_DISPLAY1(" ... clearing callback: 0x%p\n", (void*)NULL); + NSK_DISPLAY1(" ... clearing callback: 0x%p\n", nullptr); if (!NSK_JVMTI_VERIFY( - jvmti->SetExtensionEventCallback(extList[i].extension_event_index, NULL))) { + jvmti->SetExtensionEventCallback(extList[i].extension_event_index, nullptr))) { success = NSK_FALSE; } NSK_DISPLAY0(" ... done\n"); @@ -130,7 +130,7 @@ JNIEXPORT jint JNI_OnLoad_setextevent001(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -138,7 +138,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check setting extension event callbacks in OnLoad phase\n"); @@ -148,7 +148,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp index ddd5ed6e82c..e28cffa3bc0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,12 +48,12 @@ static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static field fields[] = { - { "nsk/jvmti/SetFieldAccessWatch/setfldw001", "fld0", "I", 0, NULL, NULL }, - { "nsk/jvmti/SetFieldAccessWatch/setfldw001", "fld1", "I", 1, NULL, NULL }, + { "nsk/jvmti/SetFieldAccessWatch/setfldw001", "fld0", "I", 0, nullptr, nullptr }, + { "nsk/jvmti/SetFieldAccessWatch/setfldw001", "fld1", "I", 1, nullptr, nullptr }, { "nsk/jvmti/SetFieldAccessWatch/setfldw001", "fld2", - "Lnsk/jvmti/SetFieldAccessWatch/setfldw001a;", 0, NULL, NULL }, - { "nsk/jvmti/SetFieldAccessWatch/setfldw001a", "fld3", "[I", 0, NULL, NULL }, - { "nsk/jvmti/SetFieldAccessWatch/setfldw001b", "fld4", "F", 0, NULL, NULL }, + "Lnsk/jvmti/SetFieldAccessWatch/setfldw001a;", 0, nullptr, nullptr }, + { "nsk/jvmti/SetFieldAccessWatch/setfldw001a", "fld3", "[I", 0, nullptr, nullptr }, + { "nsk/jvmti/SetFieldAccessWatch/setfldw001b", "fld4", "F", 0, nullptr, nullptr }, }; void setWatch(JNIEnv *env, jint ind) { @@ -62,12 +62,12 @@ void setWatch(JNIEnv *env, jint ind) { field fld = fields[ind]; cls = env->FindClass(fld.klass); - if (cls == NULL) { + if (cls == nullptr) { printf("Cannot find class \"%s\"\n", fld.klass); result = STATUS_FAILED; return; } - if (fld.fid == NULL) { + if (fld.fid == nullptr) { if (fld.stat) { fields[ind].fid = env->GetStaticFieldID(cls, fld.name, fld.sig); } else { @@ -90,18 +90,18 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID method, jlocation location, jclass field_klass, jobject obj, jfieldID field) { - char *fld_name = NULL; + char *fld_name = nullptr; jint fld_ind = 0; size_t len = 0; jvmtiError err = jvmti_env->GetFieldName(field_klass, field, - &fld_name, NULL, NULL); + &fld_name, nullptr, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Error in GetFieldName: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; return; } - if (fld_name == NULL) { - printf("GetFieldName returned NULL field name\n"); + if (fld_name == nullptr) { + printf("GetFieldName returned null field name\n"); result = STATUS_FAILED; return; } @@ -133,7 +133,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -169,7 +169,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err); @@ -203,7 +203,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw001_check(JNIEnv *env, jfieldID thrown_fid = fields[fld_ind].thrown_fid; if (caps.can_generate_field_access_events) { - if (flag == JNI_FALSE && thrown_fid != NULL) { + if (flag == JNI_FALSE && thrown_fid != nullptr) { result = STATUS_FAILED; printf("(Field %d) FIELD_ACCESS event without access watch set\n", fld_ind); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp index 11161cffd8a..db4b0c401e3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,7 +59,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -95,7 +95,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err); @@ -123,14 +123,14 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw002_check(JNIEnv *env, jclass cls) { printf(" %s (%d)\n", TranslateError(err), err); } } else { - err = jvmti->SetFieldAccessWatch(NULL, fid); + err = jvmti->SetFieldAccessWatch(nullptr, fid); if (err != JVMTI_ERROR_INVALID_CLASS) { result = STATUS_FAILED; printf("Failed to return JVMTI_ERROR_INVALID_CLASS: %s (%d)\n", TranslateError(err), err); } - err = jvmti->SetFieldAccessWatch(cls, NULL); + err = jvmti->SetFieldAccessWatch(cls, nullptr); if (err != JVMTI_ERROR_INVALID_FIELDID) { result = STATUS_FAILED; printf("Failed to return JVMTI_ERROR_INVALID_FIELDID: %s (%d)\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp index 303888a53cc..058cc381622 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,8 +39,8 @@ static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jfieldID actual_fid = NULL; -static jfieldID fids[4] = { NULL, NULL, NULL, NULL }; +static jfieldID actual_fid = nullptr; +static jfieldID fids[4] = { nullptr, nullptr, nullptr, nullptr }; void JNICALL FieldAccess(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID method, @@ -66,12 +66,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -126,7 +126,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw003_getReady(JNIEnv *env, jclass cls) fids[2] = env->GetFieldID(cls, "fld2", "I"); fids[3] = env->GetFieldID(cls, "fld3", "I"); for (i = 0; i < sizeof(fids) / sizeof(jfieldID); i++) { - if (fids[i] == NULL) { + if (fids[i] == nullptr) { printf("Unable to set field access watch on fld%" PRIuPTR ", fieldID=0", i); } else { if (printdump == JNI_TRUE) { @@ -142,7 +142,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw003_getReady(JNIEnv *env, jclass cls) } } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -161,7 +161,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw003_check(JNIEnv *env, printf("Field fld%d: thrown field ID expected=0x%p, actual=0x%p\n", ind, fids[ind], actual_fid); } - actual_fid = NULL; + actual_fid = nullptr; } JNIEXPORT jint JNICALL diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp index a09bc425576..7474fd97c1a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,8 +39,8 @@ static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jfieldID actual_fid = NULL; -static jfieldID fids[4] = { NULL, NULL, NULL, NULL }; +static jfieldID actual_fid = nullptr; +static jfieldID fids[4] = { nullptr, nullptr, nullptr, nullptr }; void JNICALL FieldAccess(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID method, @@ -66,12 +66,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -133,7 +133,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw004_getReady(JNIEnv *env, jclass cls) fids[2] = env->GetFieldID(cls, "fld2", "I"); fids[3] = env->GetFieldID(cls, "fld3", "I"); for (i = 0; i < sizeof(fids) / sizeof(jfieldID); i++) { - if (fids[i] == NULL) { + if (fids[i] == nullptr) { printf("Unable to set field access watch on fld%" PRIuPTR ", fieldID=0", i); } else { if (printdump == JNI_TRUE) { @@ -149,7 +149,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw004_getReady(JNIEnv *env, jclass cls) } } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -168,7 +168,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw004_check(JNIEnv *env, printf("Field %d: thrown field ID expected=0x%p, actual=0x%p\n", ind, fids[ind], actual_fid); } - actual_fid = NULL; + actual_fid = nullptr; } JNIEXPORT jint JNICALL diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp index bc7daad4c70..910cc4ec9dd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,24 +47,24 @@ static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jfieldID actual_fid = NULL; +static jfieldID actual_fid = nullptr; static field fields[] = { - { "fld0", "J", JNI_TRUE, NULL, "static long" }, - { "fld1", "J", JNI_FALSE, NULL, "long" }, - { "fld2", "F", JNI_TRUE, NULL, "static float" }, - { "fld3", "F", JNI_FALSE, NULL, "float" }, - { "fld4", "D", JNI_TRUE, NULL, "static double" }, - { "fld5", "D", JNI_FALSE, NULL, "double" }, - { "fld6", "Ljava/lang/Object;", JNI_TRUE, NULL, "static Object" }, - { "fld7", "Ljava/lang/Object;", JNI_FALSE, NULL, "Object" }, - { "fld8", "Z", JNI_TRUE, NULL, "static boolean" }, - { "fld9", "Z", JNI_FALSE, NULL, "boolean" }, - { "fld10", "B", JNI_TRUE, NULL, "static byte" }, - { "fld11", "B", JNI_FALSE, NULL, "byte" }, - { "fld12", "S", JNI_TRUE, NULL, "static short" }, - { "fld13", "S", JNI_FALSE, NULL, "short" }, - { "fld14", "C", JNI_TRUE, NULL, "static char" }, - { "fld15", "C", JNI_FALSE, NULL, "char" } + { "fld0", "J", JNI_TRUE, nullptr, "static long" }, + { "fld1", "J", JNI_FALSE, nullptr, "long" }, + { "fld2", "F", JNI_TRUE, nullptr, "static float" }, + { "fld3", "F", JNI_FALSE, nullptr, "float" }, + { "fld4", "D", JNI_TRUE, nullptr, "static double" }, + { "fld5", "D", JNI_FALSE, nullptr, "double" }, + { "fld6", "Ljava/lang/Object;", JNI_TRUE, nullptr, "static Object" }, + { "fld7", "Ljava/lang/Object;", JNI_FALSE, nullptr, "Object" }, + { "fld8", "Z", JNI_TRUE, nullptr, "static boolean" }, + { "fld9", "Z", JNI_FALSE, nullptr, "boolean" }, + { "fld10", "B", JNI_TRUE, nullptr, "static byte" }, + { "fld11", "B", JNI_FALSE, nullptr, "byte" }, + { "fld12", "S", JNI_TRUE, nullptr, "static short" }, + { "fld13", "S", JNI_FALSE, nullptr, "short" }, + { "fld14", "C", JNI_TRUE, nullptr, "static char" }, + { "fld15", "C", JNI_FALSE, nullptr, "char" } }; void JNICALL FieldAccess(jvmtiEnv *jvmti_env, JNIEnv *env, @@ -91,12 +91,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -159,7 +159,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw005_getReady(JNIEnv *env, jclass cls) } else { fields[i].fid = env->GetFieldID(cls, fields[i].name, fields[i].sig); } - if (fields[i].fid == NULL) { + if (fields[i].fid == nullptr) { printf("Unable to set access watch on %s fld%" PRIuPTR ", fieldID=0", fields[i].descr, i); } else { @@ -176,7 +176,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw005_getReady(JNIEnv *env, jclass cls) } } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -195,7 +195,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw005_check(JNIEnv *env, printf("Field %s fld%d: thrown field ID expected=0x%p, actual=0x%p\n", fields[ind].descr, ind, fields[ind].fid, actual_fid); } - actual_fid = NULL; + actual_fid = nullptr; } JNIEXPORT jint JNICALL diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp index c70c9176a97..ac838cd5c5a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,34 +43,34 @@ typedef struct { jint count; } watch_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static int missesCount = 0; static watch_info watches[] = { - { NULL, "staticBoolean", "Z", JNI_TRUE, 0, 0 }, - { NULL, "staticByte", "B", JNI_TRUE, 0, 0 }, - { NULL, "staticShort", "S", JNI_TRUE, 0, 0 }, - { NULL, "staticInt", "I", JNI_TRUE, 0, 0 }, - { NULL, "staticLong", "J", JNI_TRUE, 0, 0 }, - { NULL, "staticFloat", "F", JNI_TRUE, 0, 0 }, - { NULL, "staticDouble", "D", JNI_TRUE, 0, 0 }, - { NULL, "staticChar", "C", JNI_TRUE, 0, 0 }, - { NULL, "staticObject", "Ljava/lang/Object;", JNI_TRUE, 0, 0 }, - { NULL, "staticArrInt", "[I", JNI_TRUE, 0, 0 }, + { nullptr, "staticBoolean", "Z", JNI_TRUE, 0, 0 }, + { nullptr, "staticByte", "B", JNI_TRUE, 0, 0 }, + { nullptr, "staticShort", "S", JNI_TRUE, 0, 0 }, + { nullptr, "staticInt", "I", JNI_TRUE, 0, 0 }, + { nullptr, "staticLong", "J", JNI_TRUE, 0, 0 }, + { nullptr, "staticFloat", "F", JNI_TRUE, 0, 0 }, + { nullptr, "staticDouble", "D", JNI_TRUE, 0, 0 }, + { nullptr, "staticChar", "C", JNI_TRUE, 0, 0 }, + { nullptr, "staticObject", "Ljava/lang/Object;", JNI_TRUE, 0, 0 }, + { nullptr, "staticArrInt", "[I", JNI_TRUE, 0, 0 }, - { NULL, "instanceBoolean", "Z", JNI_FALSE, 0, 0 }, - { NULL, "instanceByte", "B", JNI_FALSE, 0, 0 }, - { NULL, "instanceShort", "S", JNI_FALSE, 0, 0 }, - { NULL, "instanceInt", "I", JNI_FALSE, 0, 0 }, - { NULL, "instanceLong", "J", JNI_FALSE, 0, 0 }, - { NULL, "instanceFloat", "F", JNI_FALSE, 0, 0 }, - { NULL, "instanceDouble", "D", JNI_FALSE, 0, 0 }, - { NULL, "instanceChar", "C", JNI_FALSE, 0, 0 }, - { NULL, "instanceObject", "Ljava/lang/Object;", JNI_FALSE, 0, 0 }, - { NULL, "instanceArrInt", "[I", JNI_FALSE, 0, 0 } + { nullptr, "instanceBoolean", "Z", JNI_FALSE, 0, 0 }, + { nullptr, "instanceByte", "B", JNI_FALSE, 0, 0 }, + { nullptr, "instanceShort", "S", JNI_FALSE, 0, 0 }, + { nullptr, "instanceInt", "I", JNI_FALSE, 0, 0 }, + { nullptr, "instanceLong", "J", JNI_FALSE, 0, 0 }, + { nullptr, "instanceFloat", "F", JNI_FALSE, 0, 0 }, + { nullptr, "instanceDouble", "D", JNI_FALSE, 0, 0 }, + { nullptr, "instanceChar", "C", JNI_FALSE, 0, 0 }, + { nullptr, "instanceObject", "Ljava/lang/Object;", JNI_FALSE, 0, 0 }, + { nullptr, "instanceArrInt", "[I", JNI_FALSE, 0, 0 } }; @@ -103,12 +103,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -162,7 +162,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw006_getReady(JNIEnv *env, jvmtiError err; size_t i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -191,7 +191,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw006_getReady(JNIEnv *env, } } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp index c7ec0e65035..42317001d0c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,12 +48,12 @@ static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static field fields[] = { - { "nsk/jvmti/SetFieldModificationWatch/setfmodw001", "fld0", "I", 0, NULL, NULL }, - { "nsk/jvmti/SetFieldModificationWatch/setfmodw001", "fld1", "I", 1, NULL, NULL }, + { "nsk/jvmti/SetFieldModificationWatch/setfmodw001", "fld0", "I", 0, nullptr, nullptr }, + { "nsk/jvmti/SetFieldModificationWatch/setfmodw001", "fld1", "I", 1, nullptr, nullptr }, { "nsk/jvmti/SetFieldModificationWatch/setfmodw001", "fld2", - "Lnsk/jvmti/SetFieldModificationWatch/setfmodw001a;", 0, NULL, NULL }, - { "nsk/jvmti/SetFieldModificationWatch/setfmodw001a", "fld3", "[I", 0, NULL, NULL }, - { "nsk/jvmti/SetFieldModificationWatch/setfmodw001b", "fld4", "F", 0, NULL, NULL }, + "Lnsk/jvmti/SetFieldModificationWatch/setfmodw001a;", 0, nullptr, nullptr }, + { "nsk/jvmti/SetFieldModificationWatch/setfmodw001a", "fld3", "[I", 0, nullptr, nullptr }, + { "nsk/jvmti/SetFieldModificationWatch/setfmodw001b", "fld4", "F", 0, nullptr, nullptr }, }; void setWatch(JNIEnv *env, jint ind) { @@ -61,7 +61,7 @@ void setWatch(JNIEnv *env, jint ind) { jvmtiError err; cls = env->FindClass(fields[ind].klass); - if (fields[ind].fid == NULL) { + if (fields[ind].fid == nullptr) { if (fields[ind].stat) { fields[ind].fid = env->GetStaticFieldID(cls, fields[ind].name, fields[ind].sig); } else { @@ -84,18 +84,18 @@ void JNICALL FieldModification(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID method, jlocation location, jclass field_klass, jobject obj, jfieldID field, char sig, jvalue new_value) { - char *fld_name = NULL; + char *fld_name = nullptr; jint fld_ind = 0; size_t len = 0; jvmtiError err = jvmti_env->GetFieldName(field_klass, field, - &fld_name, NULL, NULL); + &fld_name, nullptr, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Error in GetFieldName: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; return; } - if (fld_name == NULL) { - printf("GetFieldName returned NULL field name\n"); + if (fld_name == nullptr) { + printf("GetFieldName returned null field name\n"); result = STATUS_FAILED; return; } @@ -127,7 +127,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -163,7 +163,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_FIELD_MODIFICATION: %s (%d)\n", TranslateError(err), err); @@ -195,7 +195,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw001_check(JNIEnv *env, jfieldID thrown_fid = fields[fld_ind].thrown_fid; if (caps.can_generate_field_modification_events) { - if (flag == JNI_FALSE && thrown_fid != NULL) { + if (flag == JNI_FALSE && thrown_fid != nullptr) { result = STATUS_FAILED; printf("(Field %d) FieldModification without modification watch set\n", fld_ind); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp index 3f33f677991..230d02d14f1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,7 +59,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -95,7 +95,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_FIELD_MODIFICATION: %s (%d)\n", TranslateError(err), err); @@ -115,8 +115,8 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw002_check(JNIEnv *env, jfieldID fid; fid = env->GetStaticFieldID(cls, "fld1", "I"); - if (fid == NULL) { - printf("(GetStaticFieldID) returns NULL"); + if (fid == nullptr) { + printf("(GetStaticFieldID) returns null"); result = STATUS_FAILED; return result; } @@ -129,14 +129,14 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw002_check(JNIEnv *env, printf(" %s (%d)\n", TranslateError(err), err); } } else { - err = jvmti->SetFieldModificationWatch(NULL, fid); + err = jvmti->SetFieldModificationWatch(nullptr, fid); if (err != JVMTI_ERROR_INVALID_CLASS) { result = STATUS_FAILED; printf("Failed to return JVMTI_ERROR_INVALID_CLASS: %s (%d)\n", TranslateError(err), err); } - err = jvmti->SetFieldModificationWatch(cls, NULL); + err = jvmti->SetFieldModificationWatch(cls, nullptr); if (err != JVMTI_ERROR_INVALID_FIELDID) { result = STATUS_FAILED; printf("Failed to return JVMTI_ERROR_INVALID_FIELDID: %s (%d)\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp index 987fb90913a..c105b647d32 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,14 +47,14 @@ static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jfieldID actual_fid = NULL; +static jfieldID actual_fid = nullptr; static char actual_sig = '\0'; static jint actual_val = 0; static field flds[] = { - { "fld0", 'I', JNI_TRUE, 42, NULL }, - { "fld1", 'I', JNI_TRUE, 43, NULL }, - { "fld2", 'I', JNI_FALSE, 44, NULL }, - { "fld3", 'I', JNI_FALSE, 45, NULL } + { "fld0", 'I', JNI_TRUE, 42, nullptr }, + { "fld1", 'I', JNI_TRUE, 43, nullptr }, + { "fld2", 'I', JNI_FALSE, 44, nullptr }, + { "fld3", 'I', JNI_FALSE, 45, nullptr } }; void JNICALL FieldModification(jvmtiEnv *jvmti_env, JNIEnv *env, @@ -84,12 +84,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -146,7 +146,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw003_getReady(JNIEnv *env, } else { flds[i].fid = env->GetFieldID(cls, flds[i].name, "I"); } - if (flds[i].fid == NULL) { + if (flds[i].fid == nullptr) { printf("Unable to set field modif. watch on fld%" PRIuPTR ", fieldID=0", i); } else { if (printdump == JNI_TRUE) { @@ -162,7 +162,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw003_getReady(JNIEnv *env, } } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -195,7 +195,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw003_check(JNIEnv *env, printf("Field %s: thrown new value expected=%d, actual=%d\n", flds[ind].name, flds[ind].val, actual_val); } - actual_fid = NULL; + actual_fid = nullptr; actual_sig = '\0'; actual_val = 0; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp index 403e2c1eda8..54759a984df 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,14 +47,14 @@ static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jfieldID actual_fid = NULL; +static jfieldID actual_fid = nullptr; static char actual_sig = '\0'; static jint actual_val = 0; static field flds[] = { - { "fld0", 'I', JNI_TRUE, 96, NULL }, - { "fld1", 'I', JNI_TRUE, 97, NULL }, - { "fld2", 'I', JNI_FALSE, 98, NULL }, - { "fld3", 'I', JNI_FALSE, 99, NULL } + { "fld0", 'I', JNI_TRUE, 96, nullptr }, + { "fld1", 'I', JNI_TRUE, 97, nullptr }, + { "fld2", 'I', JNI_FALSE, 98, nullptr }, + { "fld3", 'I', JNI_FALSE, 99, nullptr } }; void JNICALL FieldModification(jvmtiEnv *jvmti_env, JNIEnv *env, @@ -84,12 +84,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -144,7 +144,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_SetFieldModificationWatch_setfmodw004_getR } else { flds[i].fid = env->GetFieldID(cls, flds[i].name, "I"); } - if (flds[i].fid == NULL) { + if (flds[i].fid == nullptr) { printf("Unable to set field modif. watch on fld%" PRIuPTR ", fieldID=0", i); } else { if (printdump == JNI_TRUE) { @@ -160,7 +160,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_SetFieldModificationWatch_setfmodw004_getR } } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -193,7 +193,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw004_check(JNIEnv *env, printf("Field %s: thrown new value expected=%d, actual=%d\n", flds[ind].name, flds[ind].val, actual_val); } - actual_fid = NULL; + actual_fid = nullptr; actual_sig = '\0'; actual_val = 0; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp index 42e22ede75a..34cfdf628b4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,26 +48,26 @@ static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jfieldID actual_fid = NULL; +static jfieldID actual_fid = nullptr; static char actual_sig = '\0'; static jvalue actual_val = {}; static field flds[] = { - { "fld0", "J", JNI_TRUE, "static long", NULL, {} }, - { "fld1", "J", JNI_FALSE, "long", NULL, {} }, - { "fld2", "F", JNI_TRUE, "static float", NULL, {} }, - { "fld3", "F", JNI_FALSE, "float", NULL, {} }, - { "fld4", "D", JNI_TRUE, "static double", NULL, {} }, - { "fld5", "D", JNI_FALSE, "double", NULL, {} }, - { "fld6", "Ljava/lang/Object;", JNI_TRUE, "static Object", NULL, {} }, - { "fld7", "Ljava/lang/Object;", JNI_FALSE, "Object", NULL, {} }, - { "fld8", "Z", JNI_TRUE, "static boolean", NULL, {} }, - { "fld9", "Z", JNI_FALSE, "boolean", NULL, {} }, - { "fld10", "B", JNI_TRUE, "static byte", NULL, {} }, - { "fld11", "B", JNI_FALSE, "byte", NULL, {} }, - { "fld12", "S", JNI_TRUE, "static short", NULL, {} }, - { "fld13", "S", JNI_FALSE, "short", NULL, {} }, - { "fld14", "C", JNI_TRUE, "static char", NULL, {} }, - { "fld15", "C", JNI_FALSE, "char", NULL, {} } + { "fld0", "J", JNI_TRUE, "static long", nullptr, {} }, + { "fld1", "J", JNI_FALSE, "long", nullptr, {} }, + { "fld2", "F", JNI_TRUE, "static float", nullptr, {} }, + { "fld3", "F", JNI_FALSE, "float", nullptr, {} }, + { "fld4", "D", JNI_TRUE, "static double", nullptr, {} }, + { "fld5", "D", JNI_FALSE, "double", nullptr, {} }, + { "fld6", "Ljava/lang/Object;", JNI_TRUE, "static Object", nullptr, {} }, + { "fld7", "Ljava/lang/Object;", JNI_FALSE, "Object", nullptr, {} }, + { "fld8", "Z", JNI_TRUE, "static boolean", nullptr, {} }, + { "fld9", "Z", JNI_FALSE, "boolean", nullptr, {} }, + { "fld10", "B", JNI_TRUE, "static byte", nullptr, {} }, + { "fld11", "B", JNI_FALSE, "byte", nullptr, {} }, + { "fld12", "S", JNI_TRUE, "static short", nullptr, {} }, + { "fld13", "S", JNI_FALSE, "short", nullptr, {} }, + { "fld14", "C", JNI_TRUE, "static char", nullptr, {} }, + { "fld15", "C", JNI_FALSE, "char", nullptr, {} } }; void JNICALL FieldModification(jvmtiEnv *jvmti_env, JNIEnv *env, @@ -133,12 +133,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -216,7 +216,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw005_getReady(JNIEnv *env, } else { flds[i].fid = env->GetFieldID(cls, flds[i].name, flds[i].sig); } - if (flds[i].fid == NULL) { + if (flds[i].fid == nullptr) { printf("Unable to set modification watch on %s fld%" PRIuPTR ", fieldID=0", flds[i].descr, i); } else { @@ -233,7 +233,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw005_getReady(JNIEnv *env, } } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -366,7 +366,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw005_check(JNIEnv *env, default: break; } - actual_fid = NULL; + actual_fid = nullptr; actual_sig = '\0'; actual_val.j = 0L; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp index da74e1a92ca..d4f78706563 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,34 +43,34 @@ typedef struct { jint count; } watch_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static int missesCount = 0; static watch_info watches[] = { - { NULL, "staticBoolean", "Z", JNI_TRUE, 0, 0 }, - { NULL, "staticByte", "B", JNI_TRUE, 0, 0 }, - { NULL, "staticShort", "S", JNI_TRUE, 0, 0 }, - { NULL, "staticInt", "I", JNI_TRUE, 0, 0 }, - { NULL, "staticLong", "J", JNI_TRUE, 0, 0 }, - { NULL, "staticFloat", "F", JNI_TRUE, 0, 0 }, - { NULL, "staticDouble", "D", JNI_TRUE, 0, 0 }, - { NULL, "staticChar", "C", JNI_TRUE, 0, 0 }, - { NULL, "staticObject", "Ljava/lang/Object;", JNI_TRUE, 0, 0 }, - { NULL, "staticArrInt", "[I", JNI_TRUE, 0, 0 }, + { nullptr, "staticBoolean", "Z", JNI_TRUE, 0, 0 }, + { nullptr, "staticByte", "B", JNI_TRUE, 0, 0 }, + { nullptr, "staticShort", "S", JNI_TRUE, 0, 0 }, + { nullptr, "staticInt", "I", JNI_TRUE, 0, 0 }, + { nullptr, "staticLong", "J", JNI_TRUE, 0, 0 }, + { nullptr, "staticFloat", "F", JNI_TRUE, 0, 0 }, + { nullptr, "staticDouble", "D", JNI_TRUE, 0, 0 }, + { nullptr, "staticChar", "C", JNI_TRUE, 0, 0 }, + { nullptr, "staticObject", "Ljava/lang/Object;", JNI_TRUE, 0, 0 }, + { nullptr, "staticArrInt", "[I", JNI_TRUE, 0, 0 }, - { NULL, "instanceBoolean", "Z", JNI_FALSE, 0, 0 }, - { NULL, "instanceByte", "B", JNI_FALSE, 0, 0 }, - { NULL, "instanceShort", "S", JNI_FALSE, 0, 0 }, - { NULL, "instanceInt", "I", JNI_FALSE, 0, 0 }, - { NULL, "instanceLong", "J", JNI_FALSE, 0, 0 }, - { NULL, "instanceFloat", "F", JNI_FALSE, 0, 0 }, - { NULL, "instanceDouble", "D", JNI_FALSE, 0, 0 }, - { NULL, "instanceChar", "C", JNI_FALSE, 0, 0 }, - { NULL, "instanceObject", "Ljava/lang/Object;", JNI_FALSE, 0, 0 }, - { NULL, "instanceArrInt", "[I", JNI_FALSE, 0, 0 } + { nullptr, "instanceBoolean", "Z", JNI_FALSE, 0, 0 }, + { nullptr, "instanceByte", "B", JNI_FALSE, 0, 0 }, + { nullptr, "instanceShort", "S", JNI_FALSE, 0, 0 }, + { nullptr, "instanceInt", "I", JNI_FALSE, 0, 0 }, + { nullptr, "instanceLong", "J", JNI_FALSE, 0, 0 }, + { nullptr, "instanceFloat", "F", JNI_FALSE, 0, 0 }, + { nullptr, "instanceDouble", "D", JNI_FALSE, 0, 0 }, + { nullptr, "instanceChar", "C", JNI_FALSE, 0, 0 }, + { nullptr, "instanceObject", "Ljava/lang/Object;", JNI_FALSE, 0, 0 }, + { nullptr, "instanceArrInt", "[I", JNI_FALSE, 0, 0 } }; @@ -103,12 +103,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -155,7 +155,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw006_getReady(JNIEnv *env, jvmtiError err; size_t i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -185,7 +185,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw006_getReady(JNIEnv *env, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp index 2e6490e34f7..ebe28d895a5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,7 @@ static const char *classSig = "Lnsk/jvmti/SetJNIFunctionTable/setjniftab001a;"; static JavaVM *vm; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static volatile int verbose = 0; @@ -59,10 +59,10 @@ static volatile jobject clsObj; static jrawMonitorID countLock; /* the original JNI function table */ -static jniNativeInterface *orig_jni_functions = NULL; +static jniNativeInterface *orig_jni_functions = nullptr; /* the redirected JNI function table */ -static jniNativeInterface *redir_jni_functions = NULL; +static jniNativeInterface *redir_jni_functions = nullptr; /* number of the redirected JNI function calls */ static volatile int monent_calls = 0; @@ -278,7 +278,7 @@ void startThreads() { thrStarted[i] = 0; waitContElem[i] = i+1; waitThr[i] = THREAD_new(waitingThread, &waitContElem[i]); - if (THREAD_start(waitThr[i]) == NULL) { + if (THREAD_start(waitThr[i]) == nullptr) { printf("TEST FAILURE: cannot start waiting thread #%d\n", i+1); result = STATUS_FAILED; @@ -323,16 +323,16 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_SetJNIFunctionTable_setjniftab001_check(JNIEnv *env, jobject obj) { int exitCode = PASSED; jint res; - JNIEnv *nextEnv = NULL; /* JNI env used to verify the assertion */ + JNIEnv *nextEnv = nullptr; /* JNI env used to verify the assertion */ - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; } clsObj = env->NewGlobalRef(getObjectFromField(env, obj)); - if (clsObj == NULL) { + if (clsObj == nullptr) { printf("(%s,%d): TEST FAILURE: cannot create a new global reference of class \"%s\"\n", __FILE__, __LINE__, classSig); env->FatalError("failed to create a new global reference"); @@ -382,10 +382,10 @@ Java_nsk_jvmti_SetJNIFunctionTable_setjniftab001_check(JNIEnv *env, jobject obj) and check the assertion with current thread and new threads */ if (verbose) printf("\nc) Checking the restored JNI function table ...\n"); - doRestore((nextEnv == NULL) ? env : nextEnv); + doRestore((nextEnv == nullptr) ? env : nextEnv); zeroCounter(); - doExec((nextEnv == NULL) ? env : nextEnv, 0); + doExec((nextEnv == nullptr) ? env : nextEnv, 0); checkCall(2, 0, "main thread"); zeroCounter(); @@ -413,14 +413,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "-verbose") == 0) + if (options != nullptr && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp index 467c7abbb1f..4e3df55cbc8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define STATUS_FAILED 2 static JavaVM *vm; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static int verbose = 0; static jint result = PASSED; @@ -45,7 +45,7 @@ void redirect(JNIEnv *env, jvmtiError exError) { printf("\ntrying to overwrite the JNI function table expecting the error %s to be returned ...\n", TranslateError(exError)); - err = jvmti->SetJNIFunctionTable(NULL); + err = jvmti->SetJNIFunctionTable(nullptr); if (err != exError) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: SetJNIFunctionTable() returns %s instead of %s as expected\n", @@ -60,9 +60,9 @@ void redirect(JNIEnv *env, jvmtiError exError) { JNIEXPORT jint JNICALL Java_nsk_jvmti_SetJNIFunctionTable_setjniftab002_check(JNIEnv *env, jobject obj) { jint res; - JNIEnv *nextEnv = NULL; + JNIEnv *nextEnv = nullptr; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; @@ -114,14 +114,14 @@ JNIEXPORT jint JNI_OnLoad_setjniftab002(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "-verbose") == 0) + if (options != nullptr && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp index e882233178c..52a6e89f175 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -50,7 +50,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, jmethodID mid; jlocation loc; jint entryCount; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; int i; err = jvmti_env->GetFrameLocation(thr, 1, &mid, &loc); @@ -234,7 +234,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, result = STATUS_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (i = 0; i < entryCount; i++) { jvmti_env->Deallocate((unsigned char*)table[i].name); jvmti_env->Deallocate((unsigned char*)table[i].signature); @@ -259,7 +259,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -308,7 +308,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal001_getMethReady(JNIEnv *env, jvmtiError err; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -338,7 +338,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal001_getMethReady(JNIEnv *env, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp index a2dbb7b9698..9ff5b3601f3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -99,7 +99,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal002_check(JNIEnv *env, jclass cls, jthre jvmtiLocalVariableEntry *table; int i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -109,7 +109,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal002_check(JNIEnv *env, jclass cls, jthre } mid = env->GetStaticMethodID(cls, "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find method \"run\"\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp index 144a6614a9e..fa0324b1563 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define INV_SLOT (-1) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -139,12 +139,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -192,7 +192,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal003_getReady(JNIEnv *env, jclass cls) { jvmtiError err; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -202,7 +202,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal003_getReady(JNIEnv *env, jclass cls) { !caps.can_generate_breakpoint_events) return; mid = env->GetStaticMethodID(cls, "checkPoint", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); result = STATUS_FAILED; return; @@ -216,7 +216,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal003_getReady(JNIEnv *env, jclass cls) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp index 397d6e787b4..5ed6e9c5588 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define INV_SLOT (-1) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -145,12 +145,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -198,7 +198,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal004_getReady(JNIEnv *env, jclass cls) { jvmtiError err; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -222,7 +222,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal004_getReady(JNIEnv *env, jclass cls) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix001/SetNativeMethodPrefix001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix001/SetNativeMethodPrefix001.cpp index d9631096901..c18485d4115 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix001/SetNativeMethodPrefix001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix001/SetNativeMethodPrefix001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -108,7 +108,7 @@ static const void *METHODS [METHODS_COUNT] = { /* ============================================================================= */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; /* ============================================================================= */ @@ -120,17 +120,17 @@ Java_nsk_jvmti_SetNativeMethodPrefix_Binder_setMethodPrefix ( ) { jboolean result = JNI_TRUE; - char *str = NULL; + char *str = nullptr; - if (prefix != NULL) { - if (!NSK_VERIFY((str = (char *) jni->GetStringUTFChars(prefix, 0)) != NULL)) + if (prefix != nullptr) { + if (!NSK_VERIFY((str = (char *) jni->GetStringUTFChars(prefix, 0)) != nullptr)) { result = JNI_FALSE; goto finally; } } if (!NSK_JVMTI_VERIFY(jvmti->SetNativeMethodPrefix(str))) { result = JNI_FALSE; goto finally; } - if (str != NULL) { + if (str != nullptr) { NSK_DISPLAY1("New PREFIX is set: %s\n" , str ); @@ -139,7 +139,7 @@ Java_nsk_jvmti_SetNativeMethodPrefix_Binder_setMethodPrefix ( } finally: - if (str != NULL) { + if (str != nullptr) { jni->ReleaseStringUTFChars(prefix, str); } @@ -156,10 +156,10 @@ Java_nsk_jvmti_SetNativeMethodPrefix_Binder_setMultiplePrefixes ( ) { jboolean result = JNI_TRUE; - char *str = NULL; + char *str = nullptr; - if (prefix != NULL) { - if (!NSK_VERIFY((str = (char *) jni->GetStringUTFChars(prefix, 0)) != NULL)) + if (prefix != nullptr) { + if (!NSK_VERIFY((str = (char *) jni->GetStringUTFChars(prefix, 0)) != nullptr)) { result = JNI_FALSE; goto finally; } if (!NSK_JVMTI_VERIFY(jvmti->SetNativeMethodPrefixes(1, (char **) &str))) @@ -170,7 +170,7 @@ Java_nsk_jvmti_SetNativeMethodPrefix_Binder_setMultiplePrefixes ( ); } else { char* prefixes[1]; - prefixes[0] = NULL; + prefixes[0] = nullptr; if (!NSK_JVMTI_VERIFY(jvmti->SetNativeMethodPrefixes(0, (char **)&prefixes))) { result = JNI_FALSE; goto finally; } @@ -179,7 +179,7 @@ Java_nsk_jvmti_SetNativeMethodPrefix_Binder_setMultiplePrefixes ( } finally: - if (str != NULL) { + if (str != nullptr) { jni->ReleaseStringUTFChars(prefix, str); } @@ -209,11 +209,11 @@ Java_nsk_jvmti_SetNativeMethodPrefix_Binder_registerMethod ( return JNI_FALSE; } - if (!NSK_VERIFY((method.name = (char *) jni->GetStringUTFChars(method_name_obj, 0)) != NULL)) { + if (!NSK_VERIFY((method.name = (char *) jni->GetStringUTFChars(method_name_obj, 0)) != nullptr)) { goto finally; } - if (!NSK_VERIFY((method.signature = (char *) jni->GetStringUTFChars(method_sig_obj, 0)) != NULL)) { + if (!NSK_VERIFY((method.signature = (char *) jni->GetStringUTFChars(method_sig_obj, 0)) != nullptr)) { goto finally; } @@ -226,7 +226,7 @@ Java_nsk_jvmti_SetNativeMethodPrefix_Binder_registerMethod ( if (jni->RegisterNatives(bound_klass, (const JNINativeMethod*) &method, 1) != 0) { - if (jni->ExceptionOccurred() != NULL) { + if (jni->ExceptionOccurred() != nullptr) { jni->ExceptionClear(); } @@ -237,11 +237,11 @@ Java_nsk_jvmti_SetNativeMethodPrefix_Binder_registerMethod ( result = JNI_TRUE; finally: - if (method.name != NULL) { + if (method.name != nullptr) { jni->ReleaseStringUTFChars(method_name_obj, method.name); } - if (method.signature != NULL) { + if (method.signature != nullptr) { jni->ReleaseStringUTFChars(method_sig_obj, method.signature); } @@ -273,7 +273,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) return JNI_ERR; if (!NSK_VERIFY( - (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL + (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr ) ) return JNI_ERR; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002.cpp index 7addf0cf052..d4f6e157e64 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,11 +38,11 @@ extern "C" { /* ============================================================================= */ -static char *prefix = NULL; +static char *prefix = nullptr; /* ============================================================================= */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; /* ============================================================================= */ @@ -95,7 +95,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) // Specify native method prefix prefix = (char *)nsk_jvmti_findOptionValue("prefix"); - if (prefix != NULL) { + if (prefix != nullptr) { NSK_DISPLAY1("Prefix: %s\n", prefix); } @@ -103,7 +103,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) apply = nsk_jvmti_findOptionIntValue("apply", 1); if (!NSK_VERIFY( - (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL + (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr ) ) return JNI_ERR; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop002/setsysprop002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop002/setsysprop002.cpp index 0026afe9461..fc622764303 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop002/setsysprop002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop002/setsysprop002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -73,7 +73,7 @@ static PropertyDesc propDescList[PROPERTIES_COUNT] = { static int checkPropertyValue(jvmtiEnv* jvmti, const char phase[], const char name[], const char* expectedValue) { int success = NSK_TRUE; - char* value = NULL; + char* value = nullptr; NSK_DISPLAY1(" property: %s\n", name); if (!NSK_JVMTI_VERIFY(jvmti->GetSystemProperty(name, &value))) { @@ -81,7 +81,7 @@ static int checkPropertyValue(jvmtiEnv* jvmti, const char phase[], } NSK_DISPLAY1(" value: \"%s\"\n", nsk_null_string(value)); - if (value == NULL + if (value == nullptr || strcmp(value, expectedValue) != 0) { NSK_COMPLAIN4("In %s phase GetSystemProperty() returned unexpected value for property:\n" "# property name: %s\n" @@ -174,7 +174,7 @@ JNIEXPORT jint JNI_OnLoad_setsysprop002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -182,7 +182,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Check setting defined system properties in OnLoad phase\n"); @@ -190,7 +190,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { nsk_jvmti_setFailStatus(); } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop003/setsysprop003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop003/setsysprop003.cpp index 841a15c3da9..8d6f9ab12c1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop003/setsysprop003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop003/setsysprop003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -79,7 +79,7 @@ JNIEXPORT jint JNI_OnLoad_setsysprop003(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -87,7 +87,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Set new values for defined system properties in OnLoad phase\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetTag/settag001/settag001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetTag/settag001/settag001.cpp index 3c19fb28ee9..f6f700d7004 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetTag/settag001/settag001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetTag/settag001/settag001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,17 +51,17 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jobject testedObject = NULL; + jobject testedObject = nullptr; jlong objectTag = 111; NSK_DISPLAY0(">>> Obtain tested object from a static field of debugee class\n"); { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -69,7 +69,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -77,14 +77,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Get object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (testedObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)testedObject); NSK_DISPLAY1("Create global reference for object: 0x%p\n", (void*)testedObject); - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -180,7 +180,7 @@ JNIEXPORT jint JNI_OnLoad_settag001(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -190,7 +190,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add required capabilities */ @@ -205,7 +205,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor001/setthrdstor001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor001/setthrdstor001.cpp index c04094a47c6..10b0ab40792 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor001/setthrdstor001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor001/setthrdstor001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,16 +58,16 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthread testedThread = NULL; + jthread testedThread = nullptr; StorageStructure storageData; StorageStructure* initialStorage = &storageData; - StorageStructure* obtainedStorage = NULL; + StorageStructure* obtainedStorage = nullptr; memset(storageData.data, STORAGE_DATA_CHAR, STORAGE_DATA_SIZE); NSK_DISPLAY1("Find thread: %s\n", THREAD_NAME); if (!NSK_VERIFY((testedThread = - nsk_jvmti_threadByName(THREAD_NAME)) != NULL)) + nsk_jvmti_threadByName(THREAD_NAME)) != nullptr)) return; NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread); @@ -148,7 +148,7 @@ JNIEXPORT jint JNI_OnLoad_setthrdstor001(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -158,11 +158,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor002/setthrdstor002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor002/setthrdstor002.cpp index 9528052c9ab..baf6a2a33c7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor002/setthrdstor002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor002/setthrdstor002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,13 +60,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { StorageStructure storageData; StorageStructure* initialStorage = &storageData; - StorageStructure* obtainedStorage = NULL; + StorageStructure* obtainedStorage = nullptr; memset(storageData.data, STORAGE_DATA_CHAR, STORAGE_DATA_SIZE); NSK_DISPLAY1("SetThreadLocalStorage() for current agent thread with pointer: %p\n", (void*)initialStorage); - if (!NSK_JVMTI_VERIFY(jvmti->SetThreadLocalStorage(NULL, (void*)initialStorage))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetThreadLocalStorage(nullptr, (void*)initialStorage))) { nsk_jvmti_setFailStatus(); return; } @@ -80,7 +80,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY0("GetThreadLocalStorage() for current agent thread\n"); - if (!NSK_JVMTI_VERIFY(jvmti->GetThreadLocalStorage(NULL, (void**)&obtainedStorage))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetThreadLocalStorage(nullptr, (void**)&obtainedStorage))) { nsk_jvmti_setFailStatus(); return; } @@ -133,7 +133,7 @@ JNIEXPORT jint JNI_OnLoad_setthrdstor002(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -143,11 +143,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor003/setthrdstor003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor003/setthrdstor003.cpp index ff49c9d060a..74514d40d8d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor003/setthrdstor003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor003/setthrdstor003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -78,7 +78,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { eventsStart = 0; eventsEnd = 0; NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY0("Let tested thread to run\n"); @@ -90,7 +90,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY1("Check if all expected events received for tested thread: %s\n", @@ -117,7 +117,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { JNIEXPORT void JNICALL callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ - if (thread != NULL) { + if (thread != nullptr) { jvmtiThreadInfo info; if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &info))) { @@ -125,14 +125,14 @@ callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { return; } - if (info.name != NULL && strcmp(info.name, THREAD_NAME) == 0) { + if (info.name != nullptr && strcmp(info.name, THREAD_NAME) == 0) { NSK_DISPLAY2(" ... received THREAD_START event for tested thread: %p (%s)\n", (void*)thread, info.name); eventsStart++; NSK_DISPLAY1("SetThreadLocalStorage() for current thread with pointer: %p\n", (void*)initialStorage); - if (!NSK_JVMTI_VERIFY(jvmti->SetThreadLocalStorage(NULL, (void*)initialStorage))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetThreadLocalStorage(nullptr, (void*)initialStorage))) { nsk_jvmti_setFailStatus(); return; } @@ -145,7 +145,7 @@ callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { JNIEXPORT void JNICALL callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ - if (thread != NULL) { + if (thread != nullptr) { jvmtiThreadInfo info; if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &info))) { @@ -153,18 +153,18 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { return; } - if (info.name != NULL && strcmp(info.name, THREAD_NAME) == 0) { + if (info.name != nullptr && strcmp(info.name, THREAD_NAME) == 0) { NSK_DISPLAY2(" ... received THREAD_END event for tested thread: %p (%s)\n", (void*)thread, info.name); eventsEnd++; /* get storage data */ { - StorageStructure* obtainedStorage = NULL; + StorageStructure* obtainedStorage = nullptr; NSK_DISPLAY0("GetThreadLocalStorage() for current thread\n"); if (!NSK_JVMTI_VERIFY( - jvmti->GetThreadLocalStorage(NULL, (void**)&obtainedStorage))) { + jvmti->GetThreadLocalStorage(nullptr, (void**)&obtainedStorage))) { nsk_jvmti_setFailStatus(); return; } @@ -219,7 +219,7 @@ JNIEXPORT jint JNI_OnLoad_setthrdstor003(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -229,7 +229,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* set callbacks for thread events */ @@ -243,7 +243,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag001/setvrbflag001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag001/setvrbflag001.cpp index bc254115f5d..075cdf9a5d4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag001/setvrbflag001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag001/setvrbflag001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -157,7 +157,7 @@ JNIEXPORT jint JNI_OnLoad_setvrbflag001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; jvmtiEventCallbacks callbacks; /* init framework and parse options */ @@ -169,7 +169,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* Create data access lock */ @@ -194,16 +194,16 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* enable VMInit event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; /* enable ClassFileLoadHook event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/setvrbflag002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/setvrbflag002.cpp index 8e43f0cb58b..a00da5d1226 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/setvrbflag002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/setvrbflag002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -70,7 +70,7 @@ JNIEXPORT jint JNI_OnLoad_setvrbflag002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -83,11 +83,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp index 89f43810c1f..f479cc966a6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ Java_nsk_jvmti_StopThread_stopthrd006_check(JNIEnv *env, jclass cls, jthread thr, jobject ex) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -104,7 +104,7 @@ Java_nsk_jvmti_StopThread_stopthrd006_check(JNIEnv *env, if (printdump == JNI_TRUE) { printf(">>> invalid thread check ...\n"); } - err = jvmti->StopThread(NULL, ex); + err = jvmti->StopThread(nullptr, ex); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_signal_thread) { /* It is OK */ @@ -117,7 +117,7 @@ Java_nsk_jvmti_StopThread_stopthrd006_check(JNIEnv *env, if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->StopThread(thr, NULL); + err = jvmti->StopThread(thr, nullptr); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_signal_thread) { /* It is OK */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007/stopthrd007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007/stopthrd007.cpp index da23414ab5c..bf5d20fc8fd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007/stopthrd007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007/stopthrd007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,10 +38,10 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject threadDeath = NULL; -static jthread runningThread = NULL; -static jthread waitingThread = NULL; -static jthread sleepingThread = NULL; +static jobject threadDeath = nullptr; +static jthread runningThread = nullptr; +static jthread waitingThread = nullptr; +static jthread sleepingThread = nullptr; /* ========================================================================== */ @@ -53,10 +53,10 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; - jclass cls = NULL; - jmethodID ctor = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; int i; NSK_DISPLAY0("Prepare: find tested threads\n"); @@ -65,12 +65,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -80,7 +80,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL) { + if (info.name != nullptr) { if (strcmp(info.name, RUNNING_THREAD_NAME) == 0) { runningThread = threads[i]; } else if (strcmp(info.name, WAITING_THREAD_NAME) == 0) { @@ -96,14 +96,14 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY0("Prepare: create new instance of ThreadDeath exception\n"); - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (threadDeath = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadDeath = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -124,7 +124,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #1: call StopThread for runningThread\n"); - if (!NSK_VERIFY(runningThread != NULL)) { + if (!NSK_VERIFY(runningThread != nullptr)) { nsk_jvmti_setFailStatus(); } else { if (!NSK_JVMTI_VERIFY(jvmti->StopThread(runningThread, threadDeath))) @@ -132,7 +132,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #2: call StopThread for waitingThread\n"); - if (!NSK_VERIFY(waitingThread != NULL)) { + if (!NSK_VERIFY(waitingThread != nullptr)) { nsk_jvmti_setFailStatus(); } else { if (!NSK_JVMTI_VERIFY(jvmti->StopThread(waitingThread, threadDeath))) @@ -140,7 +140,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #3: call StopThread for sleepingThread\n"); - if (!NSK_VERIFY(sleepingThread != NULL)) { + if (!NSK_VERIFY(sleepingThread != nullptr)) { nsk_jvmti_setFailStatus(); } else { if (!NSK_JVMTI_VERIFY(jvmti->StopThread(sleepingThread, threadDeath))) @@ -166,7 +166,7 @@ JNIEXPORT jint JNI_OnLoad_stopthrd007(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -177,10 +177,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd001/suspendthrd001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd001/suspendthrd001.cpp index 5d346b9bf98..97da3e1dec1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd001/suspendthrd001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd001/suspendthrd001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,11 +49,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthread testedThread = NULL; + jthread testedThread = nullptr; NSK_DISPLAY1("Find thread: %s\n", THREAD_NAME); if (!NSK_VERIFY((testedThread = - nsk_jvmti_threadByName(THREAD_NAME)) != NULL)) + nsk_jvmti_threadByName(THREAD_NAME)) != nullptr)) return; NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread); @@ -118,7 +118,7 @@ JNIEXPORT jint JNI_OnLoad_suspendthrd001(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -128,7 +128,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -141,7 +141,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd002/suspendthrd002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd002/suspendthrd002.cpp index 98a415315b4..d9eff84b63f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd002/suspendthrd002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd002/suspendthrd002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,7 +49,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { }; static volatile int eventsReceived = 0; -static jthread testedThread = NULL; +static jthread testedThread = nullptr; /* ============================================================================= */ @@ -65,13 +65,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { NSK_DISPLAY1("Find thread: %s\n", THREAD_NAME); if (!NSK_VERIFY((testedThread = - nsk_jvmti_threadByName(THREAD_NAME)) != NULL)) + nsk_jvmti_threadByName(THREAD_NAME)) != nullptr)) return; NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread); eventsReceived = 0; NSK_DISPLAY1("Enable event: %s\n", "THREAD_END"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY1("Suspend thread: %p\n", (void*)testedThread); @@ -99,7 +99,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY1("Disable event: %s\n", "THREAD_END"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY1("Resume thread: %p\n", (void*)testedThread); @@ -126,7 +126,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { JNIEXPORT void JNICALL callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ - if (thread != NULL && + if (thread != nullptr && jni->IsSameObject(testedThread, thread)) { NSK_DISPLAY1(" ... received THREAD_END event for tested thread: %p\n", (void*)thread); eventsReceived++; @@ -150,7 +150,7 @@ JNIEXPORT jint JNI_OnLoad_suspendthrd002(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -160,7 +160,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -182,7 +182,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/suspendthrd003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/suspendthrd003.cpp index 265d6b3d358..e172af654c8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/suspendthrd003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/suspendthrd003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,11 +52,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthread testedThread = NULL; + jthread testedThread = nullptr; NSK_DISPLAY1("Find thread: %s\n", THREAD_NAME); if (!NSK_VERIFY((testedThread = - nsk_jvmti_threadByName(THREAD_NAME)) != NULL)) + nsk_jvmti_threadByName(THREAD_NAME)) != nullptr)) return; NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread); @@ -150,7 +150,7 @@ JNIEXPORT jint JNI_OnLoad_suspendthrd003(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -160,7 +160,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -173,7 +173,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst001/suspendthrdlst001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst001/suspendthrdlst001.cpp index bf17ed9a711..514dcbd43e9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst001/suspendthrdlst001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst001/suspendthrdlst001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,8 +57,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthread* threads = NULL; - jvmtiError* results = NULL; + jthread* threads = nullptr; + jvmtiError* results = nullptr; int i; NSK_DISPLAY1("Allocate threads array: %d threads\n", threadsCount); @@ -130,7 +130,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Delete threads references\n"); for (i = 0; i < threadsCount; i++) { - if (threads[i] != NULL) + if (threads[i] != nullptr) NSK_TRACE(jni->DeleteGlobalRef(threads[i])); } @@ -156,14 +156,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, const char name[], int foundCount, jthread foundThreads[]) { jint count = 0; - jthread* threads = NULL; + jthread* threads = nullptr; size_t len = strlen(name); int found = 0; int i; for (i = 0; i < foundCount; i++) { - foundThreads[i] = NULL; + foundThreads[i] = nullptr; } if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&count, &threads))) { @@ -180,7 +180,7 @@ static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, break; } - if (info.name != NULL && strncmp(name, info.name, len) == 0) { + if (info.name != nullptr && strncmp(name, info.name, len) == 0) { NSK_DISPLAY3(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name); if (found < foundCount) @@ -208,7 +208,7 @@ static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, NSK_DISPLAY1("Make global references for threads: %d threads\n", foundCount); for (i = 0; i < foundCount; i++) { if (!NSK_JNI_VERIFY(jni, (foundThreads[i] = (jthread) - jni->NewGlobalRef(foundThreads[i])) != NULL)) { + jni->NewGlobalRef(foundThreads[i])) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -233,7 +233,7 @@ JNIEXPORT jint JNI_OnLoad_suspendthrdlst001(JavaVM *jvm, char *options, void *re } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -248,7 +248,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -261,7 +261,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst002/suspendthrdlst002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst002/suspendthrdlst002.cpp index 1145bb3c1cb..31406434c49 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst002/suspendthrdlst002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst002/suspendthrdlst002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { }; static int threadsCount = 0; -static jthread* threads = NULL; +static jthread* threads = nullptr; static volatile int eventsReceived = 0; @@ -69,7 +69,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jvmtiError* results = NULL; + jvmtiError* results = nullptr; int i; NSK_DISPLAY1("Allocate threads array: %d threads\n", threadsCount); @@ -108,7 +108,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { eventsReceived = 0; NSK_DISPLAY1("Enable event: %s\n", "THREAD_END"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY0("Let threads to run and finish\n"); @@ -131,7 +131,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY1("Disable event: %s\n", "THREAD_END"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY0("Resume threads list\n"); @@ -146,7 +146,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Delete threads references\n"); for (i = 0; i < threadsCount; i++) { - if (threads[i] != NULL) + if (threads[i] != nullptr) NSK_TRACE(jni->DeleteGlobalRef(threads[i])); } @@ -172,14 +172,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, const char name[], int foundCount, jthread foundThreads[]) { jint count = 0; - jthread* threads = NULL; + jthread* threads = nullptr; size_t len = strlen(name); int found = 0; int i; for (i = 0; i < foundCount; i++) { - foundThreads[i] = NULL; + foundThreads[i] = nullptr; } if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&count, &threads))) { @@ -196,7 +196,7 @@ static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, break; } - if (info.name != NULL && strncmp(name, info.name, len) == 0) { + if (info.name != nullptr && strncmp(name, info.name, len) == 0) { NSK_DISPLAY3(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name); if (found < foundCount) @@ -224,7 +224,7 @@ static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, NSK_DISPLAY1("Make global references for threads: %d threads\n", foundCount); for (i = 0; i < foundCount; i++) { if (!NSK_JNI_VERIFY(jni, (foundThreads[i] = (jthread) - jni->NewGlobalRef(foundThreads[i])) != NULL)) { + jni->NewGlobalRef(foundThreads[i])) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -243,7 +243,7 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ for (i = 0; i < threadsCount; i++) { - if (thread != NULL && + if (thread != nullptr && jni->IsSameObject(threads[i], thread)) { NSK_DISPLAY2(" ... received THREAD_END event for thread #%d: %p\n", i, (void*)thread); @@ -269,7 +269,7 @@ JNIEXPORT jint JNI_OnLoad_suspendthrdlst002(JavaVM *jvm, char *options, void *re } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -284,7 +284,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -306,7 +306,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp index 887b217608d..4eabc000abf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; /** callback functions **/ @@ -81,7 +81,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0("setting event callbacks ...\n"); @@ -91,7 +91,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling VMDeath event ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling VMDeath event done\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp index 7480242377a..5346f1b41fa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define WAIT_TIME 1000 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -52,7 +52,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) { } err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_THREAD_START, NULL); + JVMTI_EVENT_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err); @@ -107,7 +107,7 @@ void JNICALL ThreadStart(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread) { if (printdump == JNI_TRUE) { printf(">>> thread start: %s\n", inf.name); } - if (inf.name != NULL && strcmp(name, inf.name) == 0) { + if (inf.name != nullptr && strcmp(name, inf.name) == 0) { mainStarted++; if (eventsCount == 0) { printf("ThreadStart event for the main thread occurs\n"); @@ -132,12 +132,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -152,7 +152,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); @@ -164,7 +164,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT jint JNICALL Java_nsk_jvmti_VMInit_vminit001_check(JNIEnv *env, jclass cls) { - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp index 667396da93e..e2210d23b64 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,8 +39,8 @@ extern "C" { #define EXP_OBJ_NUMBER 7 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -146,17 +146,17 @@ Java_nsk_jvmti_scenarios_allocation_AP01_ap01t001_newObject(JNIEnv* jni, jclass jmethodID cid; jobject result; - if (!NSK_JNI_VERIFY(jni, (cid = jni->GetMethodID(cls, "", "()V")) != NULL)) { - NSK_COMPLAIN0("newObject: GetMethodID returned NULL\n\n"); + if (!NSK_JNI_VERIFY(jni, (cid = jni->GetMethodID(cls, "", "()V")) != nullptr)) { + NSK_COMPLAIN0("newObject: GetMethodID returned null\n\n"); nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } - if (!NSK_JNI_VERIFY(jni, (result = jni->NewObject(cls, cid)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (result = jni->NewObject(cls, cid)) != nullptr)) { - NSK_COMPLAIN0("newObject: NewObject returned NULL\n\n"); + NSK_COMPLAIN0("newObject: NewObject returned null\n\n"); nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } return result; @@ -167,25 +167,25 @@ Java_nsk_jvmti_scenarios_allocation_AP01_ap01t001_allocObject(JNIEnv* jni, jclas jmethodID cid; jobject result; - if (!NSK_JNI_VERIFY(jni, (cid = jni->GetMethodID(cls, "", "()V")) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (cid = jni->GetMethodID(cls, "", "()V")) != nullptr)) { - NSK_COMPLAIN0("allocObject: GetMethodID returned NULL\n\n"); + NSK_COMPLAIN0("allocObject: GetMethodID returned null\n\n"); nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } - if (!NSK_JNI_VERIFY(jni, (result = jni->AllocObject(cls)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (result = jni->AllocObject(cls)) != nullptr)) { - NSK_COMPLAIN0("allocObject: AllocObject returned NULL\n\n"); + NSK_COMPLAIN0("allocObject: AllocObject returned null\n\n"); nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } if (!NSK_JNI_VERIFY_VOID(jni,jni->CallNonvirtualVoidMethod(result, cls, cid))) { NSK_COMPLAIN0("newObject: CallNonvirtualVoidMethod failed\n\n"); nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } return result; @@ -196,7 +196,7 @@ Java_nsk_jvmti_scenarios_allocation_AP01_ap01t001_flushObjectFreeEvents(JNIEnv* // Already enabled, but this triggers flush of pending events. if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) { + nullptr))) { nsk_jvmti_setFailStatus(); } } @@ -204,7 +204,7 @@ Java_nsk_jvmti_scenarios_allocation_AP01_ap01t001_flushObjectFreeEvents(JNIEnv* static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -212,7 +212,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_SIGNATURE); debugeeClass = nsk_jvmti_classBySignature(DEBUGEE_SIGNATURE); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); return; } @@ -313,7 +313,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -343,15 +343,15 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) + nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, - NULL))) + nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp index 409784d43ea..9697e1d1ef6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,8 +38,8 @@ extern "C" { #define TESTED_CLASS "ap02t001Exception" -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -50,7 +50,7 @@ static jlong timeout = 0; static int user_data = 0; static const char* TESTED_CLASS_SIGNATURE = "Lnsk/jvmti/scenarios/allocation/AP02/ap02t001Exception;"; static const jlong TESTED_CLASS_TAG = (jlong)1024; -static jclass testedClass = NULL; +static jclass testedClass = nullptr; jvmtiIterationControl JNICALL heapObjectCallback(jlong class_tag, @@ -142,9 +142,9 @@ static void runIterations (jvmtiEnv* jvmti, jclass testedClass, jint exp_count) NSK_DISPLAY0("Calling IterateOverReachableObjects\n"); obj_count = 0; - if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(NULL /*heapRootCallback*/, + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(nullptr /*heapRootCallback*/, stackReferenceCallback, - NULL /*objectReferenceCallback*/, + nullptr /*objectReferenceCallback*/, &user_data))) { nsk_jvmti_setFailStatus(); return; @@ -173,12 +173,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find tested class: %s\n", TESTED_CLASS_SIGNATURE); testedClass = nsk_jvmti_classBySignature(TESTED_CLASS_SIGNATURE); - if (testedClass == NULL) { + if (testedClass == nullptr) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)jni->NewGlobalRef(testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)jni->NewGlobalRef(testedClass)) != nullptr)) return; NSK_DISPLAY0("Set tag for tested class\n\n"); @@ -222,7 +222,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -236,7 +236,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!caps.can_tag_objects) NSK_DISPLAY0("Warning: tagging objects is not implemented\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp index 0ebfdadeafc..4e7473be5b6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,8 +35,8 @@ extern "C" { #define EXP_OBJ_NUMBER 1 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -98,7 +98,7 @@ Java_nsk_jvmti_scenarios_allocation_AP03_ap03t001_setTag(JNIEnv* jni, jobject ob static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -110,7 +110,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_SIGNATURE); debugeeClass = nsk_jvmti_classBySignature(DEBUGEE_SIGNATURE); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } @@ -160,14 +160,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(debugeeClass, "catcher", DEBUGEE_SIGNATURE)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, "catcher", DEBUGEE_SIGNATURE)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } if (!NSK_JNI_VERIFY(jni, (catcher = - jni->GetStaticObjectField(debugeeClass, fid)) != NULL)) { - NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'catcher' field value\n\n"); + jni->GetStaticObjectField(debugeeClass, fid)) != nullptr)) { + NSK_COMPLAIN0("GetStaticObjectField returned null for 'catcher' field value\n\n"); nsk_jvmti_setFailStatus(); break; } @@ -215,7 +215,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -244,11 +244,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) + nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp index cf79fe945a1..eea3e881ccd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,8 +35,8 @@ extern "C" { #define OBJ_MAX_COUNT 100000 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -52,9 +52,9 @@ static jvmtiEvent events[] = { JVMTI_EVENT_GARBAGE_COLLECTION_FINISH }; -static jclass debugeeClass = NULL; -static jfieldID rootFieldID = NULL; -static jmethodID unlockSecondaryID = NULL; +static jclass debugeeClass = nullptr; +static jfieldID rootFieldID = nullptr; +static jmethodID unlockSecondaryID = nullptr; static volatile int eventCount = 0; static volatile int iterationCount = 0; @@ -62,7 +62,7 @@ static volatile int errorCount = 0; /***********************************************************************/ -static jrawMonitorID counterMonitor_ptr = NULL; +static jrawMonitorID counterMonitor_ptr = nullptr; static void increaseCounter(volatile int* counterPtr) { @@ -269,7 +269,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverHeap(JNIEnv* jni NSK_DISPLAY0("Calling IterateOverHeap...\n"); if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverHeap finished.\n"); @@ -298,7 +298,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverReachableObjects if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback, stackReferenceCallback, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverReachableObjects finished.\n"); @@ -327,7 +327,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverInstancesOfClass if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass, JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverInstancesOfClass finished.\n"); @@ -347,12 +347,12 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverObjectsReachableFromObject(JNIEnv* jni, jclass klass) { - jobject root = NULL; + jobject root = nullptr; int count = 0; if (!NSK_JNI_VERIFY(jni, (root = - jni->GetStaticObjectField(debugeeClass, rootFieldID)) != NULL)) { - NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'root' field value\n\n"); + jni->GetStaticObjectField(debugeeClass, rootFieldID)) != nullptr)) { + NSK_COMPLAIN0("GetStaticObjectField returned null for 'root' field value\n\n"); nsk_jvmti_setFailStatus(); return; } @@ -367,7 +367,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverObjectsReachable NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject...\n"); if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(root, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverObjectsReachableFromObject finished.\n"); @@ -392,24 +392,24 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_SIGNATURE); debugeeClass = nsk_jvmti_classBySignature(DEBUGEE_SIGNATURE); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != nullptr)) return; NSK_DISPLAY1("Find ID of 'root' field: %s\n", ROOT_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (rootFieldID = - jni->GetStaticFieldID(debugeeClass, "root", ROOT_SIGNATURE)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, "root", ROOT_SIGNATURE)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1("Find ID of 'unlockSecondary' method: %s\n", ROOT_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (unlockSecondaryID = - jni->GetStaticMethodID(debugeeClass, "unlockSecondary", "()V")) != NULL)) { + jni->GetStaticMethodID(debugeeClass, "unlockSecondary", "()V")) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -423,7 +423,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) return; - nsk_jvmti_enableEvents(JVMTI_DISABLE, eventsCount, events, NULL); + nsk_jvmti_enableEvents(JVMTI_DISABLE, eventsCount, events, nullptr); NSK_TRACE(jni->DeleteGlobalRef(debugeeClass)); NSK_TRACE(jvmti->DestroyRawMonitor(counterMonitor_ptr)); @@ -451,7 +451,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("counterMonitor", &counterMonitor_ptr))) { @@ -489,12 +489,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done.\n"); NSK_DISPLAY0("enabling JVMTI events ...\n"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, eventsCount, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, eventsCount, events, nullptr)) { return JNI_ERR; } NSK_DISPLAY0("enabling the events done.\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp index f42bb0d8680..e9f43a1cbaf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,8 +35,8 @@ extern "C" { #define OBJ_MAX_COUNT 100000 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -49,13 +49,13 @@ static volatile int modificationCount = 0; static volatile int iterationCount = 0; static volatile int errorCount = 0; -static jclass debugeeClass = NULL; +static jclass debugeeClass = nullptr; static jfieldID rootFieldID; static jfieldID modifiedFieldID; /***********************************************************************/ -static jrawMonitorID counterMonitor_ptr = NULL; +static jrawMonitorID counterMonitor_ptr = nullptr; static void increaseCounter(volatile int* counterPtr) { @@ -249,7 +249,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t002_runIterateOverHeap(JNIEnv* jni NSK_DISPLAY0("Calling IterateOverHeap...\n"); if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverHeap finished.\n"); @@ -279,7 +279,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t002_runIterateOverReachableObjects if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback, stackReferenceCallback, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverReachableObjects finished.\n"); @@ -309,7 +309,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t002_runIterateOverInstancesOfClass if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass, JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverInstancesOfClass finished.\n"); @@ -329,12 +329,12 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t002_runIterateOverInstancesOfClass JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_allocation_AP04_ap04t002_runIterateOverObjectsReachableFromObject(JNIEnv* jni, jclass klass) { - jobject root = NULL; + jobject root = nullptr; int count = 0; if (!NSK_JNI_VERIFY(jni, (root = - jni->GetStaticObjectField(debugeeClass, rootFieldID)) != NULL)) { - NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'root' field value\n\n"); + jni->GetStaticObjectField(debugeeClass, rootFieldID)) != nullptr)) { + NSK_COMPLAIN0("GetStaticObjectField returned null for 'root' field value\n\n"); nsk_jvmti_setFailStatus(); return; } @@ -346,7 +346,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t002_runIterateOverObjectsReachable NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject...\n"); if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(root, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverObjectsReachableFromObject finished.\n"); @@ -372,24 +372,24 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_SIGNATURE); debugeeClass = nsk_jvmti_classBySignature(DEBUGEE_SIGNATURE); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != nullptr)) return; NSK_DISPLAY1("Find ID of 'root' field: %s\n", ROOT_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (rootFieldID = - jni->GetStaticFieldID(debugeeClass, "root", ROOT_SIGNATURE)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, "root", ROOT_SIGNATURE)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY0("Find ID of 'modified' field\n"); if (!NSK_JNI_VERIFY(jni, (modifiedFieldID = - jni->GetStaticFieldID(debugeeClass, "modified", "I")) != NULL)) { + jni->GetStaticFieldID(debugeeClass, "modified", "I")) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -434,7 +434,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("counterMonitor", &counterMonitor_ptr))) { @@ -469,11 +469,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("enabling JVMTI events ...\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, - NULL))) + nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done.\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp index 99f4ec37019..4e0673b608d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,8 +35,8 @@ extern "C" { #define OBJ_MAX_COUNT 100000 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -45,19 +45,19 @@ static jlong timeout = 0; static const char* DEBUGEE_SIGNATURE = "Lnsk/jvmti/scenarios/allocation/AP04/ap04t003;"; static const char* ROOT_SIGNATURE = "[Lnsk/jvmti/scenarios/allocation/AP04/ap04t003;"; -static jclass debugeeClass = NULL; +static jclass debugeeClass = nullptr; static jfieldID rootFieldID; -static jrawMonitorID startLock = NULL; -static jrawMonitorID runLock = NULL; -static jrawMonitorID endLock = NULL; +static jrawMonitorID startLock = nullptr; +static jrawMonitorID runLock = nullptr; +static jrawMonitorID endLock = nullptr; static volatile int iterationCount = 0; static volatile int objectCount = 0; /***********************************************************************/ -static jrawMonitorID counterMonitor_ptr = NULL; +static jrawMonitorID counterMonitor_ptr = nullptr; static void increaseCounter(volatile int* counterPtr) { @@ -210,7 +210,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, void JNICALL agent_start(jvmtiEnv* jvmti, JNIEnv* jni, void *p) { jint taggedObjectsCount = 0; - jobject* taggedObjectsList = NULL; + jobject* taggedObjectsList = nullptr; NSK_DISPLAY0("Agent thread: started.\n"); @@ -219,7 +219,7 @@ void JNICALL agent_start(jvmtiEnv* jvmti, JNIEnv* jni, void *p) { jlong tag = (jlong)1; if (!NSK_JVMTI_VERIFY(jvmti->GetObjectsWithTags( - 1, &tag, &taggedObjectsCount, &taggedObjectsList, NULL))) { + 1, &tag, &taggedObjectsCount, &taggedObjectsList, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -315,7 +315,7 @@ static int startThread(jthread threadObj) { /* start thread */ if (!NSK_JVMTI_VERIFY( - jvmti->RunAgentThread(threadObj, agent_start, NULL, JVMTI_THREAD_NORM_PRIORITY))) { + jvmti->RunAgentThread(threadObj, agent_start, nullptr, JVMTI_THREAD_NORM_PRIORITY))) { success = NSK_FALSE; nsk_jvmti_setFailStatus(); } else { @@ -348,7 +348,7 @@ static jthread newThreadObj(JNIEnv* jni_env) { /** Clean counters and start new agent thread with agent_start() body. */ static int prepareToIteration(JNIEnv* jni) { - jthread threadObj = NULL; + jthread threadObj = nullptr; setCounter(&iterationCount, 0); setCounter(&objectCount, 0); @@ -408,7 +408,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t003_runIterateOverHeap(JNIEnv* jni NSK_DISPLAY0("Calling IterateOverHeap...\n"); if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverHeap finished.\n"); @@ -439,7 +439,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t003_runIterateOverReachableObjects if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback, stackReferenceCallback, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverReachableObjects finished.\n"); @@ -470,7 +470,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t003_runIterateOverInstancesOfClass if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass, JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverInstancesOfClass finished.\n"); @@ -492,7 +492,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_allocation_AP04_ap04t003_runIterateOverObjectsReachableFromObject(JNIEnv* jni_env, jclass klass) { ExceptionCheckingJniEnvPtr ec_jni(jni_env); - jobject root = NULL; + jobject root = nullptr; int modified = 0; int found = 0; @@ -504,7 +504,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t003_runIterateOverObjectsReachable NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject...\n"); if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(root, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverObjectsReachableFromObject finished.\n"); @@ -531,7 +531,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni_env, void* arg) { NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_SIGNATURE); debugeeClass = nsk_jvmti_classBySignature(DEBUGEE_SIGNATURE); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); return; } @@ -579,7 +579,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("counterMonitor", &counterMonitor_ptr))) { @@ -608,7 +608,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!caps.can_tag_objects) NSK_DISPLAY0("Warning: tagging objects is not available\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp index b2b5f5cbb1b..64cd66bac55 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,13 +35,13 @@ extern "C" { #define EXP_OBJ_NUMBER 1 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jlong timeout = 0; -static jobject referrer = NULL; +static jobject referrer = nullptr; static const char* SUBCLASS_SIGNATURE = "Lnsk/jvmti/scenarios/allocation/AP05/ap05t001Subclass;"; static const int EXPECTED_STATIC_FIELDS_COUNT = 8; /* 8 ones declared in ap05t001Superclass + 8 ones declared in ap05t001Subclass */ @@ -112,14 +112,14 @@ Java_nsk_jvmti_scenarios_allocation_AP05_ap05t001_setTag(JNIEnv* jni, JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_allocation_AP05_ap05t001_setReferrer(JNIEnv* jni, jclass klass, jobject ref) { - if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != nullptr)) nsk_jvmti_setFailStatus(); } static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -132,7 +132,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback, stackReferenceCallback, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); break; } @@ -154,7 +154,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("\nCalling IterateOverObjectsReachableFromObject\n"); { if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject( - referrer, objectReferenceCallback, NULL /*user_data*/))) { + referrer, objectReferenceCallback, nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); break; } @@ -200,7 +200,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -215,7 +215,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!caps.can_tag_objects) NSK_DISPLAY0("Warning: tagging objects is not implemented\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp index 2d625ee9e96..b3e5fe567f6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,13 +35,13 @@ extern "C" { #define EXP_OBJ_NUMBER 1 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jlong timeout = 0; -static jobject referrer = NULL; +static jobject referrer = nullptr; static const char* SUBCLASS_SIGNATURE = "Lnsk/jvmti/scenarios/allocation/AP05/ap05t002Subclass;"; static const long TAG1 = 1l, TAG2 = 2l; static int caseNumber = 0, forthRef = 0, backRef = 0; @@ -111,7 +111,7 @@ Java_nsk_jvmti_scenarios_allocation_AP05_ap05t002_setTag(JNIEnv* jni, JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_allocation_AP05_ap05t002_setReferrer(JNIEnv* jni, jclass klass, jobject ref, jint caseNum) { caseNumber = caseNum; - if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != nullptr)) nsk_jvmti_setFailStatus(); } @@ -122,7 +122,7 @@ static void runCase() { if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback, stackReferenceCallback, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } if (forthRef != 1) { @@ -141,7 +141,7 @@ static void runCase() { backRef = 0; if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(referrer, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } if (forthRef != 1) { @@ -159,7 +159,7 @@ static void runCase() { static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -204,7 +204,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -219,7 +219,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!caps.can_tag_objects) NSK_DISPLAY0("Warning: tagging objects is not implemented\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP06/ap06t001/ap06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP06/ap06t001/ap06t001.cpp index b624c673683..dafd0a59b1e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP06/ap06t001/ap06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP06/ap06t001/ap06t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,8 +35,8 @@ extern "C" { #define EXP_OBJ_NUMBER 1 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -134,7 +134,7 @@ Java_nsk_jvmti_scenarios_allocation_AP06_ap06t001Thread_setTag(JNIEnv* jni, jobj static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -147,32 +147,32 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_SIGNATURE); debugeeClass = nsk_jvmti_classBySignature(DEBUGEE_SIGNATURE); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(debugeeClass, "thread", THREAD_CLS_SIGNATURE)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, "thread", THREAD_CLS_SIGNATURE)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } if (!NSK_JNI_VERIFY(jni, (localRefThread = - jni->GetStaticObjectField(debugeeClass, fid)) != NULL)) { - NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'thread' field value\n\n"); + jni->GetStaticObjectField(debugeeClass, fid)) != nullptr)) { + NSK_COMPLAIN0("GetStaticObjectField returned null for 'thread' field value\n\n"); nsk_jvmti_setFailStatus(); break; } - if (!NSK_JNI_VERIFY(jni, (globalRefThread = jni->NewGlobalRef(localRefThread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (globalRefThread = jni->NewGlobalRef(localRefThread)) != nullptr)) return; NSK_DISPLAY0("Calling IterateOverReachableObjects\n"); if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback, stackReferenceCallback, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); break; } @@ -220,7 +220,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -235,7 +235,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!caps.can_tag_objects) NSK_DISPLAY0("Warning: tagging objects is not implemented\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t001/ap07t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t001/ap07t001.cpp index 52988ac2469..16831e35524 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t001/ap07t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t001/ap07t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,13 +35,13 @@ extern "C" { #define EXP_OBJ_NUMBER 1 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jlong timeout = 0; -static jobject root = NULL; +static jobject root = nullptr; static const char* DEBUGEE_SIGNATURE = "Lnsk/jvmti/scenarios/allocation/AP07/ap07t001;"; static const jlong IGNORE_TAG = (jlong)10l; @@ -118,14 +118,14 @@ Java_nsk_jvmti_scenarios_allocation_AP07_ap07t001_setTag(JNIEnv* jni, JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_allocation_AP07_ap07t001_setRoot(JNIEnv* jni, jobject obj) { - if (!NSK_JNI_VERIFY(jni, (root = jni->NewGlobalRef(obj)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (root = jni->NewGlobalRef(obj)) != nullptr)) nsk_jvmti_setFailStatus(); } static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -137,7 +137,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback, stackReferenceCallback, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); break; } @@ -145,7 +145,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject\n"); { if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject( - root, objectReferenceCallback, NULL /*user_data*/))) { + root, objectReferenceCallback, nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); break; } @@ -178,7 +178,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -193,7 +193,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!caps.can_tag_objects) NSK_DISPLAY0("Warning: tagging objects is not implemented\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t002/ap07t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t002/ap07t002.cpp index 4b5e95344f1..01fbb9471ac 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t002/ap07t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t002/ap07t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,13 +35,13 @@ extern "C" { #define EXP_OBJ_NUMBER 1 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jlong timeout = 0; -static jobject root = NULL; +static jobject root = nullptr; static const char* DEBUGEE_SIGNATURE = "Lnsk/jvmti/scenarios/allocation/AP07/ap07t002;"; static const jlong IGNORE_TAG = (jlong)10l; @@ -119,7 +119,7 @@ Java_nsk_jvmti_scenarios_allocation_AP07_ap07t002_setTag(JNIEnv* jni, static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -131,7 +131,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback, stackReferenceCallback, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); break; } @@ -161,7 +161,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -176,7 +176,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!caps.can_tag_objects) NSK_DISPLAY0("Warning: tagging objects is not implemented\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP09/ap09t001/ap09t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP09/ap09t001/ap09t001.cpp index 00b866d1e92..229f7dba9b7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP09/ap09t001/ap09t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP09/ap09t001/ap09t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,13 +35,13 @@ extern "C" { #define EXP_OBJ_NUMBER 1 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jlong timeout = 0; -static jobject referrer = NULL; +static jobject referrer = nullptr; static const char* DEBUGEE_SIGNATURE = "Lnsk/jvmti/scenarios/allocation/AP09/ap09t001;"; static const long OBJECT_TAG = 1l; static const long CLASS_TAG = 2l; @@ -139,14 +139,14 @@ Java_nsk_jvmti_scenarios_allocation_AP09_ap09t001_setTag(JNIEnv* jni, JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_allocation_AP09_ap09t001_setReferrer(JNIEnv* jni, jclass klass, jobject ref) { - if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != nullptr)) nsk_jvmti_setFailStatus(); } static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -156,7 +156,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("\nCalling IterateOverObjectsReachableFromObject\n"); if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(referrer, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } if (!classFound) { @@ -214,7 +214,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -231,7 +231,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp index d4977a45a26..fdc0e50273c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ extern "C" { #define MAX_SIZE 256 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -56,7 +56,7 @@ typedef struct _LocalStorage { static LocalStorage stor; static void envStorageFunc(jvmtiEnv *jvmti_env, const char *msg) { - LocalStorage* obtainedData = NULL; + LocalStorage* obtainedData = nullptr; LocalStorage* storedData = &stor; NSK_DISPLAY2("%s: setting an environment local storage 0x%p ...\n", @@ -259,7 +259,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to generate compiled method events */ @@ -296,19 +296,19 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, - NULL))) + nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, - NULL))) + nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) + nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp index 8f9d67ac6cf..59b35902bad 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,14 +46,14 @@ static int lookup(jvmtiEnv* jvmti, if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(classes[i], &signature, &generic))) break; - if (signature != NULL && strcmp(signature, exp_sig) == 0) { + if (signature != nullptr && strcmp(signature, exp_sig) == 0) { found = NSK_TRUE; } - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); - if (generic != NULL) + if (generic != nullptr) jvmti->Deallocate((unsigned char*)generic); } @@ -141,7 +141,7 @@ VMObjectAlloc(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jobject object, return; } - if (classes != NULL) + if (classes != nullptr) jvmti->Deallocate((unsigned char*)classes); } while (0); @@ -174,10 +174,10 @@ VMObjectAlloc(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jobject object, } } while (0); - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); - if (generic != NULL) + if (generic != nullptr) jvmti->Deallocate((unsigned char*)generic); } @@ -210,7 +210,7 @@ JNIEXPORT jint JNI_OnLoad_ap11t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -223,7 +223,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -239,11 +239,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* enable VMObjectAlloc event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, nullptr))) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp index b5236d993c1..c34bb8891f6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,8 +39,8 @@ extern "C" { #define EXP_OBJ_FREE 2 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -89,7 +89,7 @@ Java_nsk_jvmti_scenarios_allocation_AP12_ap12t001_flushObjectFreeEvents(JNIEnv* // Already enabled, but this triggers flush of pending events. if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) { + nullptr))) { nsk_jvmti_setFailStatus(); } } @@ -97,7 +97,7 @@ Java_nsk_jvmti_scenarios_allocation_AP12_ap12t001_flushObjectFreeEvents(JNIEnv* static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -132,7 +132,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -162,15 +162,15 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) + nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, - NULL))) + nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t001/bi01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t001/bi01t001.cpp index 0ba4c3c442d..951d0c6c7c9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t001/bi01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t001/bi01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ extern "C" { /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; #define TESTED_CLASS_NAME "nsk/jvmti/scenarios/bcinstr/BI01/bi01t001a" @@ -106,7 +106,7 @@ cbClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv* jni_env, const unsigned char* class_data, jint* new_class_data_len, unsigned char** new_class_data) { - if (name == NULL || strcmp(name, TESTED_CLASS_NAME)) { + if (name == nullptr || strcmp(name, TESTED_CLASS_NAME)) { return; } @@ -175,7 +175,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { NSK_DISPLAY0("Notification disabled for CLASS_FILE_LOAD_HOOK event\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) { + nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -240,7 +240,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; { @@ -267,12 +267,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("Set notification enabled for CLASS_FILE_LOAD_HOOK event\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) { + nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t002/bi01t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t002/bi01t002.cpp index ca26caaa89b..2a3aab3a08d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t002/bi01t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t002/bi01t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ extern "C" { /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; #define TESTED_CLASS_NAME "nsk/jvmti/scenarios/bcinstr/BI01/bi01t002a" @@ -109,7 +109,7 @@ cbClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv* jni_env, const unsigned char* class_data, jint* new_class_data_len, unsigned char** new_class_data) { - if (name == NULL || strcmp(name, TESTED_CLASS_NAME)) { + if (name == nullptr || strcmp(name, TESTED_CLASS_NAME)) { return; } @@ -183,7 +183,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { NSK_DISPLAY0("Notification disabled for CLASS_FILE_LOAD_HOOK event\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) { + nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -253,7 +253,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; { @@ -280,12 +280,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("Set notification enabled for CLASS_FILE_LOAD_HOOK event\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) { + nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t001/bi02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t001/bi02t001.cpp index 66347ffdfef..6e732377021 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t001/bi02t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t001/bi02t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,8 +38,8 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jclass debugeeClass = NULL; -static jbyteArray classBytes = NULL; +static jclass debugeeClass = nullptr; +static jbyteArray classBytes = nullptr; static int ClassFileLoadHookEventFlag = NSK_FALSE; const char* CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI02/bi02t001a"; @@ -55,11 +55,11 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jint class_data_len, const unsigned char* class_data, jint *new_class_data_len, unsigned char** new_class_data) { - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { ClassFileLoadHookEventFlag = NSK_TRUE; NSK_DISPLAY0("ClassFileLoadHook event\n"); - if (class_being_redefined == NULL) { + if (class_being_redefined == nullptr) { /* sent by class load */ if (!NSK_JNI_VERIFY(jni_env, (*new_class_data_len = @@ -69,7 +69,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, } if (!NSK_JNI_VERIFY(jni_env, (*new_class_data = (unsigned char*) - jni_env->GetByteArrayElements(classBytes, NULL)) != NULL)) { + jni_env->GetByteArrayElements(classBytes, nullptr)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -82,29 +82,29 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* DEBUGEE_CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI02/bi02t001"; - jfieldID field = NULL; + jfieldID field = nullptr; NSK_DISPLAY1("Find class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (field = - jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != NULL)) + jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray) - jni->GetStaticObjectField(debugeeClass, field)) != NULL)) + jni->GetStaticObjectField(debugeeClass, field)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) + nullptr))) return JNI_ERR; return NSK_TRUE; @@ -137,7 +137,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) + nullptr))) nsk_jvmti_setFailStatus(); NSK_TRACE(jni->DeleteGlobalRef(debugeeClass)); @@ -162,7 +162,7 @@ JNIEXPORT jint JNI_OnLoad_bi02t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -174,7 +174,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -182,7 +182,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t002/bi02t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t002/bi02t002.cpp index 2b594da6407..197d776cb45 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t002/bi02t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t002/bi02t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,9 +38,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jclass debugeeClass = NULL; -static jclass testedClass = NULL; -static jbyteArray classBytes = NULL; +static jclass debugeeClass = nullptr; +static jclass testedClass = nullptr; +static jbyteArray classBytes = nullptr; const char* CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI02/bi02t002a"; @@ -49,31 +49,31 @@ const char* CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI02/bi02t002a"; static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* DEBUGEE_CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI02/bi02t002"; - jfieldID field = NULL; + jfieldID field = nullptr; NSK_DISPLAY1("Find class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (field = - jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != NULL)) + jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray) - jni->GetStaticObjectField(debugeeClass, field)) != NULL)) + jni->GetStaticObjectField(debugeeClass, field)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != nullptr)) return NSK_FALSE; NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)jni->NewGlobalRef(testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)jni->NewGlobalRef(testedClass)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -90,7 +90,7 @@ static int redefine(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_TRUE; if (!NSK_JNI_VERIFY(jni, (class_def.class_bytes = (unsigned char*) - jni->GetByteArrayElements(classBytes, NULL)) != NULL)) + jni->GetByteArrayElements(classBytes, nullptr)) != nullptr)) return NSK_TRUE; class_def.klass = testedClass; @@ -146,7 +146,7 @@ JNIEXPORT jint JNI_OnLoad_bi02t002(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -157,7 +157,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -165,7 +165,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t001/bi03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t001/bi03t001.cpp index f7e91f623e0..b302186df58 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t001/bi03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t001/bi03t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,8 +38,8 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jclass debugeeClass = NULL; -static jbyteArray classBytes = NULL; +static jclass debugeeClass = nullptr; +static jbyteArray classBytes = nullptr; static int ClassFileLoadHookEventFlag = NSK_FALSE; const char* CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI03/bi03t001a"; @@ -55,11 +55,11 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jint class_data_len, const unsigned char* class_data, jint *new_class_data_len, unsigned char** new_class_data) { - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { ClassFileLoadHookEventFlag = NSK_TRUE; NSK_DISPLAY0("ClassFileLoadHook event\n"); - if (class_being_redefined == NULL) { + if (class_being_redefined == nullptr) { /* sent by class load */ if (!NSK_JNI_VERIFY(jni_env, (*new_class_data_len = @@ -69,7 +69,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, } if (!NSK_JNI_VERIFY(jni_env, (*new_class_data = (unsigned char*) - jni_env->GetByteArrayElements(classBytes, NULL)) != NULL)) { + jni_env->GetByteArrayElements(classBytes, nullptr)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -82,29 +82,29 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* DEBUGEE_CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI03/bi03t001"; - jfieldID field = NULL; + jfieldID field = nullptr; NSK_DISPLAY1("Find class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (field = - jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != NULL)) + jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray) - jni->GetStaticObjectField(debugeeClass, field)) != NULL)) + jni->GetStaticObjectField(debugeeClass, field)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) + nullptr))) return JNI_ERR; return NSK_TRUE; @@ -137,7 +137,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) + nullptr))) nsk_jvmti_setFailStatus(); NSK_TRACE(jni->DeleteGlobalRef(debugeeClass)); @@ -162,7 +162,7 @@ JNIEXPORT jint JNI_OnLoad_bi03t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -174,7 +174,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -182,7 +182,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t002/bi03t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t002/bi03t002.cpp index 07adb527a71..575ebead06e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t002/bi03t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t002/bi03t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,9 +38,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jclass debugeeClass = NULL; -static jclass testedClass = NULL; -static jbyteArray classBytes = NULL; +static jclass debugeeClass = nullptr; +static jclass testedClass = nullptr; +static jbyteArray classBytes = nullptr; const char* CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI03/bi03t002a"; @@ -49,31 +49,31 @@ const char* CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI03/bi03t002a"; static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* DEBUGEE_CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI03/bi03t002"; - jfieldID field = NULL; + jfieldID field = nullptr; NSK_DISPLAY1("Find class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (field = - jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != NULL)) + jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray) - jni->GetStaticObjectField(debugeeClass, field)) != NULL)) + jni->GetStaticObjectField(debugeeClass, field)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != nullptr)) return NSK_FALSE; NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)jni->NewGlobalRef(testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)jni->NewGlobalRef(testedClass)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -90,7 +90,7 @@ static int redefine(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_TRUE; if (!NSK_JNI_VERIFY(jni, (class_def.class_bytes = (unsigned char*) - jni->GetByteArrayElements(classBytes, NULL)) != NULL)) + jni->GetByteArrayElements(classBytes, nullptr)) != nullptr)) return NSK_TRUE; class_def.klass = testedClass; @@ -146,7 +146,7 @@ JNIEXPORT jint JNI_OnLoad_bi03t002(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -157,7 +157,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -165,7 +165,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/bi04t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/bi04t002.cpp index c87fc546b90..6bb7ba83406 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/bi04t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/bi04t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ int readNewBytecode(jvmtiEnv* jvmti) { filename); bytecode = fopen(filename, "rb"); - if (bytecode == NULL) { + if (bytecode == nullptr) { NSK_COMPLAIN0("error opening file\n"); return NSK_FALSE; } @@ -137,7 +137,7 @@ JNIEXPORT jint JNI_OnLoad_bi04t002(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -145,7 +145,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; { @@ -161,7 +161,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(readNewBytecode(jvmti))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t001/cm01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t001/cm01t001.cpp index a59b82a5c5c..2d6978c2a0e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t001/cm01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t001/cm01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,22 +57,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -82,12 +82,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -97,7 +97,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -107,16 +107,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -156,18 +156,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -186,7 +186,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -199,7 +199,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -251,8 +251,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking positive: SetTag\n"); @@ -295,7 +295,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -365,7 +365,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -393,7 +393,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -565,11 +565,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t002/cm01t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t002/cm01t002.cpp index 63252c7765c..45761319f04 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t002/cm01t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t002/cm01t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,22 +50,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -75,12 +75,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -90,7 +90,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -99,22 +99,22 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (thread == NULL) { + if (thread == nullptr) { nsk_lcomplain(__FILE__, __LINE__, "tested thread not found\n"); return NSK_FALSE; } /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -154,18 +154,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -184,7 +184,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -197,7 +197,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -249,8 +249,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -303,7 +303,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -373,7 +373,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -401,7 +401,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -574,11 +574,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t003/cm01t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t003/cm01t003.cpp index f92d0d29805..7580d3f6a93 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t003/cm01t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t003/cm01t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,22 +52,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -77,12 +77,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -92,7 +92,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -102,16 +102,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -151,18 +151,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -181,7 +181,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -194,7 +194,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -246,8 +246,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -300,7 +300,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -370,7 +370,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -398,7 +398,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -568,11 +568,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t004/cm01t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t004/cm01t004.cpp index 6b52f4c9695..a5b7072692a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t004/cm01t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t004/cm01t004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,22 +50,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -75,12 +75,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -90,7 +90,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -100,16 +100,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -149,18 +149,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -179,7 +179,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking positive: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetOwnedMonitorInfo(thread, &count, &monitors))) @@ -191,7 +191,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -243,8 +243,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -297,7 +297,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -367,7 +367,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -395,7 +395,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -567,11 +567,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/cm01t005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/cm01t005.cpp index adbb0d83cba..b91e949a8c1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/cm01t005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/cm01t005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,22 +50,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -75,12 +75,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -90,7 +90,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -100,16 +100,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -149,18 +149,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -179,7 +179,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -192,7 +192,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking positive: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetCurrentContendedMonitor(thread, &monitor))) @@ -243,8 +243,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -297,7 +297,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -367,7 +367,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -395,7 +395,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -567,11 +567,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t006/cm01t006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t006/cm01t006.cpp index 011c53aa0c9..325d6d725dd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t006/cm01t006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t006/cm01t006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,22 +50,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -75,12 +75,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -90,7 +90,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -100,16 +100,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -149,18 +149,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -179,7 +179,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -192,7 +192,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -244,8 +244,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -298,7 +298,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -368,7 +368,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -396,7 +396,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -567,11 +567,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/cm01t007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/cm01t007.cpp index b9519d59054..4576bcd2f68 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/cm01t007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/cm01t007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,22 +50,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -75,12 +75,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -90,7 +90,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -100,15 +100,15 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingFlag' */ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "waitingFlag", "Z")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "waitingFlag", "Z")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -148,18 +148,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -178,7 +178,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -191,7 +191,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -265,8 +265,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -321,7 +321,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -391,7 +391,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -419,7 +419,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -591,11 +591,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t008/cm01t008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t008/cm01t008.cpp index 8f35fd2bf20..6783905f6b8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t008/cm01t008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t008/cm01t008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,24 +52,24 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; static jint klass_byte_count = 0; -static unsigned char *klass_bytes = NULL; +static unsigned char *klass_bytes = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -79,12 +79,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -94,7 +94,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -104,16 +104,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -153,18 +153,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -183,7 +183,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -196,7 +196,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -248,8 +248,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -302,7 +302,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -372,7 +372,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -505,7 +505,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *env, jclass class_beeing_redefine jint class_data_len, const unsigned char* class_data, jint *new_class_data_len, unsigned char** new_class_data) { - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { NSK_DISPLAY1("ClassFileLoadHook: %s\n", name); if (!NSK_JVMTI_VERIFY(jvmti->Allocate(class_data_len, &klass_bytes))) nsk_jvmti_setFailStatus(); @@ -514,7 +514,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *env, jclass class_beeing_redefine klass_byte_count = class_data_len; } NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)); + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr)); } } @@ -600,11 +600,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ @@ -674,7 +674,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)))) return JNI_ERR; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t009/cm01t009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t009/cm01t009.cpp index 535398b2a96..307d1045bf6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t009/cm01t009.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t009/cm01t009.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,22 +52,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -77,12 +77,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -92,7 +92,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -102,16 +102,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -151,18 +151,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking positive: InterruptThread\n"); @@ -180,7 +180,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -193,7 +193,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -245,8 +245,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -299,7 +299,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -369,7 +369,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -397,7 +397,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -569,11 +569,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t010/cm01t010.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t010/cm01t010.cpp index f7e8c060772..143cc6127e9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t010/cm01t010.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t010/cm01t010.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,22 +51,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -76,12 +76,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -91,7 +91,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -101,16 +101,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -150,18 +150,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -180,7 +180,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -193,7 +193,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -245,8 +245,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -299,7 +299,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -369,7 +369,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking positive: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetSourceFileName(klass, &name))) @@ -396,7 +396,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -568,11 +568,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t011/cm01t011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t011/cm01t011.cpp index fdd3e7207da..075c7e1bb27 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t011/cm01t011.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t011/cm01t011.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,22 +61,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -86,12 +86,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -101,7 +101,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -111,16 +111,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -160,18 +160,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -190,7 +190,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -203,7 +203,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -255,8 +255,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -309,7 +309,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -399,7 +399,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -427,7 +427,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -599,11 +599,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t012/cm01t012.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t012/cm01t012.cpp index 68b6461161c..b8a18cf6179 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t012/cm01t012.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t012/cm01t012.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,22 +54,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -79,12 +79,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -94,7 +94,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -104,16 +104,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -151,18 +151,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -181,7 +181,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -194,7 +194,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -246,8 +246,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -300,7 +300,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -370,7 +370,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -398,7 +398,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -570,11 +570,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t013/cm01t013.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t013/cm01t013.cpp index b6ce11d590e..aebd93910f6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t013/cm01t013.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t013/cm01t013.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,22 +51,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -76,12 +76,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -91,7 +91,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -101,16 +101,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -150,18 +150,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -180,7 +180,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -193,7 +193,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -245,8 +245,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -299,7 +299,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -369,7 +369,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -396,7 +396,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -568,11 +568,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t014/cm01t014.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t014/cm01t014.cpp index 58d80995614..7875901b8aa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t014/cm01t014.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t014/cm01t014.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,22 +52,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -77,12 +77,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -92,7 +92,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -102,16 +102,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -216,18 +216,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -246,7 +246,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -259,7 +259,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -311,8 +311,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -365,7 +365,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -435,7 +435,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -463,7 +463,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -694,11 +694,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t015/cm01t015.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t015/cm01t015.cpp index 4919c2874dc..aab9c8f47a1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t015/cm01t015.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t015/cm01t015.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,22 +54,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -79,12 +79,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -94,7 +94,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -104,16 +104,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -218,18 +218,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -248,7 +248,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -261,7 +261,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -313,8 +313,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -367,7 +367,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -437,7 +437,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -465,7 +465,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -698,11 +698,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t016/cm01t016.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t016/cm01t016.cpp index 0952ff8d3dc..59d23a8e373 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t016/cm01t016.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t016/cm01t016.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,22 +52,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -77,12 +77,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -92,7 +92,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -102,16 +102,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -216,18 +216,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -246,7 +246,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -259,7 +259,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -311,8 +311,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -365,7 +365,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -435,7 +435,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -463,7 +463,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -692,11 +692,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t017/cm01t017.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t017/cm01t017.cpp index 13804681b1a..dc7ad64d8d5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t017/cm01t017.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t017/cm01t017.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,22 +54,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -79,12 +79,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -94,7 +94,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -104,16 +104,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -218,18 +218,18 @@ static int checkSignalThread(int positive) { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; if (positive) { @@ -259,7 +259,7 @@ static int checkSignalThread(int positive) { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -272,7 +272,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -324,8 +324,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -378,7 +378,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -448,7 +448,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -476,7 +476,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -699,11 +699,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t018/cm01t018.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t018/cm01t018.cpp index 7e53745ccac..bd22d800877 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t018/cm01t018.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t018/cm01t018.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,22 +56,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -81,12 +81,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -96,7 +96,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -106,16 +106,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -240,18 +240,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -270,7 +270,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -283,7 +283,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -335,8 +335,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -389,7 +389,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -459,7 +459,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -487,7 +487,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -710,11 +710,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t019/cm01t019.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t019/cm01t019.cpp index 9fe8b204387..89475b798f5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t019/cm01t019.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t019/cm01t019.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,22 +51,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -76,12 +76,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -91,7 +91,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -101,16 +101,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -150,18 +150,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -180,7 +180,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -193,7 +193,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -245,8 +245,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -299,7 +299,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -369,7 +369,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -397,7 +397,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -569,11 +569,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t020/cm01t020.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t020/cm01t020.cpp index 25d4ed9a06e..ccb3a84ea32 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t020/cm01t020.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t020/cm01t020.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,22 +52,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -77,12 +77,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -92,7 +92,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -102,16 +102,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -151,18 +151,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -181,7 +181,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -194,7 +194,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -246,8 +246,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -300,7 +300,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -370,7 +370,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -398,7 +398,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -568,11 +568,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t021/cm01t021.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t021/cm01t021.cpp index 829a7c8f3dd..3f6bf3fd92b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t021/cm01t021.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t021/cm01t021.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,22 +52,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -77,12 +77,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -92,7 +92,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -102,16 +102,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -151,18 +151,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -181,7 +181,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -194,7 +194,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -246,8 +246,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -300,7 +300,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -370,7 +370,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -398,7 +398,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -568,11 +568,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001/cm02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001/cm02t001.cpp index d9037173ae3..94e16b7e98d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001/cm02t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001/cm02t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,9 +58,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jobject testedObject = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jobject testedObject = nullptr; const jlong TESTED_TAG_VALUE = 5555555L; static bool testedObjectNotified = false; @@ -98,34 +98,34 @@ static void JNICALL CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, const void* code_addr, jint map_length, const jvmtiAddrLocationMap* map, const void* compile_info) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; CompiledMethodLoadEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY3("CompiledMethodLoad event: %s%s (0x%p)\n", name, signature, code_addr); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } static void JNICALL CompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method, const void* code_addr) { - char *name = NULL; - char *sig = NULL; + char *name = nullptr; + char *sig = nullptr; jvmtiError err; CompiledMethodUnloadEventsCount++; NSK_DISPLAY0("CompiledMethodUnload event received\n"); // Check for the case that the class has been unloaded - err = jvmti_env->GetMethodName(method, &name, &sig, NULL); + err = jvmti_env->GetMethodName(method, &name, &sig, nullptr); if (err == JVMTI_ERROR_NONE) { NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n", name, sig, code_addr); @@ -206,12 +206,12 @@ VMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, VMObjectAllocEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("VMObjectAlloc: \"%s\", size=%d\n", signature, size); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -219,8 +219,8 @@ static void JNICALL NativeMethodBind(jvmtiEnv* jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, void* func, void** func_ptr) { jvmtiPhase phase; - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; NativeMethodBindEventsCount++; @@ -232,16 +232,16 @@ NativeMethodBind(jvmtiEnv* jvmti_env, JNIEnv *jni_env, if (phase != JVMTI_PHASE_START && phase != JVMTI_PHASE_LIVE) return; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("NativeMethodBind event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -274,7 +274,7 @@ ObjectFree(jvmtiEnv *jvmti_env, jlong tag) { static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -284,12 +284,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -299,12 +299,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* deallocate threads list */ @@ -312,7 +312,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -366,7 +366,7 @@ static int checkGetCapabilities(jvmtiEnv* jvmti) { */ static int checkGetOwnedMonitorInfo(jvmtiEnv* jvmti) { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking positive: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetOwnedMonitorInfo(thread, &count, &monitors))) @@ -378,7 +378,7 @@ static int checkGetOwnedMonitorInfo(jvmtiEnv* jvmti) { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor(jvmtiEnv* jvmti) { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking positive: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetCurrentContendedMonitor(thread, &monitor))) @@ -433,20 +433,20 @@ class NewFrame { _jni->PushLocalFrame(16); } ~NewFrame() { - _jni->PopLocalFrame(NULL); + _jni->PopLocalFrame(nullptr); } }; static int checkObjectTagEvent(jvmtiEnv* jvmti, JNIEnv* jni) { jlong tag = TESTED_TAG_VALUE; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; NewFrame local_frame(jni); // Create a tested object to tag. - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewStringUTF("abcde")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewStringUTF("abcde")) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking positive: SetTag\n"); @@ -468,8 +468,8 @@ static int checkObjectTagEvent(jvmtiEnv* jvmti, JNIEnv* jni) { static int checkObjectFreeEvent(jvmtiEnv* jvmti) { jlong tag = TESTED_TAG_VALUE; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; // Make some GCs happen for (int i = 0; i < 5; i++) { @@ -493,8 +493,8 @@ static int checkHeapFunctions(jvmtiEnv* jvmti) { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking positive: SetTag\n"); @@ -737,7 +737,7 @@ JNIEXPORT jint JNI_OnLoad_cm02t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -750,7 +750,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities */ @@ -791,44 +791,44 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* enable events */ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, nullptr))) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/cm03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/cm03t001.cpp index 40e03426cc0..2c70abc9cb4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/cm03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/cm03t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,12 +62,12 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; static jint klass_byte_count = 0; -static unsigned char *klass_bytes = NULL; +static unsigned char *klass_bytes = nullptr; /* event counts */ static int FieldAccessEventsCount = 0; @@ -93,7 +93,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jint class_data_len, const unsigned char* class_data, jint *new_class_data_len, unsigned char** new_class_data) { - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { NSK_DISPLAY1("ClassFileLoadHook: %s\n", name); if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &klass_bytes))) nsk_jvmti_setFailStatus(); @@ -103,7 +103,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, } NSK_JVMTI_VERIFY( jvmti_env->SetEventNotificationMode( - JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)); + JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr)); } } @@ -111,22 +111,22 @@ static void JNICALL FieldAccess(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jclass field_klass, jobject object, jfieldID field) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; FieldAccessEventsCount++; if (!NSK_JVMTI_VERIFY(jvmti_env->ClearFieldAccessWatch(klass, field))) return; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetFieldName(field_klass, field, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetFieldName(field_klass, field, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("FieldAccess event: %s:%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -135,42 +135,42 @@ FieldModification(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jclass field_klass, jobject object, jfieldID field, char sig, jvalue new_value) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; FieldModificationEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetFieldName(field_klass, field, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetFieldName(field_klass, field, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("FieldModification event: %s:%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } static void JNICALL SingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, jmethodID method, jlocation location) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; SingleStepEventsCount++; NSK_JVMTI_VERIFY( jvmti_env->SetEventNotificationMode( - JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL)); + JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, nullptr)); - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("SingleStep event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -178,60 +178,60 @@ static void JNICALL Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jobject exception, jmethodID catch_method, jlocation catch_location) { - jclass klass = NULL; - char *signature = NULL; + jclass klass = nullptr; + char *signature = nullptr; ExceptionEventsCount++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1("Exception event: %s\n", signature); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } void JNICALL ExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jobject exception) { - jclass klass = NULL; - char *signature = NULL; + jclass klass = nullptr; + char *signature = nullptr; ExceptionCatchEventsCount++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1("ExceptionCatch event: %s\n", signature); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } static void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; BreakpointEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("Breakpoint event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); jvmti_env->NotifyFramePop(thread, 0); @@ -241,36 +241,36 @@ static void JNICALL FramePop(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jboolean wasPopedByException) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; FramePopEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("FramePop event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } static void JNICALL MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; MethodEntryEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("MethodEntry event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -278,18 +278,18 @@ static void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jboolean was_poped_by_exception, jvalue return_value) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; MethodExitEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("MethodExit event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -298,7 +298,7 @@ MethodExit(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -308,12 +308,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -323,12 +323,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* deallocate threads list */ @@ -336,19 +336,19 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* klass is used by other threads - convert to global handle */ - if (!NSK_JNI_VERIFY(jni, (klass = (jclass)jni->NewGlobalRef(klass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = (jclass)jni->NewGlobalRef(klass)) != nullptr)) return NSK_FALSE; /* get tested thread method 'delay' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "delay", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "delay", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingFlag' */ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "waitingFlag", "Z")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "waitingFlag", "Z")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -358,11 +358,11 @@ static int prepareEvents(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY0("Prepare events ...\n"); /* get tested thread method 'letItGo' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "letItGo", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "letItGo", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingFlag' */ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "waitingFlag", "Z")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "waitingFlag", "Z")) != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->SetFieldAccessWatch(klass, field))) @@ -376,13 +376,13 @@ static int prepareEvents(jvmtiEnv* jvmti, JNIEnv* jni) { /* enable events */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, thread))) @@ -483,7 +483,7 @@ static int checkRedefineClasses(jvmtiEnv* jvmti) { jvmtiClassDefinition class_def; jboolean is_obsolete; - if (!NSK_VERIFY(klass_byte_count != 0 && klass_bytes != NULL)) + if (!NSK_VERIFY(klass_byte_count != 0 && klass_bytes != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking positive: RedefineClasses\n"); @@ -516,7 +516,7 @@ static int checkGetSourceFileName(jvmtiEnv* jvmti) { */ static int checkGetLineNumberTable(jvmtiEnv* jvmti) { jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking positive: GetLineNumberTable\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetLineNumberTable(method, &count, &line_number_table))) @@ -542,7 +542,7 @@ static int checkGetSourceDebugExtension(jvmtiEnv* jvmti) { */ static int checkLocalVariableFunctions(jvmtiEnv* jvmti) { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -680,18 +680,18 @@ static int checkSignalThread(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking positive: InterruptThread\n"); @@ -848,7 +848,7 @@ JNIEXPORT jint JNI_OnLoad_cm03t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -861,7 +861,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities */ @@ -904,23 +904,23 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* enable events */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr))) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC01/tc01t001/tc01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC01/tc01t001/tc01t001.cpp index 852c148dc6d..c744347213e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC01/tc01t001/tc01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC01/tc01t001/tc01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,9 +35,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jobject object_M1 = NULL; -static jobject object_M2 = NULL; +static jthread thread = nullptr; +static jobject object_M1 = nullptr; +static jobject object_M2 = nullptr; /* ========================================================================== */ @@ -45,10 +45,10 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; const char* FIELD_SIG = "Ljava/lang/Object;"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; - jfieldID field = NULL; - jclass klass = NULL; + jfieldID field = nullptr; + jclass klass = nullptr; int i; NSK_DISPLAY0("Prepare: find tested thread\n"); @@ -57,12 +57,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -72,11 +72,11 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } - if (info.name != NULL) { + if (info.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) return NSK_FALSE; } @@ -87,21 +87,21 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread field 'M1' */ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M1", FIELD_SIG)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M1", FIELD_SIG)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (object_M1 = jni->GetObjectField(thread, field)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (object_M1 = jni->GetObjectField(thread, field)) != nullptr)) return NSK_FALSE; /* get tested thread field 'M2' */ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M2", FIELD_SIG)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M2", FIELD_SIG)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (object_M2 = jni->GetObjectField(thread, field)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (object_M2 = jni->GetObjectField(thread, field)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -121,14 +121,14 @@ static int checkGetObjectMonitorUsage(jvmtiEnv* jvmti, JNIEnv* jni, return NSK_FALSE; if (nsk_getVerboseMode()) { - if (inf.owner == NULL) { + if (inf.owner == nullptr) { NSK_DISPLAY0("\towner: none (0x0)\n"); } else { if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(inf.owner, &tinf))) { result = NSK_FALSE; } else { NSK_DISPLAY2("\towner: %s (0x%p)\n", tinf.name, inf.owner); - if (tinf.name != NULL) { + if (tinf.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)tinf.name))) result = NSK_FALSE; } @@ -145,7 +145,7 @@ static int checkGetObjectMonitorUsage(jvmtiEnv* jvmti, JNIEnv* jni, } else { NSK_DISPLAY3("\t\t%2d: %s (0x%p)\n", i, tinf.name, inf.waiters[i]); - if (tinf.name != NULL) { + if (tinf.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)tinf.name))) result = NSK_FALSE; } @@ -162,7 +162,7 @@ static int checkGetObjectMonitorUsage(jvmtiEnv* jvmti, JNIEnv* jni, } else { NSK_DISPLAY3("\t\t%2d: %s (0x%p)\n", i, tinf.name, inf.notify_waiters[i]); - if (tinf.name != NULL) { + if (tinf.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)tinf.name))) result = NSK_FALSE; } @@ -185,11 +185,11 @@ static int checkGetObjectMonitorUsage(jvmtiEnv* jvmti, JNIEnv* jni, result = NSK_FALSE; /* deallocate monitor waiters arrays */ - if (inf.waiters != NULL) { + if (inf.waiters != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)inf.waiters))) result = NSK_FALSE; } - if (inf.notify_waiters != NULL) { + if (inf.notify_waiters != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)inf.notify_waiters))) result = NSK_FALSE; } @@ -242,7 +242,7 @@ JNIEXPORT jint JNI_OnLoad_tc01t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; /* init framework and parse options */ @@ -254,7 +254,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities */ @@ -264,7 +264,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp index 0c3fbf88cb1..e3e4a244ba8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,8 +35,8 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jobject object_M = NULL; +static jthread thread = nullptr; +static jobject object_M = nullptr; /* line numbers of "synchronized (M)" clauses in java part of the test */ static jint lines[] = { 48, 53, 58 }; static volatile int enterEventsCount = 0; @@ -45,9 +45,9 @@ static volatile int enteredEventsCount = 0; /* ========================================================================== */ static jint findLineNumber(jvmtiEnv *jvmti, jthread thread) { - jmethodID method = NULL; + jmethodID method = nullptr; jlocation location; - jvmtiLineNumberEntry* table = NULL; + jvmtiLineNumberEntry* table = nullptr; jint count = 0; jint line = 0; int i; @@ -55,7 +55,7 @@ static jint findLineNumber(jvmtiEnv *jvmti, jthread thread) { if (!NSK_JVMTI_VERIFY(jvmti->GetFrameLocation(thread, 0, &method, &location))) return 0; - if (!NSK_VERIFY(method != NULL)) + if (!NSK_VERIFY(method != nullptr)) return 0; if (!NSK_VERIFY(location != -1)) @@ -64,7 +64,7 @@ static jint findLineNumber(jvmtiEnv *jvmti, jthread thread) { if (!NSK_JVMTI_VERIFY(jvmti->GetLineNumberTable(method, &count, &table))) return 0; - if (!NSK_VERIFY(table != NULL)) + if (!NSK_VERIFY(table != nullptr)) return 0; if (!NSK_VERIFY(count > 0)) @@ -78,7 +78,7 @@ static jint findLineNumber(jvmtiEnv *jvmti, jthread thread) { line = table[i-1].line_number; - if (table != NULL) { + if (table != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)table))) return 0; } @@ -92,13 +92,13 @@ void JNICALL MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj) { jint line = 0; - if (!NSK_VERIFY(thr != NULL)) { + if (!NSK_VERIFY(thr != nullptr)) { nsk_jvmti_setFailStatus(); NSK_COMPLAIN1("MonitorContendedEnter event: thread=%p\n", thr); return; } - if (!NSK_VERIFY(obj != NULL)) { + if (!NSK_VERIFY(obj != nullptr)) { nsk_jvmti_setFailStatus(); NSK_COMPLAIN1("MonitorContendedEnter event: object=%p\n", obj); return; @@ -137,13 +137,13 @@ void JNICALL MonitorContendedEntered(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj) { jint line = 0; - if (!NSK_VERIFY(thr != NULL)) { + if (!NSK_VERIFY(thr != nullptr)) { nsk_jvmti_setFailStatus(); NSK_COMPLAIN1("MonitorContendedEntered event: thread=%p\n", thr); return; } - if (!NSK_VERIFY(obj != NULL)) { + if (!NSK_VERIFY(obj != nullptr)) { nsk_jvmti_setFailStatus(); NSK_COMPLAIN1("MonitorContendedEntered event: object=%p\n", obj); return; @@ -184,10 +184,10 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; const char* FIELD_SIG = "Ljava/lang/Object;"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; - jfieldID field = NULL; - jclass klass = NULL; + jfieldID field = nullptr; + jclass klass = nullptr; int i; NSK_DISPLAY0("Prepare: find tested thread\n"); @@ -196,12 +196,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -211,11 +211,11 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } - if (info.name != NULL) { + if (info.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) return NSK_FALSE; } @@ -225,40 +225,40 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (thread == NULL) { + if (thread == nullptr) { NSK_COMPLAIN0("Debuggee thread not found"); return NSK_FALSE; } /* make thread accessable for a long time */ - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread field 'M' */ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M", FIELD_SIG)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M", FIELD_SIG)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (object_M = jni->GetObjectField(thread, field)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (object_M = jni->GetObjectField(thread, field)) != nullptr)) return NSK_FALSE; /* make object accessable for a long time */ - if (!NSK_JNI_VERIFY(jni, (object_M = jni->NewGlobalRef(object_M)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (object_M = jni->NewGlobalRef(object_M)) != nullptr)) return NSK_FALSE; /* enable MonitorContendedEntered event */ if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr))) return NSK_FALSE; /* enable MonitorContendedEntered event */ if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr))) return NSK_FALSE; return NSK_TRUE; @@ -269,7 +269,7 @@ static int clean(jvmtiEnv* jvmti, JNIEnv* jni) { /* disable MonitorContendedEntered event */ if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode( - JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL))) + JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr))) nsk_jvmti_setFailStatus(); return NSK_TRUE; @@ -334,7 +334,7 @@ JNIEXPORT jint JNI_OnLoad_tc02t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -347,7 +347,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities */ @@ -364,7 +364,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp index 9760e0c0207..73d8ef539a6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,15 +41,15 @@ typedef struct { static jlong timeout = 0; /* test objects */ -static threadDesc *threadList = NULL; +static threadDesc *threadList = nullptr; static jint threads_count = 0; static int numberOfDeadlocks = 0; /* ========================================================================== */ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { - jobject monitor = NULL; - jclass klass = NULL; + jobject monitor = nullptr; + jclass klass = nullptr; jvmtiMonitorUsage usageInfo; int pThread, cThread; char* name; @@ -60,10 +60,10 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { if (!NSK_JVMTI_VERIFY( jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor))) return NSK_FALSE; - if (monitor != NULL) { - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(monitor)) != NULL)) + if (monitor != nullptr) { + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(monitor)) != nullptr)) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &name, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &name, nullptr))) return NSK_FALSE; NSK_DISPLAY2(" waiting to lock %p (%s),\n", monitor, name); jvmti->Deallocate((unsigned char*)name); @@ -72,16 +72,16 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { } if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(monitor, &usageInfo))) return NSK_FALSE; - if (usageInfo.owner == NULL) + if (usageInfo.owner == nullptr) break; for (cThread = 0; cThread < threads_count; cThread++) { if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner)) break; } - if (usageInfo.waiters != NULL) { + if (usageInfo.waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.waiters); } - if (usageInfo.notify_waiters != NULL) { + if (usageInfo.notify_waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters); } if (!NSK_VERIFY(cThread != threads_count)) @@ -97,8 +97,8 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { jvmtiThreadInfo info; - jthread *threads = NULL; - jobject monitor = NULL; + jthread *threads = nullptr; + jobject monitor = nullptr; jvmtiMonitorUsage usageInfo; int tDfn = 0, gDfn = 0; int pThread, cThread; @@ -110,7 +110,7 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY( @@ -118,7 +118,7 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -144,20 +144,20 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY( jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor))) return NSK_FALSE; - if (monitor == NULL) + if (monitor == nullptr) break; if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(monitor, &usageInfo))) return NSK_FALSE; - if (usageInfo.owner == NULL) + if (usageInfo.owner == nullptr) break; for (cThread = 0; cThread < threads_count; cThread++) { if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner)) break; } - if (usageInfo.waiters != NULL) { + if (usageInfo.waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.waiters); } - if (usageInfo.notify_waiters != NULL) { + if (usageInfo.notify_waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters); } if (!NSK_VERIFY(cThread != threads_count)) @@ -180,7 +180,7 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { /* deallocate thread names */ for (i = 0; i < threads_count; i++) { - if (threadList[i].name != NULL) { + if (threadList[i].name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadList[i].name))) return NSK_FALSE; } @@ -228,7 +228,7 @@ JNIEXPORT jint JNI_OnLoad_tc03t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; /* init framework and parse options */ @@ -240,7 +240,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities */ @@ -251,7 +251,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp index f98c80c34c1..9740919cdcd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,15 +41,15 @@ typedef struct { static jlong timeout = 0; /* test objects */ -static threadDesc *threadList = NULL; +static threadDesc *threadList = nullptr; static jint threads_count = 0; static int numberOfDeadlocks = 0; /* ========================================================================== */ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { - jobject monitor = NULL; - jclass klass = NULL; + jobject monitor = nullptr; + jclass klass = nullptr; jvmtiMonitorUsage usageInfo; int pThread, cThread; char* name; @@ -60,10 +60,10 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { if (!NSK_JVMTI_VERIFY( jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor))) return NSK_FALSE; - if (monitor != NULL) { - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(monitor)) != NULL)) + if (monitor != nullptr) { + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(monitor)) != nullptr)) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &name, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &name, nullptr))) return NSK_FALSE; NSK_DISPLAY2(" waiting to lock %p (%s),\n", monitor, name); jvmti->Deallocate((unsigned char*)name); @@ -72,16 +72,16 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { } if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(monitor, &usageInfo))) return NSK_FALSE; - if (usageInfo.owner == NULL) + if (usageInfo.owner == nullptr) break; for (cThread = 0; cThread < threads_count; cThread++) { if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner)) break; } - if (usageInfo.waiters != NULL) { + if (usageInfo.waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.waiters); } - if (usageInfo.notify_waiters != NULL) { + if (usageInfo.notify_waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters); } if (!NSK_VERIFY(cThread != threads_count)) @@ -97,8 +97,8 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { jvmtiThreadInfo info; - jthread *threads = NULL; - jobject monitor = NULL; + jthread *threads = nullptr; + jobject monitor = nullptr; jvmtiMonitorUsage usageInfo; int tDfn = 0, gDfn = 0; int pThread, cThread; @@ -110,7 +110,7 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY( @@ -118,7 +118,7 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -144,20 +144,20 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY( jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor))) return NSK_FALSE; - if (monitor == NULL) + if (monitor == nullptr) break; if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(monitor, &usageInfo))) return NSK_FALSE; - if (usageInfo.owner == NULL) + if (usageInfo.owner == nullptr) break; for (cThread = 0; cThread < threads_count; cThread++) { if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner)) break; } - if (usageInfo.waiters != NULL) { + if (usageInfo.waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.waiters); } - if (usageInfo.notify_waiters != NULL) { + if (usageInfo.notify_waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters); } if (!NSK_VERIFY(cThread != threads_count)) @@ -180,7 +180,7 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { /* deallocate thread names */ for (i = 0; i < threads_count; i++) { - if (threadList[i].name != NULL) { + if (threadList[i].name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadList[i].name))) return NSK_FALSE; } @@ -228,7 +228,7 @@ JNIEXPORT jint JNI_OnLoad_tc03t002(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; /* init framework and parse options */ @@ -240,7 +240,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities */ @@ -251,7 +251,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp index 6000051f1ad..f850b0d89f4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,12 +35,12 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jclass object_M = NULL; +static jclass object_M = nullptr; static volatile int waitEventsCount = 0; static volatile int waitedEventsCount = 0; static volatile int enterEventsCount = 0; static volatile int enteredEventsCount = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; static jboolean lockSyncLock(jvmtiEnv* jvmti) { @@ -62,12 +62,12 @@ void JNICALL MonitorWait(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj, jlong tout) { - if (!NSK_VERIFY(thr != NULL)) { + if (!NSK_VERIFY(thr != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(obj != NULL)) { + if (!NSK_VERIFY(obj != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -85,12 +85,12 @@ void JNICALL MonitorWaited(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj, jboolean timed_out) { - if (!NSK_VERIFY(thr != NULL)) { + if (!NSK_VERIFY(thr != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(obj != NULL)) { + if (!NSK_VERIFY(obj != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -107,12 +107,12 @@ MonitorWaited(jvmtiEnv *jvmti, JNIEnv* jni, void JNICALL MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj) { - if (!NSK_VERIFY(thr != NULL)) { + if (!NSK_VERIFY(thr != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(obj != NULL)) { + if (!NSK_VERIFY(obj != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -129,12 +129,12 @@ MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj) { void JNICALL MonitorContendedEntered(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj) { - if (!NSK_VERIFY(thr != NULL)) { + if (!NSK_VERIFY(thr != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(obj != NULL)) { + if (!NSK_VERIFY(obj != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -155,10 +155,10 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY0("Obtain tested object from debugee thread class\n"); - if (!NSK_JNI_VERIFY(jni, (object_M = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (object_M = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (object_M = (jclass)jni->NewGlobalRef(object_M)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (object_M = (jclass)jni->NewGlobalRef(object_M)) != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) @@ -166,24 +166,24 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { /* enable MonitorWait event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr))) nsk_jvmti_setFailStatus(); /* enable MonitorWaited event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr))) nsk_jvmti_setFailStatus(); /* enable MonitorContendedEnter event */ if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr))) nsk_jvmti_setFailStatus(); /* enable MonitorContendedEntered event */ if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr))) nsk_jvmti_setFailStatus(); return NSK_TRUE; @@ -193,24 +193,24 @@ static int clean(jvmtiEnv* jvmti, JNIEnv* jni) { /* disable MonitorWait event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr))) nsk_jvmti_setFailStatus(); /* disable MonitorWaited event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, NULL))) + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr))) nsk_jvmti_setFailStatus(); /* disable MonitorContendedEnter event */ if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode( - JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL))) + JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr))) nsk_jvmti_setFailStatus(); /* disable MonitorContendedEntered event */ if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode( - JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL))) + JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr))) nsk_jvmti_setFailStatus(); if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) @@ -296,7 +296,7 @@ JNIEXPORT jint JNI_OnLoad_tc04t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -309,7 +309,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities */ @@ -329,7 +329,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp index aead5a92589..3c3c0e37703 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,8 +49,8 @@ static const jlong EXPECTED_ACCURACY = 10; // high frequency clock updates expec static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jobject object_M = NULL; +static jthread thread = nullptr; +static jobject object_M = nullptr; static volatile int waitEventsCount = 0; static volatile int waitedEventsCount = 0; static jlong waitTime = 0; @@ -65,12 +65,12 @@ MonitorWait(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj, jlong tout) { char buffer[32]; - if (!NSK_VERIFY(thr != NULL)) { + if (!NSK_VERIFY(thr != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(obj != NULL)) { + if (!NSK_VERIFY(obj != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -104,12 +104,12 @@ MonitorWaited(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj, jboolean timed_out) { char buffer[32]; - if (!NSK_VERIFY(thr != NULL)) { + if (!NSK_VERIFY(thr != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(obj != NULL)) { + if (!NSK_VERIFY(obj != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -140,10 +140,10 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; const char* FIELD_SIG = "Ljava/lang/Object;"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; - jfieldID field = NULL; - jclass klass = NULL; + jfieldID field = nullptr; + jclass klass = nullptr; int i; NSK_DISPLAY0("Prepare: find tested thread\n"); @@ -152,12 +152,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -167,11 +167,11 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } - if (info.name != NULL) { + if (info.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) return NSK_FALSE; } @@ -181,38 +181,38 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (thread == NULL) { + if (thread == nullptr) { NSK_COMPLAIN0("Debuggee thread not found"); return NSK_FALSE; } /* make thread accessable for a long time */ - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread field 'M' */ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M", FIELD_SIG)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M", FIELD_SIG)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (object_M = jni->GetObjectField(thread, field)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (object_M = jni->GetObjectField(thread, field)) != nullptr)) return NSK_FALSE; /* make object accessable for a long time */ - if (!NSK_JNI_VERIFY(jni, (object_M = jni->NewGlobalRef(object_M)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (object_M = jni->NewGlobalRef(object_M)) != nullptr)) return NSK_FALSE; /* enable MonitorWait event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr))) return NSK_FALSE; /* enable MonitorWaited event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr))) return NSK_FALSE; return NSK_TRUE; @@ -222,12 +222,12 @@ static int clean(jvmtiEnv* jvmti, JNIEnv* jni) { /* disable MonitorWait event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr))) nsk_jvmti_setFailStatus(); /* disable MonitorWaited event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, NULL))) + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr))) nsk_jvmti_setFailStatus(); return NSK_TRUE; @@ -310,7 +310,7 @@ JNIEXPORT jint JNI_OnLoad_tc05t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -323,7 +323,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities */ @@ -340,7 +340,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t001/em01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t001/em01t001.cpp index 500f4ca655f..55a97693008 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t001/em01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t001/em01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,10 +34,10 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define JVMTI_EVENT_COUNT (int)(JVMTI_MAX_EVENT_TYPE_VAL - JVMTI_MIN_EVENT_TYPE_VAL + 1) @@ -127,7 +127,7 @@ classEventsHandler(jvmtiEvent event, jvmtiEnv* jvmti_env, JNIEnv* jni_env, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) { nsk_jvmti_setFailStatus(); } - if (generic != NULL) + if (generic != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) { nsk_jvmti_setFailStatus(); } @@ -178,7 +178,7 @@ threadEventHandler(jvmtiEvent event, jvmtiEnv* jvmti_env, JNIEnv* jni_env, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) { nsk_jvmti_setFailStatus(); } - if (generic != NULL) + if (generic != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) { nsk_jvmti_setFailStatus(); } @@ -282,7 +282,7 @@ cbThreadEnd(jvmtiEnv* jvmti_env, JNIEnv* jni_env, jthread thread) { static int enableEvent(jvmtiEventMode enable, jvmtiEvent event) { NSK_DISPLAY1("enabling %s\n", TranslateEvent(event)); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -427,7 +427,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { classLoaderCount = nsk_jvmti_findOptionIntValue(CLASS_LOADER_COUNT_PARAM, 10); jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -452,7 +452,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; currentPhase = JVMTI_PHASE_PRIMORDIAL; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/em01t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/em01t002.cpp index d314b16ce2e..7a3700c0863 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/em01t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/em01t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,10 +34,10 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define JVMTI_EVENT_COUNT (int)(JVMTI_MAX_EVENT_TYPE_VAL - JVMTI_MIN_EVENT_TYPE_VAL + 1) @@ -187,7 +187,7 @@ classEventsHandler(jvmtiEvent event, jvmtiEnv* jvmti_env, JNIEnv* jni_env, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) { nsk_jvmti_setFailStatus(); } - if (generic != NULL) + if (generic != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) { nsk_jvmti_setFailStatus(); } @@ -239,7 +239,7 @@ threadEventHandler(jvmtiEvent event, jvmtiEnv* jvmti_env, JNIEnv* jni_env, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) { nsk_jvmti_setFailStatus(); } - if (generic != NULL) + if (generic != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) { nsk_jvmti_setFailStatus(); } @@ -350,7 +350,7 @@ enableEvent(jvmtiEventMode enable, jvmtiEvent event) { } - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -494,7 +494,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { classLoaderCount = nsk_jvmti_findOptionIntValue(CLASS_LOADER_COUNT_PARAM, 10); jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -519,7 +519,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; currentPhase = JVMTI_PHASE_PRIMORDIAL; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001/em02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001/em02t001.cpp index 0314850e4f7..5bc4a5c7b2f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001/em02t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001/em02t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,10 +34,10 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define DEBUGEE_CLASS_NAME "nsk/jvmti/scenarios/events/EM02/em02t001" @@ -48,10 +48,10 @@ static jrawMonitorID syncLock = NULL; #define OBJECT_FIELD_SIG "Ljava/lang/Object;" #define THREAD_FIELD_SIG "Ljava/lang/Thread;" -static jthread mainThread = NULL; -static jthread debuggeeThread = NULL; -static jobject startObject = NULL; -static jobject endObject = NULL; +static jthread mainThread = nullptr; +static jthread debuggeeThread = nullptr; +static jobject startObject = nullptr; +static jobject endObject = nullptr; #define STEP_AMOUNT 3 #define JVMTI_EVENT_COUNT (int)(JVMTI_MAX_EVENT_TYPE_VAL - JVMTI_MIN_EVENT_TYPE_VAL + 1) @@ -63,21 +63,21 @@ static int newEventCount[JVMTI_EVENT_COUNT]; static jthread findThread(const char *threadName) { jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; - jthread returnValue = NULL; + jthread returnValue = nullptr; int i; /* get all live threads */ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) - return NULL; + return nullptr; - if (!NSK_VERIFY(threads != NULL)) - return NULL; + if (!NSK_VERIFY(threads != nullptr)) + return nullptr; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) break; /* get thread information */ @@ -85,14 +85,14 @@ findThread(const char *threadName) { break; /* find by name */ - if (info.name != NULL && (strcmp(info.name, threadName) == 0)) { + if (info.name != nullptr && (strcmp(info.name, threadName) == 0)) { returnValue = threads[i]; } } /* deallocate threads list */ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) - return NULL; + return nullptr; return returnValue; } @@ -105,7 +105,7 @@ getStaticObjField(const char* className, const char* objFieldName, ExceptionCheckingJniEnvPtr ec_jni(jni); jfieldID fieldID; - jclass klass = NULL; + jclass klass = nullptr; klass = ec_jni->FindClass(className, TRACE_JNI_CALL); fieldID = ec_jni->GetStaticFieldID(klass, objFieldName, signature, TRACE_JNI_CALL); @@ -118,7 +118,7 @@ static bool prepare() { ExceptionCheckingJniEnvPtr ec_jni(jni); mainThread = findThread(MAIN_THREAD_NAME); - if (!NSK_VERIFY(mainThread != NULL)) { + if (!NSK_VERIFY(mainThread != nullptr)) { NSK_COMPLAIN1("<%s> thread not found\n", MAIN_THREAD_NAME); return false; } @@ -126,14 +126,14 @@ static bool prepare() { /* make thread accessable for a long time */ mainThread = ec_jni->NewGlobalRef(mainThread, TRACE_JNI_CALL); startObject = getStaticObjField(DEBUGEE_CLASS_NAME, START_FIELD_NAME, OBJECT_FIELD_SIG); - if (!NSK_VERIFY(startObject != NULL)) + if (!NSK_VERIFY(startObject != nullptr)) return false; /*make object accessable for a long time*/ startObject = ec_jni->NewGlobalRef(startObject, TRACE_JNI_CALL); endObject = getStaticObjField(DEBUGEE_CLASS_NAME, END_FIELD_NAME, OBJECT_FIELD_SIG); - if (!NSK_VERIFY(endObject != NULL)) + if (!NSK_VERIFY(endObject != nullptr)) return false; /*make object accessable for a long time*/ @@ -142,7 +142,7 @@ static bool prepare() { debuggeeThread = (jthread) getStaticObjField(DEBUGEE_CLASS_NAME, THREAD_FIELD_NAME, THREAD_FIELD_SIG); - if (!NSK_VERIFY(debuggeeThread != NULL)) + if (!NSK_VERIFY(debuggeeThread != nullptr)) return false; /* make thread accessable for a long time */ @@ -158,7 +158,7 @@ static bool clean() { /* disable MonitorContendedEnter event */ if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode( - JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL))) + JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr))) nsk_jvmti_setFailStatus(); /* dispose global references */ @@ -167,10 +167,10 @@ static bool clean() { ec_jni->DeleteGlobalRef(debuggeeThread, TRACE_JNI_CALL); ec_jni->DeleteGlobalRef(mainThread, TRACE_JNI_CALL); - startObject = NULL; - endObject = NULL; - debuggeeThread = NULL; - mainThread = NULL; + startObject = nullptr; + endObject = nullptr; + debuggeeThread = nullptr; + mainThread = nullptr; return true; } @@ -396,7 +396,7 @@ handlerMC1(jvmtiEvent event, jvmtiEnv* jvmti, JNIEnv* jni_env, jthread expectedThread, jobject expectedObject) { ExceptionCheckingJniEnvPtr ec_jni(jni_env); - if (expectedThread == NULL || expectedObject == NULL) + if (expectedThread == nullptr || expectedObject == nullptr) return; /* check if event is for tested thread and for tested object */ @@ -483,7 +483,7 @@ handlerMC2(jvmtiEvent event, jvmtiEnv* jvmti, JNIEnv* jni_env, jthread expectedThread, jobject expectedObject) { ExceptionCheckingJniEnvPtr ec_jni(jni_env); - if (expectedThread == NULL || expectedObject == NULL) + if (expectedThread == nullptr || expectedObject == nullptr) return; /* check if event is for tested thread and for tested object */ @@ -553,13 +553,13 @@ static bool enableEvent(jvmtiEvent event) { && (event != JVMTI_EVENT_MONITOR_WAIT) && (event != JVMTI_EVENT_MONITOR_WAITED)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -743,7 +743,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -770,7 +770,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/em02t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/em02t002.cpp index 5f30ac4e1e7..1c6f88ea41a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/em02t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/em02t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,9 +33,9 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_AMOUNT 3 @@ -344,13 +344,13 @@ static bool enableEvent(jvmtiEvent event) { && (event != JVMTI_EVENT_GARBAGE_COLLECTION_START) && (event != JVMTI_EVENT_GARBAGE_COLLECTION_FINISH)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -509,7 +509,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -536,7 +536,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/em02t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/em02t003.cpp index d5cae3e3a75..a1c1aa85a10 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/em02t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/em02t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,9 +33,9 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_AMOUNT 3 @@ -280,7 +280,7 @@ handlerMC1(jvmtiEvent event, jvmtiEnv* jvmti, jmethodID method) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -346,7 +346,7 @@ handlerMC2(jvmtiEvent event, jvmtiEnv* jvmti, jmethodID method) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -378,13 +378,13 @@ static bool enableEvent(jvmtiEvent event) { && (event != JVMTI_EVENT_COMPILED_METHOD_LOAD) && (event != JVMTI_EVENT_COMPILED_METHOD_UNLOAD)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -548,7 +548,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -575,7 +575,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t004/em02t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t004/em02t004.cpp index a3ecd17cf1f..b00713b7fe8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t004/em02t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t004/em02t004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,9 +33,9 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_AMOUNT 3 @@ -334,7 +334,7 @@ cbNativeMethodBind(jvmtiEnv *jvmti_env, JNIEnv* jni_env,jthread thread, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -374,7 +374,7 @@ cbNewNativeMethodBind(jvmtiEnv *jvmti_env, JNIEnv* jni_env,jthread thread, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -387,13 +387,13 @@ static bool enableEvent(jvmtiEvent event) { if (nsk_jvmti_isOptionalEvent(event) && (event != JVMTI_EVENT_NATIVE_METHOD_BIND)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -554,7 +554,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -581,7 +581,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/em02t005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/em02t005.cpp index 66d46a31062..a1b74a56a76 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/em02t005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/em02t005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,9 +33,9 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_NUMBER 3 @@ -326,7 +326,7 @@ cbVMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign_ptr))) { nsk_jvmti_setFailStatus(); } - if (gen_ptr != NULL) + if (gen_ptr != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)gen_ptr))) { nsk_jvmti_setFailStatus(); } @@ -366,7 +366,7 @@ cbNewVMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign_ptr))) { nsk_jvmti_setFailStatus(); } - if (gen_ptr != NULL) + if (gen_ptr != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)gen_ptr))) { nsk_jvmti_setFailStatus(); } @@ -379,13 +379,13 @@ static bool enableEvent(jvmtiEvent event) { if (nsk_jvmti_isOptionalEvent(event) && (event != JVMTI_EVENT_VM_OBJECT_ALLOC)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -534,7 +534,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; @@ -560,7 +560,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp index 415cbbcc5ed..c4b65118b1a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,9 +33,9 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_NUMBER 3 @@ -328,13 +328,13 @@ static bool enableEvent(jvmtiEvent event) { if (nsk_jvmti_isOptionalEvent(event) && (event != JVMTI_EVENT_OBJECT_FREE)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -485,7 +485,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -511,7 +511,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp index 0b19c1d0f85..b344a6f438e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,9 +33,9 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_NUMBER 3 @@ -200,7 +200,7 @@ cbSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -230,7 +230,7 @@ cbNewSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -357,13 +357,13 @@ static bool enableEvent(jvmtiEvent event) { if (nsk_jvmti_isOptionalEvent(event) && (event != JVMTI_EVENT_SINGLE_STEP)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -521,7 +521,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -546,7 +546,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp index 5c7edf432d3..89434116744 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,9 +33,9 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_NUMBER 3 @@ -377,13 +377,13 @@ static bool enableEvent(jvmtiEvent event) { && (event != JVMTI_EVENT_EXCEPTION) && (event != JVMTI_EVENT_EXCEPTION_CATCH)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -533,7 +533,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -558,7 +558,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp index 1ee810210db..f50cb3388da 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,9 +33,9 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_NUMBER 3 @@ -243,7 +243,7 @@ void handler1(jvmtiEnv *jvmti_env, jvmtiEvent event, jmethodID method) { if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -285,7 +285,7 @@ void handler2(jvmtiEnv *jvmti_env, jvmtiEvent event, jmethodID method) { if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -384,13 +384,13 @@ static bool enableEvent(jvmtiEvent event) { && (event != JVMTI_EVENT_METHOD_ENTRY) && (event != JVMTI_EVENT_METHOD_EXIT)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -540,7 +540,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -566,7 +566,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp index 5a181180b86..a3257281f0d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,9 +34,9 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_NUMBER 3 @@ -340,13 +340,13 @@ static bool enableEvent(jvmtiEvent event) { && (event != JVMTI_EVENT_FIELD_MODIFICATION) && (event != JVMTI_EVENT_FIELD_ACCESS)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -516,7 +516,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -542,7 +542,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp index 626e2500a9a..1e0f043d087 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,9 +34,9 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_NUMBER 3 @@ -326,13 +326,13 @@ static bool enableEvent(jvmtiEvent event) { if (nsk_jvmti_isOptionalEvent(event) && (event != JVMTI_EVENT_BREAKPOINT)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -497,7 +497,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -522,7 +522,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp index ad7dfc5e0e8..eb83f542853 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,10 +34,10 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jthread testedThread; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_NUMBER 3 @@ -330,13 +330,13 @@ static bool enableEvent(jvmtiEvent event) { if (nsk_jvmti_isOptionalEvent(event) && (event != JVMTI_EVENT_FRAME_POP)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -503,7 +503,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -529,7 +529,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp index 86ca654d2cd..825391d9576 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,9 +35,9 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -const void *plist = NULL; +const void *plist = nullptr; #define NAME_LENGTH 50 @@ -48,7 +48,7 @@ typedef struct nsk_jvmti_DCG_paramsStruct { int sign; } nsk_jvmti_DCG_params; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; static volatile int callbacksEnabled = NSK_TRUE; /* ============================================================================= */ @@ -122,7 +122,7 @@ cbDynamicCodeGenerated2(jvmtiEnv *jvmti_env, const char *name, static int enableEvent(jvmtiEventMode enable, jvmtiEvent event) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -212,7 +212,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -221,7 +221,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } plist = (const void *)nsk_list_create(); - if (!NSK_VERIFY(plist != NULL)) + if (!NSK_VERIFY(plist != nullptr)) return JNI_ERR; NSK_DISPLAY1("plist = 0x%p\n", plist); @@ -236,7 +236,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp index 09646218439..8cd0f4c957f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constant names */ @@ -65,8 +65,8 @@ typedef struct { /* descriptions of tested methods */ static MethodDesc methodsDesc[METHODS_COUNT] = { - { "javaMethod", "(I)I", NULL, 0, 0, 0 }, - { "nativeMethod", "(I)I", NULL, 0, 0, 0 } + { "javaMethod", "(I)I", nullptr, 0, 0, 0 }, + { "nativeMethod", "(I)I", nullptr, 0, 0, 0 } }; /* ============================================================================= */ @@ -127,7 +127,7 @@ static int enableEvents(jvmtiEventMode enable) { int i; for (i = 0; i < EVENTS_COUNT; i++) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, eventsList[i], NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, eventsList[i], nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -142,43 +142,43 @@ static int enableEvents(jvmtiEventMode enable) { * - enable events */ static int prepare() { - jclass debugeeClass = NULL; - jclass threadClass = NULL; - jfieldID threadFieldID = NULL; - jthread thread = NULL; + jclass debugeeClass = nullptr; + jclass threadClass = nullptr; + jfieldID threadFieldID = nullptr; + jthread thread = nullptr; int i; for (i = 0; i < METHODS_COUNT; i++) { - methodsDesc[i].method = (jmethodID)NULL; + methodsDesc[i].method = (jmethodID)nullptr; methodsDesc[i].loadEvents = 0; methodsDesc[i].unloadEvents = 0; } - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadFieldID = - jni->GetStaticFieldID(debugeeClass, THREAD_FIELD_NAME, THREAD_FIELD_SIG)) != NULL)) + jni->GetStaticFieldID(debugeeClass, THREAD_FIELD_NAME, THREAD_FIELD_SIG)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (thread = (jthread) - jni->GetStaticObjectField(debugeeClass, threadFieldID)) != NULL)) + jni->GetStaticObjectField(debugeeClass, threadFieldID)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (threadClass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadClass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Find tested methods:\n"); for (i = 0; i < METHODS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (methodsDesc[i].method = - jni->GetMethodID(threadClass, methodsDesc[i].methodName, methodsDesc[i].methodSig)) != NULL)) + jni->GetMethodID(threadClass, methodsDesc[i].methodName, methodsDesc[i].methodSig)) != nullptr)) return NSK_FALSE; NSK_DISPLAY3(" method #%d (%s): 0x%p\n", i, methodsDesc[i].methodName, (void*)methodsDesc[i].method); } NSK_DISPLAY0("Enable events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -220,7 +220,7 @@ static int checkEvents() { */ static int clean() { NSK_DISPLAY0("Disable events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -314,7 +314,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -334,7 +334,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp index 9f1b86471b2..01eaf82f214 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constant names */ @@ -71,8 +71,8 @@ typedef struct { /* descriptions of tested methods */ static MethodDesc methodsDesc[METHODS_COUNT] = { - { "javaMethod", "(I)I", NULL, 0, {}, {} }, - { "nativeMethod", "(I)I", NULL, 0, {}, {} } + { "javaMethod", "(I)I", nullptr, 0, {}, {} }, + { "nativeMethod", "(I)I", nullptr, 0, {}, {} } }; /* current compilation moment */ @@ -166,15 +166,15 @@ static int generateEvents() { * - enable events */ static int prepare() { - jclass debugeeClass = NULL; - jclass threadClass = NULL; - jfieldID threadFieldID = NULL; - jthread thread = NULL; + jclass debugeeClass = nullptr; + jclass threadClass = nullptr; + jfieldID threadFieldID = nullptr; + jthread thread = nullptr; int i; for (i = 0; i < METHODS_COUNT; i++) { int j; - methodsDesc[i].method = (jmethodID)NULL; + methodsDesc[i].method = (jmethodID)nullptr; methodsDesc[i].compiled = NSK_FALSE; for (j = 0; j < MOMENTS_COUNT; j++) { methodsDesc[i].loadEvents[j] = 0; @@ -182,31 +182,31 @@ static int prepare() { } } - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadFieldID = - jni->GetStaticFieldID(debugeeClass, THREAD_FIELD_NAME, THREAD_FIELD_SIG)) != NULL)) + jni->GetStaticFieldID(debugeeClass, THREAD_FIELD_NAME, THREAD_FIELD_SIG)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (thread = (jthread) - jni->GetStaticObjectField(debugeeClass, threadFieldID)) != NULL)) + jni->GetStaticObjectField(debugeeClass, threadFieldID)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (threadClass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadClass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Find tested methods:\n"); for (i = 0; i < METHODS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (methodsDesc[i].method = - jni->GetMethodID(threadClass, methodsDesc[i].methodName, methodsDesc[i].methodSig)) != NULL)) + jni->GetMethodID(threadClass, methodsDesc[i].methodName, methodsDesc[i].methodSig)) != nullptr)) return NSK_FALSE; NSK_DISPLAY3(" method #%d (%s): 0x%p\n", i, methodsDesc[i].methodName, (void*)methodsDesc[i].method); } NSK_DISPLAY0("Enable events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -282,7 +282,7 @@ static int checkEvents() { */ static int clean() { NSK_DISPLAY0("Disable events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -383,7 +383,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -403,7 +403,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp index 87ad1da13f7..ccd0b42a8a6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,10 +33,10 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define JVMTI_EVENT_COUNT (int)(JVMTI_MAX_EVENT_TYPE_VAL - JVMTI_MIN_EVENT_TYPE_VAL + 1) @@ -60,13 +60,13 @@ handler(jvmtiEvent event, jvmtiEnv* jvmti, JNIEnv* jni_env, jstring jclassName; const char *className; - if (!NSK_JNI_VERIFY(jni_env, (classObject = jni_env->GetObjectClass(klass)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (classObject = jni_env->GetObjectClass(klass)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } if (!NSK_JNI_VERIFY(jni_env, (methodID = - jni_env->GetMethodID(classObject, "getName", "()Ljava/lang/String;")) != NULL)) { + jni_env->GetMethodID(classObject, "getName", "()Ljava/lang/String;")) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -75,7 +75,7 @@ handler(jvmtiEvent event, jvmtiEnv* jvmti, JNIEnv* jni_env, className = jni_env->GetStringUTFChars(jclassName, 0); - if (className != NULL && (strcmp(className, EXPECTED_CLASS_NAME) == 0)) { + if (className != nullptr && (strcmp(className, EXPECTED_CLASS_NAME) == 0)) { if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock))) nsk_jvmti_setFailStatus(); @@ -114,7 +114,7 @@ cbClassPrepare(jvmtiEnv* jvmti, JNIEnv* jni_env, jthread thread, jclass klass) { static int enableEvent(jvmtiEventMode enable, jvmtiEvent event) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -249,10 +249,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; classLoaderCount = nsk_jvmti_findOptionIntValue(CLASS_LOADER_COUNT_PARAM, 100); - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp index 4aa814611d9..b3236df4208 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,8 +34,8 @@ extern "C" { /* scaffold objects */ static jlong timeout = 0; -static jvmtiEnv *jvmti = NULL; -static jrawMonitorID syncLock = NULL; +static jvmtiEnv *jvmti = nullptr; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define JVMTI_EVENT_COUNT (int)(JVMTI_MAX_EVENT_TYPE_VAL - JVMTI_MIN_EVENT_TYPE_VAL + 1) @@ -233,7 +233,7 @@ int enableOptionalEvents(jvmtiEnv *jvmti) { jvmtiEvent event = (jvmtiEvent)(i + JVMTI_MIN_EVENT_TYPE_VAL); if (nsk_jvmti_isOptionalEvent(event)) if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); result = NSK_FALSE; @@ -355,7 +355,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -373,7 +373,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp index 2800ce8116b..a9f0321c3bd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,15 +35,15 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; static int methodLoadCount = 0; static int methodUnloadCount = 0; #define NAME_LENGTH 50 -const void *plist = NULL; +const void *plist = nullptr; static volatile int callbacksEnabled = NSK_TRUE; typedef struct nsk_jvmti_CompiledMethodIDStruct { @@ -109,7 +109,7 @@ cbCompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -155,7 +155,7 @@ cbCompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method, static int enableEvent(jvmtiEventMode enable, jvmtiEvent event) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -264,7 +264,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -272,7 +272,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY((plist = (const void *)nsk_list_create()) != NULL)) + if (!NSK_VERIFY((plist = (const void *)nsk_list_create()) != nullptr)) return JNI_ERR; { @@ -293,7 +293,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp index 810e1b1f47c..a2855dc742a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,8 +29,8 @@ extern "C" { -static JNIEnv *jni = NULL; -static jvmtiEnv* jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv* jvmti = nullptr; static jlong timeout = 0; static jboolean eventEnabled = JNI_FALSE; static volatile jboolean eventReceived1 = JNI_FALSE, eventReceived2 = JNI_FALSE; @@ -42,7 +42,7 @@ static jrawMonitorID eventMon; static void JNICALL ClassUnload(jvmtiEnv* jvmti_env, ...) { - JNIEnv *jni_env = NULL; + JNIEnv *jni_env = nullptr; va_list ap; va_start(ap, jvmti_env); @@ -51,9 +51,9 @@ ClassUnload(jvmtiEnv* jvmti_env, ...) { va_end(ap); // The name argument should never be null - if (name == NULL) { + if (name == nullptr) { nsk_jvmti_setFailStatus(); - NSK_COMPLAIN0("ClassUnload: 'name' input parameter is NULL.\n"); + NSK_COMPLAIN0("ClassUnload: 'name' input parameter is null.\n"); } else { NSK_DISPLAY1("Class unloaded %s\n", name); } @@ -152,12 +152,12 @@ jboolean enableClassUnloadEvent (jboolean enable) { if (!NSK_JVMTI_VERIFY( jvmti->SetExtensionEventCallback(extList[i].extension_event_index, - enable ? (jvmtiExtensionEvent)ClassUnload : NULL))) { + enable ? (jvmtiExtensionEvent)ClassUnload : nullptr))) { nsk_jvmti_setFailStatus(); return JNI_FALSE; } if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(mode, (jvmtiEvent)extList[i].extension_event_index, NULL))) { + jvmti->SetEventNotificationMode(mode, (jvmtiEvent)extList[i].extension_event_index, nullptr))) { nsk_jvmti_setFailStatus(); return JNI_FALSE; } @@ -281,14 +281,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("eventMon", &eventMon))) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp index 430f8b27160..252cd19b7ac 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -172,7 +172,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0("setting event callbacks ...\n"); @@ -185,9 +185,9 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp index a2937f86155..bdd20e8951b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ extern "C" { /* ============================================================================= */ static jlong timeout = 0; -static const char* segment = NULL; +static const char* segment = nullptr; static const char* EXP_CLASS_SIGNATURE = "Lnsk/jvmti/scenarios/general_functions/GF04/gf04t001;"; static jrawMonitorID countLock; static jboolean classLoadReceived = JNI_FALSE, classPrepareReceived = JNI_FALSE; @@ -49,7 +49,7 @@ static jint result = PASSED; * @returns NSK_FALSE if any error occured. */ static int addSegment(jvmtiEnv* jvmti, const char segment[], const char where[]) { - void* storage = NULL; + void* storage = nullptr; NSK_DISPLAY1("Add segment: %s\n", segment); if (!NSK_JVMTI_VERIFY(jvmti->AddToBootstrapClassLoaderSearch(segment))) { @@ -97,7 +97,7 @@ ClassLoad(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jclass klass) { sig); classLoadReceived = JNI_TRUE; - if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_LOAD, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_LOAD, nullptr))) { result = STATUS_FAILED; } else { NSK_DISPLAY0("ClassLoad event disabled\n"); @@ -123,7 +123,7 @@ ClassPrepare(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jclass klass) { sig); classPrepareReceived = JNI_TRUE; - if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_PREPARE, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_PREPARE, nullptr))) { result = STATUS_FAILED; } else { NSK_DISPLAY0("ClassPrepare event disabled\n"); @@ -148,19 +148,19 @@ JNIEXPORT jint JNI_OnLoad_gf04t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; timeout = nsk_jvmti_getWaitTime() * 60 * 1000; - segment = nsk_jvmti_findOptionStringValue("segment", NULL); - if (!NSK_VERIFY(segment != NULL)) + segment = nsk_jvmti_findOptionStringValue("segment", nullptr); + if (!NSK_VERIFY(segment != nullptr)) return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("eventLock", &countLock))) @@ -186,12 +186,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); NSK_DISPLAY0("Enabling events: \n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr))) { return JNI_ERR; } else { NSK_DISPLAY0(" ... ClassLoad enabled\n"); } - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, nullptr))) { return JNI_ERR; } else { NSK_DISPLAY0(" ... ClassPrepare enabled\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp index 355f30c51c6..876b3a8464c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,7 +72,7 @@ static void fillEnvStorage(StorageStructure* storage) { * @returns NSK_FALSE if any error occured. */ static int checkEnvStorage(jvmtiEnv* jvmti, const char where[]) { - void* storage = NULL; + void* storage = nullptr; NSK_DISPLAY0("Calling GetEnvironmentLocalStorage():"); if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage(&storage))) { @@ -80,8 +80,8 @@ static int checkEnvStorage(jvmtiEnv* jvmti, const char where[]) { } NSK_DISPLAY1(" ... got storage: 0x%p\n", (void*)storage); - if (storage != NULL) { - NSK_COMPLAIN2("GetEnvironmentLocalStorage() returned NOT NULL storage in %s:\n" + if (storage != nullptr) { + NSK_COMPLAIN2("GetEnvironmentLocalStorage() returned NOT null storage in %s:\n" "# storage pointer: 0x%p\n", where, (void*)storage); return NSK_FALSE; @@ -134,7 +134,7 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { } NSK_DISPLAY0("Set agentProc for second JVMTI env.\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) nsk_jvmti_setFailStatus(); } @@ -149,7 +149,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkEnvStorage(jvmti, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -177,7 +177,7 @@ JNIEXPORT jint JNI_OnLoad_gf06t001(JavaVM *jvm, char *options, void *reserved) { #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - jvmtiEnv* jvmti_1 = NULL; + jvmtiEnv* jvmti_1 = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -199,7 +199,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* Create second environment */ if (!NSK_VERIFY((jvmti_2 = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* Set callbacks for second environment */ @@ -226,7 +226,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp index d5d830e6d9b..7dd894afb8d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ static jlong timeout = 0; /* test objects */ static jrawMonitorID access_lock; static jvmtiPhase phase; -static const char* setVerboseMode = NULL; +static const char* setVerboseMode = nullptr; /* ========================================================================== */ @@ -54,7 +54,7 @@ JNIEXPORT jint JNI_OnLoad_gf08t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -64,10 +64,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", NULL); + setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", nullptr); if (strcmp(setVerboseMode, "y") == 0 || strcmp(setVerboseMode, "yes") == 0) { if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_GC, JNI_TRUE))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp index 4b2455a4f46..ae930eb0805 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ static jlong timeout = 0; /* test objects */ static jrawMonitorID access_lock; static jvmtiPhase phase; -static const char* setVerboseMode = NULL; +static const char* setVerboseMode = nullptr; /* ========================================================================== */ @@ -54,7 +54,7 @@ JNIEXPORT jint JNI_OnLoad_gf08t002(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -64,10 +64,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", NULL); + setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", nullptr); if (strcmp(setVerboseMode, "y") == 0 || strcmp(setVerboseMode, "yes") == 0) { if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_CLASS, JNI_TRUE))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp index ee6e7bf9f73..5c792635968 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ static jlong timeout = 0; /* test objects */ static jrawMonitorID access_lock; static jvmtiPhase phase; -static const char* setVerboseMode = NULL; +static const char* setVerboseMode = nullptr; /* ========================================================================== */ @@ -54,7 +54,7 @@ JNIEXPORT jint JNI_OnLoad_gf08t003(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -64,10 +64,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", NULL); + setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", nullptr); if (strcmp(setVerboseMode, "y") == 0 || strcmp(setVerboseMode, "yes") == 0) { if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_JNI, JNI_TRUE))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp index 634a4d351fa..a903074cd01 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,13 +57,13 @@ JNIEXPORT void JNICALL doRedefineInNativeThread(jvmtiEnv * jvmti, testClass = jni->FindClass(MAIN_CLASS); if (!NSK_JNI_VERIFY(jni, ( - setRedefinitionFailed = jni->GetStaticMethodID(testClass, "setRedefinitionFailed", "()V")) != NULL)) + setRedefinitionFailed = jni->GetStaticMethodID(testClass, "setRedefinitionFailed", "()V")) != nullptr)) { jni->FatalError("TEST FAILED: while getting setRedefinitionFailed()\n"); } if (!NSK_JNI_VERIFY(jni, ( - setRedefinitionDone = jni->GetStaticMethodID(testClass, "setRedefinitionDone", "()V")) != NULL)) + setRedefinitionDone = jni->GetStaticMethodID(testClass, "setRedefinitionDone", "()V")) != nullptr)) { jni->FatalError("TEST FAILED: while getting setRedefinitionDone()\n"); } @@ -142,14 +142,14 @@ Java_nsk_jvmti_scenarios_hotswap_HS103_hs103t002_hs103t002_startAgentThread(JNIE name = jni->NewStringUTF(threadName); clas = jni->FindClass("java/lang/Thread"); - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(clas, "", "(Ljava/lang/String;)V")) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(clas, "", "(Ljava/lang/String;)V")) != nullptr)) { jni->FatalError("failed to get ID for the java method\n"); } thread = (jthread) jni->NewObject(clas,method,name); testAgentThread = jni->NewGlobalRef(thread); err = JVMTI_ERROR_NONE; - err = jvmti->RunAgentThread(testAgentThread, &doRedefineInNativeThread, NULL, + err = jvmti->RunAgentThread(testAgentThread, &doRedefineInNativeThread, nullptr, JVMTI_THREAD_NORM_PRIORITY); if (err == JVMTI_ERROR_INVALID_PRIORITY) { nsk_printf(" JVMTI_ERROR_INVALID_PRIORITY ..\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t001/hs104t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t001/hs104t001.cpp index 72987808f3e..0044aec284e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t001/hs104t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t001/hs104t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,7 +48,7 @@ JNIEXPORT void JNICALL sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti, klass, fileName)) { nsk_printf("Agent:: Successfully redefined.."); - if (nsk_jvmti_disableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_disableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Agent :: NOTIFICATIONS ARE DISABLED \n"); } else { nsk_printf(" Agent :: Failed to disabled \n"); @@ -96,7 +96,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf("Agent :: NOTIFICATIONS ARE ENABLED \n"); } else { nsk_printf(" Error in Eanableing Notifications.."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp index 5f107e31b90..670b48bfeab 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -74,7 +74,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS104_hs104t002_hs104t002_redefineClasses( jclass cla; char fileName[512]; - if (!NSK_JNI_VERIFY(jni, (cla = jni->FindClass(SEARCH_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (cla = jni->FindClass(SEARCH_NAME)) != nullptr)) { nsk_printf(" Agent :: Failed to get class.\n"); nsk_jvmti_agentFailed(); return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp index 5883c17f5b4..200df590244 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constant names */ @@ -64,7 +64,7 @@ void setCurrentStep(JNIEnv* jni_env, int value) { jfieldID fld; if (!NSK_JNI_VERIFY(jni_env, (fld = - jni_env->GetStaticFieldID(testClass, "currentStep", "I")) != NULL)) { + jni_env->GetStaticFieldID(testClass, "currentStep", "I")) != nullptr)) { jni_env->FatalError("TEST FAILED: while getting currentStep fieldID\n"); } @@ -102,7 +102,7 @@ void redefineClass(jvmtiEnv *jvmti_env, jclass klass) { char *className; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -165,7 +165,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { void setBreakPoint(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jclass klass) { jmethodID mid; - if (!NSK_JNI_VERIFY(jni_env, (mid = jni_env->GetMethodID(klass, METHOD_NAME, METHOD_SIG)) != NULL)) + if (!NSK_JNI_VERIFY(jni_env, (mid = jni_env->GetMethodID(klass, METHOD_NAME, METHOD_SIG)) != nullptr)) jni_env->FatalError("[agent] failed to get ID for the java method\n"); if (!NSK_JVMTI_VERIFY(jvmti_env->SetBreakpoint(mid, 1))) @@ -200,7 +200,7 @@ callbackClassLoad(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, nsk_jvmti_setFailStatus(); } - if (generic != NULL) + if (generic != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) { nsk_jvmti_setFailStatus(); } @@ -232,7 +232,7 @@ callbackSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, char *methodName; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methodName, NULL, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methodName, nullptr, nullptr))) { NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } @@ -244,7 +244,7 @@ callbackSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(declaringClass, &declaringClassName, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(declaringClass, &declaringClassName, nullptr))) { NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } @@ -335,7 +335,7 @@ callbackException(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, className, getThreadName(jni_env, thread)); testStep++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -366,7 +366,7 @@ callbackExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, className, getThreadName(jni_env, thread)); testStep++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -397,7 +397,7 @@ int readNewBytecode(jvmtiEnv* jvmti, int testcase) { filename); bytecode = fopen(filename, "rb"); - if (bytecode == NULL) { + if (bytecode == nullptr) { NSK_COMPLAIN0("TEST FAILED: error opening file\n"); return NSK_FALSE; } @@ -430,13 +430,13 @@ const char* getThreadName(JNIEnv* jni_env, jthread thread) { strcpy(chbuffer, ""); - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(thread)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(thread)) != nullptr)) { nsk_jvmti_setFailStatus(); return chbuffer; } if (!NSK_JNI_VERIFY(jni_env, (methodID = - jni_env->GetMethodID(klass, "getName", "()Ljava/lang/String;")) != NULL)) { + jni_env->GetMethodID(klass, "getName", "()Ljava/lang/String;")) != nullptr)) { nsk_jvmti_setFailStatus(); return chbuffer; } @@ -462,7 +462,7 @@ const char* getClassName(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jobject object) { strcpy(chbuffer, ""); - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(object)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(object)) != nullptr)) { nsk_jvmti_setFailStatus(); return chbuffer; } @@ -478,7 +478,7 @@ const char* getClassName(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jobject object) { nsk_jvmti_setFailStatus(); } - if (generic != NULL) + if (generic != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) { nsk_jvmti_setFailStatus(); } @@ -491,7 +491,7 @@ const char* getClassName(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jobject object) { int getLocalVariableValue(jvmtiEnv *jvmti_env, jthread thread, jmethodID method) { - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; int i; jint value = -1; @@ -501,7 +501,7 @@ int getLocalVariableValue(jvmtiEnv *jvmti_env, jthread thread, NSK_COMPLAIN0("TEST FAILED: unable to get local variable table\n\n"); } - if (table != NULL) { + if (table != nullptr) { jvmtiError error; for (i = 0; i < entryCount; i++) { @@ -540,10 +540,10 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_hotswap_HS201_hs201t001_setThread(JNIEnv *env, jclass cls, jthread thread) { - if (!NSK_JNI_VERIFY(env, (testClass = (jclass) env->NewGlobalRef(cls)) != NULL)) + if (!NSK_JNI_VERIFY(env, (testClass = (jclass) env->NewGlobalRef(cls)) != nullptr)) nsk_jvmti_setFailStatus(); - if (!NSK_JNI_VERIFY(env, (testedThread = env->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(env, (testedThread = env->NewGlobalRef(thread)) != nullptr)) nsk_jvmti_setFailStatus(); } @@ -632,7 +632,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -670,7 +670,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { enableEvent(jvmti, JVMTI_EVENT_EXCEPTION, testedThread); enableEvent(jvmti, JVMTI_EVENT_EXCEPTION_CATCH, testedThread); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp index 43cd4463139..8c369dd1d55 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constant names */ @@ -66,7 +66,7 @@ void setCurrentStep(JNIEnv* jni_env, int value) { jfieldID fld; if (!NSK_JNI_VERIFY(jni_env, (fld = - jni_env->GetStaticFieldID(testClass, "currentStep", "I")) != NULL)) { + jni_env->GetStaticFieldID(testClass, "currentStep", "I")) != nullptr)) { jni_env->FatalError("TEST FAILED: while getting currentStep fieldID\n"); } @@ -105,7 +105,7 @@ void redefineClass(jvmtiEnv *jvmti_env, jclass klass) { jint newClassSize; unsigned char* newClassBytes; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -170,7 +170,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { void setBreakPoint(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jclass klass) { jmethodID mid; - if (!NSK_JNI_VERIFY(jni_env, (mid = jni_env->GetMethodID(klass, METHOD_NAME, METHOD_SIG)) != NULL)) + if (!NSK_JNI_VERIFY(jni_env, (mid = jni_env->GetMethodID(klass, METHOD_NAME, METHOD_SIG)) != nullptr)) jni_env->FatalError("[agent] failed to get ID for the java method\n"); if (!NSK_JVMTI_VERIFY(jvmti_env->SetBreakpoint(mid, 1))) @@ -189,7 +189,7 @@ callbackClassLoad(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, char *className; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -230,7 +230,7 @@ callbackSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, char *methodName; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methodName, NULL, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methodName, nullptr, nullptr))) { NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } @@ -242,7 +242,7 @@ callbackSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(declaringClass, &declaringClassName, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(declaringClass, &declaringClassName, nullptr))) { NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } @@ -347,19 +347,19 @@ void handleException(bool isCatch, jobject exception) { const char* className = getClassName(jvmti_env, jni_env, exception); - if (className != NULL && strcmp(EXPECTED_CLASS_SIGN, className) == 0) { + if (className != nullptr && strcmp(EXPECTED_CLASS_SIGN, className) == 0) { jclass klass; const char* threadName = getThreadName(jvmti_env, jni_env, thread); NSK_DISPLAY3(">>>> %s %s in thread - %s\n", isCatch ? "Caught exception" : "Exception", - className, threadName != NULL ? threadName : "NULL"); + className, threadName != nullptr ? threadName : "null"); jvmti->Deallocate((unsigned char*)className); - if (threadName != NULL) { + if (threadName != nullptr) { jvmti->Deallocate((unsigned char*)threadName); } testStep++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -390,7 +390,7 @@ int readNewBytecode(jvmtiEnv* jvmti, jint *newClassSize, unsigned char* *newClas filename); bytecode = fopen(filename, "rb"); - if (bytecode == NULL) { + if (bytecode == nullptr) { NSK_COMPLAIN0("TEST FAILED: error opening file\n"); return NSK_FALSE; } @@ -408,7 +408,7 @@ int readNewBytecode(jvmtiEnv* jvmti, jint *newClassSize, unsigned char* *newClas if (read_bytes != *newClassSize) { NSK_COMPLAIN0("TEST FAILED: error reading file\n"); jvmti->Deallocate(*newClassBytes); - *newClassBytes = NULL; + *newClassBytes = nullptr; return NSK_FALSE; } @@ -422,18 +422,18 @@ const char* getThreadName(jvmtiEnv* jvmti_env, JNIEnv* jni_env, jthread thread) jclass klass; jstring jthreadName; jsize jthreadNameLen; - unsigned char *result = NULL; + unsigned char *result = nullptr; const char *threadName; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(thread)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(thread)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } if (!NSK_JNI_VERIFY(jni_env, (methodID = - jni_env->GetMethodID(klass, "getName", "()Ljava/lang/String;")) != NULL)) { + jni_env->GetMethodID(klass, "getName", "()Ljava/lang/String;")) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } jthreadName = (jstring) jni_env->CallObjectMethod(thread, methodID); @@ -442,7 +442,7 @@ const char* getThreadName(jvmtiEnv* jvmti_env, JNIEnv* jni_env, jthread thread) if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(jthreadNameLen + 1, &result))) { NSK_COMPLAIN0("buffer couldn't be allocated\n"); - return NULL; + return nullptr; } threadName = jni_env->GetStringUTFChars(jthreadName, 0); @@ -461,14 +461,14 @@ const char* getClassName(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jobject object) { char *className; jclass klass; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(object)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(object)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, nullptr))) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } return className; @@ -479,7 +479,7 @@ const char* getClassName(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jobject object) { int getLocalVariableValue(jvmtiEnv *jvmti_env, jthread thread, jmethodID method) { - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; int i; jint value = -1; @@ -489,7 +489,7 @@ int getLocalVariableValue(jvmtiEnv *jvmti_env, jthread thread, NSK_COMPLAIN0("TEST FAILED: unable to get local variable table\n\n"); } - if (table != NULL) { + if (table != nullptr) { jvmtiError error; for (i = 0; i < entryCount; i++) { @@ -528,10 +528,10 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_hotswap_HS201_hs201t002_setThread(JNIEnv *env, jclass cls, jthread thread) { - if (!NSK_JNI_VERIFY(env, (testClass = (jclass) env->NewGlobalRef(cls)) != NULL)) + if (!NSK_JNI_VERIFY(env, (testClass = (jclass) env->NewGlobalRef(cls)) != nullptr)) nsk_jvmti_setFailStatus(); - if (!NSK_JNI_VERIFY(env, (testedThread = env->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(env, (testedThread = env->NewGlobalRef(thread)) != nullptr)) nsk_jvmti_setFailStatus(); enableEvent(jvmti, JVMTI_EVENT_CLASS_LOAD, testedThread); @@ -624,7 +624,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -657,7 +657,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("Enable events\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp index 97b247a3d62..f848d717183 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { JVMTI_EVENT_FRAME_POP }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; static jint bytesCount; /* number of bytes of a redefining class */ @@ -74,7 +74,7 @@ static int expectedMeth(jvmtiEnv *jvmti_env, const char *event, char *sig; int methFound = 0; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, nullptr))) { nsk_jvmti_setFailStatus(); return 0; } @@ -107,7 +107,7 @@ static void doHotSwap(jvmtiEnv *jvmti_env, nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -143,7 +143,7 @@ static void doChecks(jvmtiEnv *jvmti_env, jint methBytesCount; /* number of bytes of a method */ unsigned char *methBytes; /* bytes defining a method */ - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(tMethodID, &name, &sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(tMethodID, &name, &sig, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -196,7 +196,7 @@ void JNICALL MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *env, nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr))) nsk_jvmti_setFailStatus(); } } @@ -298,7 +298,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add required capabilities */ @@ -324,13 +324,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n"); if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, - eventsList, NULL)) + eventsList, nullptr)) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); /* register agent proc */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.cpp index 6b284a54bbc..e7936fda8c5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,7 +56,7 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti, if (strcmp(className,CLASS_NAME) == 0) { jmethodID method; method = jni->GetMethodID(klass, METHOD_NAME, METHOD_SIGN); - if (method == NULL) { + if (method == nullptr) { nsk_printf("Agent:: Method is null "); } else { jlocation start; @@ -73,7 +73,7 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti, nsk_printf(" ## Error occured %s \n",TranslateError(err)); } else { nsk_printf(" NO ERRORS "); - if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_BREAKPOINT, NULL)) { + if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_BREAKPOINT, nullptr)) { nsk_printf(" Enabled.. notification event ..\n"); } } @@ -116,11 +116,11 @@ void JNICALL callbackBreakpoint(jvmtiEnv *jvmti_env, jlocation location) { jvmtiError err; err = JVMTI_ERROR_NONE; - if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_SINGLE_STEP, NULL)) { + if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_SINGLE_STEP, nullptr)) { nsk_printf(" Enabled.. notification event .."); } err= jvmti->SetEventNotificationMode(JVMTI_DISABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err == JVMTI_ERROR_NONE) { nsk_printf(" Disabled notification.."); } @@ -172,7 +172,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" ## Error occured %s \n",TranslateError(rc)); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf("Agent :: NOTIFICATIONS ARE ENABLED \n"); } else { nsk_printf(" Error in Eanableing Notifications.."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.cpp index 12f4cc3fb4e..493e23da000 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ extern "C" { #define METHOD_NAME "display" static jint redefineNumber = 0; -static jvmtiEnv * jvmti = NULL; +static jvmtiEnv * jvmti = nullptr; static volatile bool thread_suspend_error = false; @@ -119,7 +119,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event callbacks \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_METHOD_EXIT, NULL)) { + if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_METHOD_EXIT, nullptr)) { nsk_printf(" Agent :: NOTIFICATIONS ARE ENABLED \n"); } else { nsk_printf(" Agent :: Error Enabling Notifications.."); @@ -160,7 +160,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS202_hs202t002_hs202t002_resumeThread(JNIEnv * // disable notifications before resuming thread // to avoid recursion on PopFrame issued reinvoke - if (nsk_jvmti_disableNotification(jvmti,JVMTI_EVENT_METHOD_EXIT, NULL)) { + if (nsk_jvmti_disableNotification(jvmti,JVMTI_EVENT_METHOD_EXIT, nullptr)) { nsk_printf("Agent :: nsk_jvmti_disabled notifications..\n"); } else { nsk_printf("Agent :: Failed to disable notifications.."); @@ -194,7 +194,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS202_hs202t002_hs202t002_isThreadSuspended(JNI // this again until we see thread_suspend_error is true. jint state = 0; - // No errors possible here: thread is valid, and state is not NULL + // No errors possible here: thread is valid, and state is not nullptr jvmti->GetThreadState(thread, &state); return (state & JVMTI_THREAD_STATE_SUSPENDED) != 0; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.cpp index 2e95e5e7e70..4104656aa25 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,7 +63,7 @@ JNIEXPORT void JNICALL if (strcmp(className,CLASS_NAME) == 0) { jmethodID method; method = jni->GetMethodID(klass,METHOD_NAME,METHOD_SIGN); - if (method != NULL) { + if (method != nullptr) { jlocation start; jlocation end; jvmtiError err ; @@ -166,8 +166,8 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_LOAD, NULL) && - nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_BREAKPOINT,NULL)) { + if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_LOAD, nullptr) && + nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_BREAKPOINT,nullptr)) { nsk_printf("Agent :: NOTIFICATIONS ARE ENABLED \n"); } else { nsk_printf(" Error in Eanableing Notifications.."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.cpp index b1b3b42164f..3328e730f08 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,7 +65,7 @@ callbackClassLoad(jvmtiEnv *jvmti, if (strcmp(className,CLASS_NAME) == 0) { jmethodID method; method = jni->GetMethodID(klass,METHOD_NAME,METHOD_SIGN); - if (method != NULL) { + if (method != nullptr) { jlocation start; jlocation end; jvmtiError err ; @@ -168,8 +168,8 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_LOAD, NULL) && - nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_BREAKPOINT, NULL)) { + if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_LOAD, nullptr) && + nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_BREAKPOINT, nullptr)) { nsk_printf("Agent :: NOTIFICATIONS ARE ENABLED \n"); } else { nsk_printf(" Error in Eanableing Notifications.."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp index a162fa0270c..3f067dd4e9a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,8 +58,8 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, char * className; char * generic; redefineNumber=0; - className=NULL; - generic=NULL; + className=nullptr; + generic=nullptr; if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic))) { nsk_printf("#error Agent :: while getting classname Signature.\n"); nsk_jvmti_agentFailed(); @@ -67,7 +67,7 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, if (strcmp(className,CLASS_NAME) == 0) { jfieldID field; /* get the field id and set watch on that .*/ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, FIELDNAME, TYPE)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, FIELDNAME, TYPE)) != nullptr)) { nsk_printf(" Agent :: (*JNI)->GetFieldID(jni, ...) returns `null`.\n"); nsk_jvmti_agentFailed(); } else if (!NSK_JVMTI_VERIFY(jvmti_env->SetFieldAccessWatch(klass, field))) { @@ -93,7 +93,7 @@ JNIEXPORT void JNICALL callbackFieldAccess(jvmtiEnv *jvmti_env, return; } redefineNumber=0; - if (!NSK_JNI_VERIFY(jni, (clas = jni->FindClass(SEARCH_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (clas = jni->FindClass(SEARCH_NAME)) != nullptr)) { nsk_printf(" Agent :: (*JNI)->FindClass(jni, %s) returns `null`.\n",SEARCH_NAME); nsk_jvmti_agentFailed(); } else { @@ -155,8 +155,8 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf("#error Agent :: while setting event callbacks.\n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, NULL) && - nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_FIELD_ACCESS, NULL)) { + if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, nullptr) && + nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_FIELD_ACCESS, nullptr)) { nsk_printf(" Agent :: Notifications are enabled.\n"); } else { nsk_printf("#error Agent :: Eanableing Notifications.\n"); @@ -202,7 +202,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS203_hs203t003_hs203t003_popThreadFrame(JNIEnv } else { nsk_printf(" Agent :: poped thread frame.\n"); if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FIELD_ACCESS, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr))) { nsk_printf("#error Agent :: failed to disable notification JVMTI_EVENT_FIELD ACCESS.\n"); nsk_jvmti_agentFailed(); } else { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp index e29d7563d43..7a0e59b7206 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,14 +43,14 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jthread thread, jclass klass) { char * className; - className=NULL; + className=nullptr; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, nullptr))) { NSK_COMPLAIN0("#error Agent :: while getting classname.\n"); nsk_jvmti_agentFailed(); } else { if (strcmp(className, CLASS_NAME) == 0) { - if (nsk_jvmti_enableNotification(jvmti_env, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL)) { + if (nsk_jvmti_enableNotification(jvmti_env, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr)) { NSK_DISPLAY0(" Agent :: notification enabled for COMPILED_METHOD_LOAD.\n"); if (!NSK_JVMTI_VERIFY(jvmti_env->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) { NSK_COMPLAIN0("#error Agent :: occured while enabling compiled method events.\n"); @@ -83,16 +83,16 @@ JNIEXPORT void JNICALL callbackCompiledMethodLoad(jvmtiEnv *jvmti_env, char *className; char *methodName; - className = NULL; - methodName = NULL; + className = nullptr; + methodName = nullptr; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(threadClass, &className, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(threadClass, &className, nullptr))) { NSK_COMPLAIN0("#error Agent :: while getting classname.\n"); nsk_jvmti_agentFailed(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methodName, NULL, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methodName, nullptr, nullptr))) { NSK_COMPLAIN0("#error Agent :: while getting methodname.\n"); nsk_jvmti_agentFailed(); return; @@ -115,13 +115,13 @@ JNIEXPORT void JNICALL callbackCompiledMethodLoad(jvmtiEnv *jvmti_env, } } - if (className != NULL) { + if (className != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)className))) { NSK_COMPLAIN1("#error Agent :: failed to Deallocate className = %s.", className); nsk_jvmti_agentFailed(); } } - if (methodName != NULL) { + if (methodName != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)methodName))) { NSK_COMPLAIN1("#error Agent :: failed to Deallocate methodName = %s.", methodName); nsk_jvmti_agentFailed(); @@ -171,7 +171,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { NSK_COMPLAIN0("#error Agent :: occured while setting event callback.\n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, nullptr)) { NSK_DISPLAY0(" Agent :: Notifications are enabled.\n"); } else { NSK_COMPLAIN0("#error Agent :: Error in enableing Notifications.\n"); @@ -214,7 +214,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS203_hs203t004_hs203t004_popThreadFrame(JNIEnv } else { if (NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode(JVMTI_DISABLE, - JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL))) { + JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr))) { NSK_DISPLAY0(" Agent :: Disabled JVMTI_EVENT_COMPILED_METHOD_LOAD.\n"); retvalue = JNI_TRUE; } else { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.cpp index 1f1d3f9db09..bc080f2d882 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,12 +57,12 @@ callbackClassPrepare(jvmtiEnv *jvmti, if ((strcmp(className, CLASS_NAME) == 0)) { jclass cls; cls = jni->FindClass(SEARCH_NAME); - if (cls == NULL) { + if (cls == nullptr) { printf("Agent::CLS is null"); } else { jmethodID method; method = jni->GetMethodID(cls, METHOD_NAME,METHOD_SIGNATURE); - if (method == NULL) { + if (method == nullptr) { printf("Agent::Method is null "); } else { jlocation start; @@ -158,8 +158,8 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { return JNI_ERR; } - nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE , NULL); - nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_BREAKPOINT, NULL); + nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE , nullptr); + nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_BREAKPOINT, nullptr); } return JNI_OK; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp index 4980cd40473..3b182cb616d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,8 +48,8 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, char * className; char * generic; - className = NULL; - generic = NULL; + className = nullptr; + generic = nullptr; redefineNumber=0; if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic))) { NSK_DISPLAY0(" Agent :: Failed get class signature.\n"); @@ -57,7 +57,7 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, } else { if ((strcmp(className, CLASS_NAME) == 0)) { jfieldID fieldId; - if (!NSK_JNI_VERIFY(jni, (fieldId = jni->GetStaticFieldID(klass, FIELDNAME, TYPE)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (fieldId = jni->GetStaticFieldID(klass, FIELDNAME, TYPE)) != nullptr)) { NSK_DISPLAY0(" Agent :: Failed to get FieldId.\n"); nsk_jvmti_agentFailed(); } else { @@ -65,8 +65,8 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, NSK_DISPLAY0(" Agent :: Failed to set watch point on a field.\n"); nsk_jvmti_agentFailed(); } else { - nsk_jvmti_enableNotification(jvmti_env, JVMTI_EVENT_FIELD_ACCESS, NULL); - if (!NSK_JNI_VERIFY(jni, (watchFieldClass = (jclass) jni->NewGlobalRef(klass)) != NULL)) { + nsk_jvmti_enableNotification(jvmti_env, JVMTI_EVENT_FIELD_ACCESS, nullptr); + if (!NSK_JNI_VERIFY(jni, (watchFieldClass = (jclass) jni->NewGlobalRef(klass)) != nullptr)) { NSK_DISPLAY0(" Agent :: Failed to get global reference for class.\n"); nsk_jvmti_agentFailed(); } @@ -77,14 +77,14 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, } } - if (className != NULL) { + if (className != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)className))) { NSK_DISPLAY1(" Agent :: #error failed to Deallocate className = %s.", className); nsk_jvmti_agentFailed(); } } - if (generic != NULL) { + if (generic != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)generic))) { NSK_DISPLAY1(" Agent :: #error failed to Deallocate class signature = %s.", generic); nsk_jvmti_agentFailed(); @@ -105,8 +105,8 @@ JNIEXPORT void JNICALL callbackFieldAccess(jvmtiEnv *jvmti_env, char * className; char * generic; - className = NULL; - generic = NULL; + className = nullptr; + generic = nullptr; if (redefineNumber != 0) { return; } @@ -139,14 +139,14 @@ JNIEXPORT void JNICALL callbackFieldAccess(jvmtiEnv *jvmti_env, } } - if (className != NULL) { + if (className != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)className))) { NSK_DISPLAY1(" Agent :: #error failed to Deallocate className = %s.", className); nsk_jvmti_agentFailed(); } } - if (generic != NULL) { + if (generic != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)generic))) { NSK_DISPLAY1(" Agent :: #error failed to Deallocate class signature = %s.", generic); nsk_jvmti_agentFailed(); @@ -192,7 +192,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { NSK_DISPLAY0(" Agent :: Error occured while setting event call back \n"); return JNI_ERR; } - nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr); } return JNI_OK; } @@ -219,7 +219,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS204_hs204t003_hs204t003_popFrame(JNIEnv * jni nsk_jvmti_agentFailed(); } else { jfieldID fieldId = jni->GetStaticFieldID(watchFieldClass, FIELDNAME, TYPE); - if (!NSK_JNI_VERIFY(jni, fieldId != NULL)) { + if (!NSK_JNI_VERIFY(jni, fieldId != nullptr)) { NSK_DISPLAY0(" Agent :: Failed to get FieldId before droping watchers.\n"); nsk_jvmti_agentFailed(); } else { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.cpp index 09178bac4a1..e8141386cb0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,11 +55,11 @@ callbackClassLoad(jvmtiEnv *jvmti_env, redefineNumber=0; jvmti->GetClassSignature(klass, &className, &generic); if (strcmp(className, CLASS_LOADER_CLASS_NAME) == 0) { - if (klass != NULL) { + if (klass != nullptr) { jmethodID method; cloader = klass; method = jni->GetMethodID(klass,METHOD_NAME,SIGNATURE); - if (method != NULL) { + if (method != nullptr) { jlocation start; jlocation end; jvmtiError err ; @@ -158,8 +158,8 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_LOAD, NULL); - nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_BREAKPOINT, NULL); + nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_LOAD, nullptr); + nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_BREAKPOINT, nullptr); } return JNI_OK; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp index c98c93e6702..d94ce73a3cf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -84,7 +84,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS301_hs301t001_hs301t001_redefine(JNIEnv * jni redefineNumber=0; cls = jni->FindClass(SEARCH_NAME); - if (!NSK_JNI_VERIFY(jni, cls != NULL)) { + if (!NSK_JNI_VERIFY(jni, cls != nullptr)) { nsk_printf("Agent:: (*JNI)->FindClass(jni, %s) returns `null`.\n",SEARCH_NAME); return NSK_FALSE; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp index 3684e060946..6f84921286a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -84,7 +84,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS301_hs301t002_hs301t002_redefine(JNIEnv * jni redefineNumber=0; ret = JNI_FALSE; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(SEARCH_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(SEARCH_NAME)) != nullptr)) { nsk_printf("Agent:: (*JNI)->FindClass(jni, %s) returns `null`.\n", SEARCH_NAME); return NSK_FALSE; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp index a36ddd49fd2..076c885b622 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,7 +45,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); nsk_jvmti_disableNotification(jvmti_env, - JVMTI_EVENT_CLASS_LOAD, NULL); + JVMTI_EVENT_CLASS_LOAD, nullptr); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { nsk_printf("\n Redefine successful.\n"); } else { @@ -92,7 +92,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back.\n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Agent:: Enabled notification.\n"); } else { nsk_printf(" Agent:: Failed to enable notification.\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp index 0a7ab069738..7c8c6af414c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, if (strcmp(className, CLASS_NAME) == 0) { int redefineNumber =0; char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { @@ -93,7 +93,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled notification.\n"); } else { nsk_printf(" Failed to enable notifications.\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t005/hs301t005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t005/hs301t005.cpp index a6bfbae8bd4..7a04fa7c333 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t005/hs301t005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t005/hs301t005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti, if (strcmp(className,CLASS_NAME) == 0) { int redefineNumber =0; char fileName[512]; - nsk_jvmti_disableNotification(jvmti, JVMTI_EVENT_CLASS_LOAD, NULL); + nsk_jvmti_disableNotification(jvmti, JVMTI_EVENT_CLASS_LOAD, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti, klass, fileName)) { nsk_printf("\n Redefine successful ..\n"); @@ -88,7 +88,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t001/hs302t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t001/hs302t001.cpp index cd474e6a71d..883c197533b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t001/hs302t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t001/hs302t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { nsk_printf("Redefine successful ..\n"); } else { @@ -88,7 +88,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t002/hs302t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t002/hs302t002.cpp index 14fa9aef071..9cd0e4006cc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t002/hs302t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t002/hs302t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jvmti_env->GetClassSignature(klass, &className, &generic); if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { nsk_printf("Redefine successful ..\n"); @@ -94,7 +94,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t003/hs302t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t003/hs302t003.cpp index 2625b7fcb4c..217a27bb5b5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t003/hs302t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t003/hs302t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, char fileName[512]; nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { nsk_printf("Redefine successful ..\n"); } else { @@ -93,7 +93,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t004/hs302t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t004/hs302t004.cpp index 9c7d26fd543..5cf83fbd4a7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t004/hs302t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t004/hs302t004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, char fileName[512]; nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); if (nsk_jvmti_redefineClass(jvmti_env, klass,fileName)) { nsk_printf("Redefine successful ..\n"); } else { @@ -88,7 +88,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t005/hs302t005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t005/hs302t005.cpp index ac0b3ca62e1..c6b9a3d0833 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t005/hs302t005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t005/hs302t005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jvmti_env->GetClassSignature(klass, &className, &generic); if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass,fileName)) { @@ -90,7 +90,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t006/hs302t006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t006/hs302t006.cpp index 4e896c79c5b..ef5d37e6659 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t006/hs302t006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t006/hs302t006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jvmti_env->GetClassSignature(klass, &className, &generic); if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { @@ -89,7 +89,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t007/hs302t007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t007/hs302t007.cpp index f1dd8720697..81d83405929 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t007/hs302t007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t007/hs302t007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jvmti_env->GetClassSignature(klass, &className, &generic); if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { @@ -86,7 +86,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t008/hs302t008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t008/hs302t008.cpp index 1f11ca27d3b..54506880d09 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t008/hs302t008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t008/hs302t008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jvmti_env->GetClassSignature(klass, &className, &generic); if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { @@ -89,7 +89,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t009/hs302t009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t009/hs302t009.cpp index dbcf4290b22..95fce3ff410 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t009/hs302t009.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t009/hs302t009.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass,fileName)) { @@ -89,7 +89,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t010/hs302t010.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t010/hs302t010.cpp index fd15976ab42..0d8525c8f6e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t010/hs302t010.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t010/hs302t010.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jvmti_env->GetClassSignature(klass, &className, &generic); if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { @@ -88,7 +88,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t011/hs302t011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t011/hs302t011.cpp index eb9a17c1791..b48aae2a391 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t011/hs302t011.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t011/hs302t011.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jvmti_env->GetClassSignature(klass, &className, &generic); if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { @@ -89,7 +89,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t012/hs302t012.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t012/hs302t012.cpp index 4324a18dc73..2bcc8da5020 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t012/hs302t012.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t012/hs302t012.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jvmti_env->GetClassSignature(klass, &className, &generic); if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { @@ -91,7 +91,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp index d3d6ea40c8c..2c9f095737c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,36 +40,36 @@ extern "C" { static const char *classSig = "Lnsk/jvmti/scenarios/jni_interception/JI01/ji01t001;"; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jrawMonitorID eventLock; static jvmtiEventCallbacks callbacks; static jint result = NSK_STATUS_PASSED; // test thread -static jthread testThread = NULL; +static jthread testThread = nullptr; /* the original JNI function table */ -static jniNativeInterface *orig_jni_functions = NULL; +static jniNativeInterface *orig_jni_functions = nullptr; /* the redirected JNI function table */ -static jniNativeInterface *redir_jni_functions = NULL; +static jniNativeInterface *redir_jni_functions = nullptr; /* number of the redirected JNI function calls */ static volatile int fnd_calls = 0; void setTestThread(JNIEnv *env) { - jthread curThread = NULL; + jthread curThread = nullptr; NSK_JVMTI_VERIFY(jvmti->GetCurrentThread(&curThread)); testThread = env->NewGlobalRef(curThread); } void resetTestThread(JNIEnv *env) { env->DeleteGlobalRef(testThread); - testThread = NULL; + testThread = nullptr; } bool isOnTestThread(JNIEnv *env) { - jthread curThread = NULL; + jthread curThread = nullptr; NSK_JVMTI_VERIFY(jvmti->GetCurrentThread(&curThread)); return env->IsSameObject(testThread, curThread); } @@ -329,7 +329,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; - if (!NSK_VERIFY(jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1) == JNI_OK && jvmti != NULL)) + if (!NSK_VERIFY(jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1) == JNI_OK && jvmti != nullptr)) return JNI_ERR; @@ -354,11 +354,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("Event callbacks are set\nEnabling events...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; NSK_DISPLAY0("Events are enabled\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp index 1d452892f2c..f55c48c218f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,15 +35,15 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static int verbose = 0; /* the original JNI function table */ -static jniNativeInterface *orig_jni_functions = NULL; +static jniNativeInterface *orig_jni_functions = nullptr; /* the redirected JNI function table */ -static jniNativeInterface *redir_jni_functions = NULL; +static jniNativeInterface *redir_jni_functions = nullptr; /* number of the redirected JNI function calls */ int call_count = 0; @@ -115,7 +115,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t001_check(JNIEnv *env, jclass cls) { jint ver; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; @@ -183,14 +183,14 @@ JNIEXPORT jint JNI_OnLoad_ji03t001(JavaVM *jvm, char *options, void *reserved) { jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "-verbose") == 0) + if (options != nullptr && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp index 0ed3d60a31e..e7350dac3af 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static int verbose = 0; @@ -53,15 +53,15 @@ typedef struct { /* line numbers of a method */ } methInfo; static methInfo meth_info[] = { - { 0, "statMeth", "(I)D", NULL, "statMeth_calls", NULL, 0, 0 }, - { 1, "voidMeth", "()V", NULL, "voidMeth_calls", NULL, 0, 0 } + { 0, "statMeth", "(I)D", nullptr, "statMeth_calls", nullptr, 0, 0 }, + { 1, "voidMeth", "()V", nullptr, "voidMeth_calls", nullptr, 0, 0 } }; /* the original JNI function table */ -static jniNativeInterface *orig_jni_functions = NULL; +static jniNativeInterface *orig_jni_functions = nullptr; /* the redirected JNI function table */ -static jniNativeInterface *redir_jni_functions = NULL; +static jniNativeInterface *redir_jni_functions = nullptr; /** redirected JNI functions **/ jdouble JNICALL MyCallStaticDoubleMethodV(JNIEnv *env, jclass cls, jmethodID mid, va_list args) { @@ -127,7 +127,7 @@ void doRedirect(JNIEnv *env, jclass cls) { meth_info[i].mid = env->GetStaticMethodID( cls, meth_info[i].m_name, meth_info[i].m_sign); } - if (meth_info[i].mid == NULL) { + if (meth_info[i].mid == nullptr) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILURE: failed to get the ID for the method \"%s %s\"\n", __FILE__, __LINE__, meth_info[i].m_name, meth_info[i].m_sign); @@ -270,7 +270,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t002_check(JNIEnv *env, jobject obj) { jclass objCls; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; @@ -309,14 +309,14 @@ JNIEXPORT jint JNI_OnLoad_ji03t002(JavaVM *jvm, char *options, void *reserved) { jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "-verbose") == 0) + if (options != nullptr && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp index 4bb4e45fb07..9b6f70525ea 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,21 +36,21 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static int verbose = 0; // test thread -static jthread testThread = NULL; +static jthread testThread = nullptr; static const char *javaField = "exc"; static const char *excClassSig = "Lnsk/jvmti/scenarios/jni_interception/JI03/ji03t003Exc;"; /* the original JNI function table */ -static jniNativeInterface *orig_jni_functions = NULL; +static jniNativeInterface *orig_jni_functions = nullptr; /* the redirected JNI function table */ -static jniNativeInterface *redir_jni_functions = NULL; +static jniNativeInterface *redir_jni_functions = nullptr; /* number of the redirected JNI function calls */ int throw_calls = 0; @@ -58,18 +58,18 @@ int thrownew_calls = 0; int excoccur_calls = 0; void setTestThread(JNIEnv *env) { - jthread curThread = NULL; + jthread curThread = nullptr; NSK_JVMTI_VERIFY(jvmti->GetCurrentThread(&curThread)); testThread = env->NewGlobalRef(curThread); } void resetTestThread(JNIEnv *env) { env->DeleteGlobalRef(testThread); - testThread = NULL; + testThread = nullptr; } bool isOnTestThread(JNIEnv *env) { - jthread curThread = NULL; + jthread curThread = nullptr; NSK_JVMTI_VERIFY(jvmti->GetCurrentThread(&curThread)); return env->IsSameObject(testThread, curThread); } @@ -290,7 +290,7 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t003_check(JNIEnv *env, jobj jclass thrw; jclass objCls; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; @@ -357,14 +357,14 @@ JNIEXPORT jint JNI_OnLoad_ji03t003(JavaVM *jvm, char *options, void *reserved) { jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "-verbose") == 0) + if (options != nullptr && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp index ffbe992669e..d25d2c9fcc1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static int verbose = 0; @@ -44,10 +44,10 @@ static const char *classSig = "Lnsk/jvmti/scenarios/jni_interception/JI03/ji03t004a;"; /* the original JNI function table */ -static jniNativeInterface *orig_jni_functions = NULL; +static jniNativeInterface *orig_jni_functions = nullptr; /* the redirected JNI function table */ -static jniNativeInterface *redir_jni_functions = NULL; +static jniNativeInterface *redir_jni_functions = nullptr; /* number of the redirected JNI function calls */ int allobj_calls = 0; @@ -134,7 +134,7 @@ void doExec(JNIEnv *env, jclass allCls, jmethodID ctorId, const char *msg, ...) va_list args; va_start(args, msg); allObj = env->AllocObject(allCls); - if (allObj == NULL) { + if (allObj == nullptr) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to call %s AllocObject()\n", __FILE__, __LINE__, msg); @@ -150,7 +150,7 @@ void doExec(JNIEnv *env, jclass allCls, jmethodID ctorId, const char *msg, ...) } newObj = env->NewObjectV(allCls, ctorId, args); - if (newObj == NULL) { + if (newObj == nullptr) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to call %s NewObjectV()\n", __FILE__, __LINE__, msg); @@ -208,21 +208,21 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t004_check(JNIEnv *env, jobj jmethodID ctorId; jclass objCls; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; } objCls = env->FindClass(classSig); - if (objCls == NULL) { + if (objCls == nullptr) { printf("(%s,%d): TEST FAILED: failed to call FindClass() for \"%s\"\n", __FILE__, __LINE__, classSig); return STATUS_FAILED; } ctorId = env->GetMethodID(objCls, "", "()V"); - if (ctorId == NULL) { + if (ctorId == nullptr) { printf("(%s,%d): TEST FAILED: failed to call GetMethodID() for a constructor\n", __FILE__, __LINE__); return STATUS_FAILED; @@ -259,14 +259,14 @@ JNIEXPORT jint JNI_OnLoad_ji03t004(JavaVM *jvm, char *options, void *reserved) { jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "-verbose") == 0) + if (options != nullptr && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp index a38d73ba821..3db35166c6c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -179,7 +179,7 @@ static int initAgent(int indx) { NSK_DISPLAY1("\nagent %s initializer: obtaining the JVMTI env ...\n", (indx == 0) ? "A" : "B"); res = vm->GetEnv((void **) &jvmti[indx], JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti[indx] == NULL) { + if (res != JNI_OK || jvmti[indx] == nullptr) { NSK_COMPLAIN1("TEST FAILURE: failed to call GetEnv for the agent %s\n", (indx == 0) ? "A" : "B"); result = STATUS_FAILED; @@ -207,7 +207,7 @@ static int initAgent(int indx) { NSK_DISPLAY1("\nagent %s initializer: setting event callbacks done\n\tenabling events ...\n", (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, nullptr); 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", (indx == 0) ? "A" : "B", TranslateError(err)); @@ -227,7 +227,7 @@ static void startAgent(int indx) { (indx == 0) ? "A" : "B"); void* context = (void*) ((indx == 0) ? "agent A" : "agent B"); agentThr[indx] = THREAD_new((indx == 0) ? agentA : agentB, context); - if (THREAD_start(agentThr[indx]) == NULL) { + if (THREAD_start(agentThr[indx]) == nullptr) { NSK_COMPLAIN1("TEST FAILURE: cannot start the agent %s thread\n", (indx == 0) ? "A" : "B"); exit(STATUS_FAILED); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp index d5dfc829d1b..3a2e82c3d3a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,7 +59,7 @@ static const char *classSig = "Lnsk/jvmti/scenarios/jni_interception/JI06/ji06t001a;"; static JavaVM *vm; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static volatile int verbose = 0; @@ -72,10 +72,10 @@ static volatile jobject clsObj; static jrawMonitorID countLock; /* the original JNI function table */ -static jniNativeInterface *orig_jni_functions = NULL; +static jniNativeInterface *orig_jni_functions = nullptr; /* the redirected JNI function table */ -static jniNativeInterface *redir_jni_functions = NULL; +static jniNativeInterface *redir_jni_functions = nullptr; /* number of the redirected JNI function calls */ static volatile int monent_calls = 0; @@ -315,21 +315,21 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI06_ji06t001_check(JNIEnv *env, jobj char *ownContext = (char*) "ownerThr"; char *redirContext = (char*) "redirectorThr"; int exitCode = PASSED; - void *ownThr = NULL; - void *redirThr = NULL; + void *ownThr = nullptr; + void *redirThr = nullptr; void *waitThr[MAX_THREADS]; int waitContElem[MAX_THREADS]; /* context of a particular waiting thread */ int i; int tries = 0; - if (jvmti == NULL) { + if (jvmti == nullptr) { NSK_COMPLAIN0("TEST FAILURE: JVMTI client was not properly loaded\n"); return STATUS_FAILED; } /* prepare the testing */ clsObj = env->NewGlobalRef(getObjectFromField(env, obj)); - if (clsObj == NULL) { + if (clsObj == nullptr) { NSK_COMPLAIN1("TEST FAILURE: cannot create a new global reference of class \"%s\"\n", classSig); env->FatalError("failed to create a new global reference"); @@ -337,7 +337,7 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI06_ji06t001_check(JNIEnv *env, jobj NSK_DISPLAY0("starting monitor owner thread ...\n"); ownThr = THREAD_new(ownerThread, ownContext); - if (THREAD_start(ownThr) == NULL) { + if (THREAD_start(ownThr) == nullptr) { NSK_COMPLAIN0("TEST FAILURE: cannot start monitor owner thread\n"); exit(STATUS_FAILED); } @@ -360,7 +360,7 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI06_ji06t001_check(JNIEnv *env, jobj waitContElem[i] = i+1; /* 4932877 fix in accordance with ANSI C: thread context of type int -> int* -> void* */ waitThr[i] = THREAD_new(waitingThread, (void *) &(waitContElem[i])); - if (THREAD_start(waitThr[i]) == NULL) { + if (THREAD_start(waitThr[i]) == nullptr) { NSK_COMPLAIN1("TEST FAILURE: cannot start waiting thread #%d\n", i+1); exit(STATUS_FAILED); @@ -384,7 +384,7 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI06_ji06t001_check(JNIEnv *env, jobj NSK_DISPLAY0(">>> TEST CASE a) Trying to redirect the JNI function ...\n\n" "starting redirector thread ...\n"); redirThr = THREAD_new(redirectorThread, redirContext); - if (THREAD_start(redirThr) == NULL) { + if (THREAD_start(redirThr) == nullptr) { NSK_COMPLAIN0("TEST FAILURE: cannot start redirector thread\n"); exit(STATUS_FAILED); } @@ -431,7 +431,7 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI06_ji06t001_check(JNIEnv *env, jobj /* 4932877 fix in accordance with ANSI C: thread context of type int -> int* -> void* */ waitThr[MAX_THREADS-1] = THREAD_new(waitingThread, (void *) &(waitContElem[MAX_THREADS-1])); - if (THREAD_start(waitThr[MAX_THREADS-1]) == NULL) { + if (THREAD_start(waitThr[MAX_THREADS-1]) == nullptr) { NSK_COMPLAIN0("TEST FAILURE: cannot start verification thread\n"); exit(STATUS_FAILED); } @@ -482,7 +482,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; vm = jvm; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001.cpp index 56bf54b2a94..f0771daa56a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -69,9 +69,9 @@ JNIEXPORT jint JNI_OnLoad_ma01t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; - const char* name = NULL; + const char* name = nullptr; int found = NSK_FALSE; int i, count; @@ -97,10 +97,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001a.cpp index 800aebecd87..959a26465e5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -69,9 +69,9 @@ JNIEXPORT jint JNI_OnLoad_ma01t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; - const char* name = NULL; + const char* name = nullptr; int found = NSK_FALSE; int i, count; @@ -97,10 +97,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp index 464a8186b51..0d7a1f5fe1a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -91,7 +91,7 @@ JNIEXPORT jint JNI_OnLoad_ma02t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -102,10 +102,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -114,10 +114,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp index 2d850db5d8c..77e0ff05f50 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -91,7 +91,7 @@ JNIEXPORT jint JNI_OnLoad_ma02t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -102,10 +102,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -114,10 +114,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp index cb10b246b30..6b1d29f4991 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -102,7 +102,7 @@ JNIEXPORT jint JNI_OnLoad_ma03t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -113,10 +113,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -126,13 +126,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001a.cpp index ec744e3bdde..38fa0bb8e1f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -103,7 +103,7 @@ JNIEXPORT jint JNI_OnLoad_ma03t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -114,10 +114,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp index 937daddbd39..a3f28659bae 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject testedObject = NULL; +static jobject testedObject = nullptr; /* ========================================================================== */ @@ -47,24 +47,24 @@ static int prepare(JNIEnv* jni) { const char* CLASS_NAME = "nsk/jvmti/scenarios/multienv/MA04/ma04t001"; const char* FIELD_NAME = "testedObject"; const char* FIELD_SIGNATURE = "Ljava/lang/Object;"; - jclass cls = NULL; - jfieldID fid = NULL; + jclass cls = nullptr; + jfieldID fid = nullptr; NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n"); NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -200,7 +200,7 @@ JNIEXPORT jint JNI_OnLoad_ma04t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -212,7 +212,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -221,7 +221,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp index cbc5bc9054f..1f07af5da4e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject testedObject = NULL; +static jobject testedObject = nullptr; /* ========================================================================== */ @@ -47,24 +47,24 @@ static int prepare(JNIEnv* jni) { const char* CLASS_NAME = "nsk/jvmti/scenarios/multienv/MA04/ma04t001"; const char* FIELD_NAME = "testedObject"; const char* FIELD_SIGNATURE = "Ljava/lang/Object;"; - jclass cls = NULL; - jfieldID fid = NULL; + jclass cls = nullptr; + jfieldID fid = nullptr; NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n"); NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -200,7 +200,7 @@ JNIEXPORT jint JNI_OnLoad_ma04t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -212,7 +212,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -221,7 +221,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp index 2091ef57ca6..c4bff40748c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,9 +39,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject testedObject = NULL; -static jobject testedInstance = NULL; -static jclass testedClass = NULL; +static jobject testedObject = nullptr; +static jobject testedInstance = nullptr; +static jclass testedClass = nullptr; static int ObjectsCount = 0; /* ========================================================================== */ @@ -76,33 +76,33 @@ static int prepare(JNIEnv* jni) { const char* FIELD_SIGNATURE = "Ljava/lang/Object;"; const char* INSTANCE_NAME = "testedInstance1"; const char* INSTANCE_SIGNATURE = "Lnsk/jvmti/scenarios/multienv/MA04/ma04t002;"; - jfieldID fid = NULL; + jfieldID fid = nullptr; NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n"); NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(testedClass, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(testedClass, fid)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find class instance: %s:%s\n", INSTANCE_NAME, INSTANCE_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(testedClass, INSTANCE_NAME, INSTANCE_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(testedClass, INSTANCE_NAME, INSTANCE_SIGNATURE)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (testedInstance = - jni->GetStaticObjectField(testedClass, fid)) != NULL)) + jni->GetStaticObjectField(testedClass, fid)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -305,7 +305,7 @@ JNIEXPORT jint JNI_OnLoad_ma04t002(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -317,7 +317,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -327,14 +327,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp index cd639c1fd78..0834d306a1c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,9 +39,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject testedObject = NULL; -static jobject testedInstance = NULL; -static jclass testedClass = NULL; +static jobject testedObject = nullptr; +static jobject testedInstance = nullptr; +static jclass testedClass = nullptr; static int ObjectsCount = 0; /* ========================================================================== */ @@ -76,33 +76,33 @@ static int prepare(JNIEnv* jni) { const char* FIELD_SIGNATURE = "Ljava/lang/Object;"; const char* INSTANCE_NAME = "testedInstance2"; const char* INSTANCE_SIGNATURE = "Lnsk/jvmti/scenarios/multienv/MA04/ma04t002;"; - jfieldID fid = NULL; + jfieldID fid = nullptr; NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n"); NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(testedClass, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(testedClass, fid)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find class instance: %s:%s\n", INSTANCE_NAME, INSTANCE_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(testedClass, INSTANCE_NAME, INSTANCE_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(testedClass, INSTANCE_NAME, INSTANCE_SIGNATURE)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (testedInstance = - jni->GetStaticObjectField(testedClass, fid)) != NULL)) + jni->GetStaticObjectField(testedClass, fid)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -303,7 +303,7 @@ JNIEXPORT jint JNI_OnLoad_ma04t002a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -315,7 +315,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -325,14 +325,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp index af2922e055b..d6eb01b18b8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject testedObject = NULL; +static jobject testedObject = nullptr; static int ObjectFreeEventsCount = 0; /* ========================================================================== */ @@ -82,24 +82,24 @@ static int prepare(JNIEnv* jni) { const char* CLASS_NAME = "nsk/jvmti/scenarios/multienv/MA04/ma04t003"; const char* FIELD_NAME = "testedObject1"; const char* FIELD_SIGNATURE = "Ljava/lang/Object;"; - jclass cls = NULL; - jfieldID fid = NULL; + jclass cls = nullptr; + jfieldID fid = nullptr; NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n"); NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -146,7 +146,7 @@ JNIEXPORT jint JNI_OnLoad_ma04t003(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -158,7 +158,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -168,7 +168,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -177,10 +177,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp index 3df2bf2c0b9..5a42cd21e95 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject testedObject = NULL; +static jobject testedObject = nullptr; static int ObjectFreeEventsCount = 0; /* ========================================================================== */ @@ -82,24 +82,24 @@ static int prepare(JNIEnv* jni) { const char* CLASS_NAME = "nsk/jvmti/scenarios/multienv/MA04/ma04t003"; const char* FIELD_NAME = "testedObject2"; const char* FIELD_SIGNATURE = "Ljava/lang/Object;"; - jclass cls = NULL; - jfieldID fid = NULL; + jclass cls = nullptr; + jfieldID fid = nullptr; NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n"); NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -146,7 +146,7 @@ JNIEXPORT jint JNI_OnLoad_ma04t003a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -158,7 +158,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -168,7 +168,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -177,10 +177,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp index 6c07c02a5d1..c57c7cebb4d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,8 +38,8 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jmethodID method = NULL; +static jthread thread = nullptr; +static jmethodID method = nullptr; static int BreakpointEventsCount = 0; static int FramePopEventsCount = 0; @@ -50,19 +50,19 @@ static int FramePopEventsCount = 0; static void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; BreakpointEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY2("Breakpoint event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); switch (BreakpointEventsCount) { @@ -93,20 +93,20 @@ static void JNICALL FramePop(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jboolean wasPopedByException) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; FramePopEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("FramePop event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -115,8 +115,8 @@ FramePop(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; - jclass klass = NULL; + jthread *threads = nullptr; + jclass klass = nullptr; jint threads_count = 0; int i; @@ -126,12 +126,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -141,11 +141,11 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } - if (info.name != NULL) { + if (info.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) return NSK_FALSE; } @@ -155,29 +155,29 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (thread == NULL) { + if (thread == nullptr) { NSK_COMPLAIN0("Debuggee thread not found"); return NSK_FALSE; } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'checkPoint' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "checkPoint", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "checkPoint", "()V")) != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->SetBreakpoint(method, 0))) return NSK_FALSE; /* enable events */ - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr))) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr))) return NSK_FALSE; return NSK_TRUE; @@ -212,7 +212,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, nullptr))) nsk_jvmti_setFailStatus(); NSK_TRACE(jvmti->ClearBreakpoint(method, 0)); @@ -237,7 +237,7 @@ JNIEXPORT jint JNI_OnLoad_ma05t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -249,7 +249,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -258,7 +258,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp index 785cdeb6018..19f6e52837e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,8 +38,8 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jmethodID midCheckPoint = NULL; +static jthread thread = nullptr; +static jmethodID midCheckPoint = nullptr; static int MethodEntryEventsCount = 0; static int FramePopEventsCount = 0; @@ -50,23 +50,23 @@ static int FramePopEventsCount = 0; static void JNICALL MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; if (method != midCheckPoint) return; MethodEntryEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("MethodEntry event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); switch (MethodEntryEventsCount) { @@ -82,7 +82,7 @@ MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env, case 3: NSK_DISPLAY0("Testcase #3: FramePop disabled in 2nd agent\n"); - if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, nullptr))) nsk_jvmti_setFailStatus(); if (!NSK_JVMTI_VERIFY(jvmti_env->NotifyFramePop(thread, 0))) nsk_jvmti_setFailStatus(); @@ -99,20 +99,20 @@ static void JNICALL FramePop(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jboolean wasPopedByException) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; FramePopEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("FramePop event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); switch (MethodEntryEventsCount) { @@ -142,8 +142,8 @@ FramePop(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; - jclass klass = NULL; + jthread *threads = nullptr; + jclass klass = nullptr; jint threads_count = 0; int i; @@ -153,12 +153,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -168,11 +168,11 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } - if (info.name != NULL) { + if (info.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) return NSK_FALSE; } @@ -182,26 +182,26 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (thread == NULL) { + if (thread == nullptr) { NSK_COMPLAIN0("Debuggee thread not found"); return NSK_FALSE; } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'checkPoint' */ - if (!NSK_JNI_VERIFY(jni, (midCheckPoint = jni->GetMethodID(klass, "checkPoint", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (midCheckPoint = jni->GetMethodID(klass, "checkPoint", "()V")) != nullptr)) return NSK_FALSE; /* enable events */ - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr))) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr))) return NSK_FALSE; return NSK_TRUE; @@ -233,7 +233,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_TRACE(jni->DeleteGlobalRef(thread)); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr))) nsk_jvmti_setFailStatus(); if (!nsk_jvmti_resumeSync()) @@ -255,7 +255,7 @@ JNIEXPORT jint JNI_OnLoad_ma05t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -267,7 +267,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -276,7 +276,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp index 812d8e09ab9..6d6be2d9b8a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,9 +38,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jclass testedClass = NULL; +static jclass testedClass = nullptr; static jint klass_byte_count = 0; -static unsigned char *klass_bytes = NULL; +static unsigned char *klass_bytes = nullptr; static int magicIndex = 0; static int ClassFileLoadHookEventFlag = NSK_FALSE; @@ -59,11 +59,11 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jint *new_class_data_len, unsigned char** new_class_data) { jint i; - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { ClassFileLoadHookEventFlag = NSK_TRUE; NSK_DISPLAY0("ClassFileLoadHook event\n"); - if (class_being_redefined == NULL) { + if (class_being_redefined == nullptr) { /* sent by class load */ if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &klass_bytes))) nsk_jvmti_setFailStatus(); @@ -93,10 +93,10 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -107,7 +107,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { static int redefine(jvmtiEnv* jvmti, jint value) { jvmtiClassDefinition class_def; - if (!NSK_VERIFY(klass_byte_count != 0 && klass_bytes != NULL)) + if (!NSK_VERIFY(klass_byte_count != 0 && klass_bytes != nullptr)) return NSK_FALSE; if (!NSK_VERIFY(magicIndex != 0)) @@ -178,7 +178,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) nsk_jvmti_setFailStatus(); NSK_TRACE(jni->DeleteGlobalRef(testedClass)); @@ -202,7 +202,7 @@ JNIEXPORT jint JNI_OnLoad_ma06t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -214,7 +214,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -222,7 +222,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -230,7 +230,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp index 9d97aa5f2cb..daf92c53ac4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,9 +38,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jclass testedClass = NULL; +static jclass testedClass = nullptr; static jint klass_byte_count = 0; -static unsigned char *klass_bytes = NULL; +static unsigned char *klass_bytes = nullptr; static int magicIndex = 0; static int ClassFileLoadHookEventFlag = NSK_FALSE; @@ -59,11 +59,11 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jint *new_class_data_len, unsigned char** new_class_data) { jint i; - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { ClassFileLoadHookEventFlag = NSK_TRUE; NSK_DISPLAY0("ClassFileLoadHook event\n"); - if (class_being_redefined == NULL) { + if (class_being_redefined == nullptr) { /* sent by class load */ if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &klass_bytes))) nsk_jvmti_setFailStatus(); @@ -93,10 +93,10 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -107,7 +107,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { static int redefine(jvmtiEnv* jvmti, jint value) { jvmtiClassDefinition class_def; - if (!NSK_VERIFY(klass_byte_count != 0 && klass_bytes != NULL)) + if (!NSK_VERIFY(klass_byte_count != 0 && klass_bytes != nullptr)) return NSK_FALSE; if (!NSK_VERIFY(magicIndex != 0)) @@ -178,7 +178,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) nsk_jvmti_setFailStatus(); NSK_TRACE(jni->DeleteGlobalRef(testedClass)); @@ -202,7 +202,7 @@ JNIEXPORT jint JNI_OnLoad_ma06t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -214,7 +214,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -222,7 +222,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -230,7 +230,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp index 0fa045ead94..cb21bce2ee7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ static jlong timeout = 0; /* test objects */ static jint klass_byte_count = 0; -static unsigned char *klass_bytes = NULL; +static unsigned char *klass_bytes = nullptr; static int ClassFileLoadHookEventFlag = NSK_FALSE; const char* CLASS_NAME = "nsk/jvmti/scenarios/multienv/MA07/ma07t001a"; @@ -62,11 +62,11 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jint magicIndex = 0; jint i; - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { ClassFileLoadHookEventFlag = NSK_TRUE; NSK_DISPLAY0("ClassFileLoadHook event\n"); - if (!NSK_VERIFY(class_being_redefined == NULL)) { + if (!NSK_VERIFY(class_being_redefined == nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -151,7 +151,7 @@ JNIEXPORT jint JNI_OnLoad_ma07t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -162,10 +162,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -173,7 +173,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp index fe5965ba627..e5410c9394c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ static jlong timeout = 0; /* test objects */ static jint klass_byte_count = 0; -static unsigned char *klass_bytes = NULL; +static unsigned char *klass_bytes = nullptr; static int ClassFileLoadHookEventFlag = NSK_FALSE; const char* CLASS_NAME = "nsk/jvmti/scenarios/multienv/MA07/ma07t001a"; @@ -62,11 +62,11 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jint magicIndex = 0; jint i; - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { ClassFileLoadHookEventFlag = NSK_TRUE; NSK_DISPLAY0("ClassFileLoadHook event\n"); - if (!NSK_VERIFY(class_being_redefined == NULL)) { + if (!NSK_VERIFY(class_being_redefined == nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -152,7 +152,7 @@ JNIEXPORT jint JNI_OnLoad_ma07t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -163,10 +163,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -174,7 +174,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001.cpp index fd6d56029d3..375a1c944b2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,9 +38,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject threadDeath = NULL; -static jthread threadForStop = NULL; -static jthread threadForInterrupt = NULL; +static jobject threadDeath = nullptr; +static jthread threadForStop = nullptr; +static jthread threadForInterrupt = nullptr; /* ========================================================================== */ @@ -51,10 +51,10 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; - jclass cls = NULL; - jmethodID ctor = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; int i; NSK_DISPLAY0("Prepare: find tested thread\n"); @@ -63,12 +63,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -78,7 +78,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL) { + if (info.name != nullptr) { if (strcmp(info.name, STOP_THREAD_NAME) == 0) { threadForStop = threads[i]; } else if (strcmp(info.name, INTERRUPT_THREAD_NAME) == 0) { @@ -91,26 +91,26 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (threadForStop == NULL) { + if (threadForStop == nullptr) { NSK_COMPLAIN0("DebuggeeThreadForStop not found"); return NSK_FALSE; } - if (threadForInterrupt == NULL) { + if (threadForInterrupt == nullptr) { NSK_COMPLAIN0("DebuggeeThreadForInterrupt not found"); return NSK_FALSE; } NSK_DISPLAY0("Prepare: create new instance of ThreadDeath exception\n"); - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (threadDeath = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadDeath = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -131,7 +131,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #1: call StopThread\n"); - if (!NSK_VERIFY(threadForStop != NULL)) { + if (!NSK_VERIFY(threadForStop != nullptr)) { nsk_jvmti_setFailStatus(); } else { if (!NSK_JVMTI_VERIFY(jvmti->StopThread(threadForStop, threadDeath))) @@ -139,7 +139,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #2: call InterruptThread\n"); - if (!NSK_VERIFY(threadForInterrupt != NULL)) { + if (!NSK_VERIFY(threadForInterrupt != nullptr)) { nsk_jvmti_setFailStatus(); } else { if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(threadForInterrupt))) @@ -171,7 +171,7 @@ JNIEXPORT jint JNI_OnLoad_ma08t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -183,10 +183,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001a.cpp index 2253e5a088d..c77b118941a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,8 +38,8 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread threadForStop = NULL; -static jthread threadForInterrupt = NULL; +static jthread threadForStop = nullptr; +static jthread threadForInterrupt = nullptr; static int ThreadDeathFlag = 0; static int InterruptedExceptionFlag = 0; @@ -53,20 +53,20 @@ static void JNICALL Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jobject exception, jmethodID catch_method, jlocation catch_location) { - jclass klass = NULL; - char *signature = NULL; + jclass klass = nullptr; + char *signature = nullptr; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(signature != NULL)) { + if (!NSK_VERIFY(signature != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -100,7 +100,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* STOP_THREAD_NAME = "DebuggeeThreadForStop"; const char* INTERRUPT_THREAD_NAME = "DebuggeeThreadForInterrupt"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -110,12 +110,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -125,7 +125,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL) { + if (info.name != nullptr) { if (strcmp(info.name, STOP_THREAD_NAME) == 0) { threadForStop = threads[i]; } else if (strcmp(info.name, INTERRUPT_THREAD_NAME) == 0) { @@ -138,24 +138,24 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (threadForStop == NULL) { + if (threadForStop == nullptr) { NSK_COMPLAIN0("DebuggeeThreadForStop not found"); return NSK_FALSE; } - if (threadForInterrupt == NULL) { + if (threadForInterrupt == nullptr) { NSK_COMPLAIN0("DebuggeeThreadForInterrupt not found"); return NSK_FALSE; } - if (!NSK_JNI_VERIFY(jni, (threadForStop = jni->NewGlobalRef(threadForStop)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadForStop = jni->NewGlobalRef(threadForStop)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (threadForInterrupt = jni->NewGlobalRef(threadForInterrupt)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadForInterrupt = jni->NewGlobalRef(threadForInterrupt)) != nullptr)) return NSK_FALSE; /* enable event */ - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, nullptr))) return NSK_FALSE; return NSK_TRUE; @@ -191,7 +191,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); /* disable event */ - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION, nullptr))) nsk_jvmti_setFailStatus(); NSK_TRACE(jni->DeleteGlobalRef(threadForStop)); @@ -216,7 +216,7 @@ JNIEXPORT jint JNI_OnLoad_ma08t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -228,10 +228,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001.cpp index 330b7b713a6..5c45e75a167 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,10 +48,10 @@ static const char *testThreadName = "Debuggee Thread"; void releaseThreadInfo(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jvmtiThreadInfo *info) { jvmti_env->Deallocate((unsigned char *)info->name); - if (info->thread_group != NULL) { + if (info->thread_group != nullptr) { jni_env->DeleteLocalRef(info->thread_group); } - if (info->context_class_loader != NULL) { + if (info->context_class_loader != nullptr) { jni_env->DeleteLocalRef(info->context_class_loader); } } @@ -80,8 +80,8 @@ static void JNICALL Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jobject exception, jmethodID catch_method, jlocation catch_location) { - jclass klass = NULL; - char *signature = NULL; + jclass klass = nullptr; + char *signature = nullptr; if (!isTestThread("Exception", jvmti_env, jni_env, thread)) { return; @@ -89,24 +89,24 @@ Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, ExceptionEventsCount++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1("Exception event: %s\n", signature); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } void JNICALL ExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jobject exception) { - jclass klass = NULL; - char *signature = NULL; + jclass klass = nullptr; + char *signature = nullptr; if (!isTestThread("ExceptionCatch", jvmti_env, jni_env, thread)) { return; @@ -114,16 +114,16 @@ ExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, ExceptionCatchEventsCount++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1("ExceptionCatch event: %s\n", signature); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -136,9 +136,9 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (!nsk_jvmti_waitForSync(timeout)) return; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, nullptr))) nsk_jvmti_setFailStatus(); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr))) nsk_jvmti_setFailStatus(); /* resume debugee and wait for sync */ @@ -147,9 +147,9 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (!nsk_jvmti_waitForSync(timeout)) return; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION, nullptr))) nsk_jvmti_setFailStatus(); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr))) nsk_jvmti_setFailStatus(); NSK_DISPLAY1("Exception events received: %d\n", @@ -181,7 +181,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -193,10 +193,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001a.cpp index 29863b2c2c1..8ce327c18a0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,42 +49,42 @@ static void JNICALL Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jobject exception, jmethodID catch_method, jlocation catch_location) { - jclass klass = NULL; - char *signature = NULL; + jclass klass = nullptr; + char *signature = nullptr; ExceptionEventsCount++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1("Exception event: %s\n", signature); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } void JNICALL ExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jobject exception) { - jclass klass = NULL; - char *signature = NULL; + jclass klass = nullptr; + char *signature = nullptr; ExceptionCatchEventsCount++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1("ExceptionCatch event: %s\n", signature); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -132,7 +132,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -144,10 +144,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002.cpp index c9b34e0eb49..3e9e15d92f1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; +static jthread thread = nullptr; /* event counts */ static int MethodEntryEventsCount = 0; @@ -50,18 +50,18 @@ static int MethodEntryEventsCount = 0; static void JNICALL MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; MethodEntryEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("MethodEntry event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -70,7 +70,7 @@ MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -80,12 +80,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -95,12 +95,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* deallocate threads list */ @@ -159,7 +159,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t002(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -171,10 +171,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002a.cpp index e8256ff6dc1..9bf090dbbc4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,18 +47,18 @@ static int MethodEntryEventsCount = 0; static void JNICALL MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; MethodEntryEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("MethodEntry event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -101,7 +101,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t002a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -113,10 +113,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003.cpp index 2b75f45a6ae..78857457350 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; +static jthread thread = nullptr; /* event counts */ static int MethodExitEventsCount = 0; @@ -51,18 +51,18 @@ static void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jboolean was_poped_by_exception, jvalue return_value) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; MethodExitEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("MethodExit event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -71,7 +71,7 @@ MethodExit(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -81,12 +81,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -96,12 +96,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* deallocate threads list */ @@ -160,7 +160,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t003(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -172,10 +172,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003a.cpp index 98a8f8287fb..356d71c7202 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,18 +48,18 @@ static void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jboolean was_poped_by_exception, jvalue return_value) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; MethodExitEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("MethodExit event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -102,7 +102,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t003a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -114,10 +114,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004.cpp index 329da7c919c..578d167a15c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; +static jthread thread = nullptr; /* event counts */ static int SingleStepEventsCount = 0; @@ -50,23 +50,23 @@ static int SingleStepEventsCount = 0; static void JNICALL SingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, jmethodID method, jlocation location) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; char buffer[32]; SingleStepEventsCount++; - NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL)); + NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, nullptr)); - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY3("SingleStep event: %s%s, location=%s\n", name, signature, jlong_to_string(location, buffer)); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -75,7 +75,7 @@ SingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -85,12 +85,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -100,12 +100,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* deallocate threads list */ @@ -164,7 +164,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t004(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -176,10 +176,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004a.cpp index 4f97e7c7926..15819c71e54 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,23 +47,23 @@ static int SingleStepEventsCount = 0; static void JNICALL SingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, jmethodID method, jlocation location) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; char buffer[32]; SingleStepEventsCount++; - NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL)); + NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, nullptr)); - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY3("SingleStep event: %s%s, location=%s\n", name, signature, jlong_to_string(location, buffer)); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -106,7 +106,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t004a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -118,10 +118,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005.cpp index 2f49fe219f4..c736ec86063 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,12 +52,12 @@ VMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, VMObjectAllocEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("VMObjectAlloc: \"%s\", size=%d\n", signature, size); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -94,7 +94,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t005(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -106,10 +106,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -123,7 +123,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005a.cpp index 418f082f280..592f9d6af07 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,12 +52,12 @@ VMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, VMObjectAllocEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("VMObjectAlloc: \"%s\", size=%d\n", signature, size); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -94,7 +94,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t005a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -106,10 +106,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp index ac2d54a16ab..886675712c0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,34 +49,34 @@ static void JNICALL CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, const void* code_addr, jint map_length, const jvmtiAddrLocationMap* map, const void* compile_info) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; CompiledMethodLoadEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY3("CompiledMethodLoad event: %s%s (0x%p)\n", name, signature, code_addr); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } static void JNICALL CompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method, const void* code_addr) { - char *name = NULL; - char *sig = NULL; + char *name = nullptr; + char *sig = nullptr; jvmtiError err; CompiledMethodUnloadEventsCount++; NSK_DISPLAY0("CompiledMethodUnload event received\n"); // Check for the case that the class has been unloaded - err = jvmti_env->GetMethodName(method, &name, &sig, NULL); + err = jvmti_env->GetMethodName(method, &name, &sig, nullptr); if (err == JVMTI_ERROR_NONE) { NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n", name, sig, code_addr); @@ -127,7 +127,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t006(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -139,10 +139,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -157,9 +157,9 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006a.cpp index 2ddf7ec6d9c..96993ef79cc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,35 +49,35 @@ static void JNICALL CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, const void* code_addr, jint map_length, const jvmtiAddrLocationMap* map, const void* compile_info) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; CompiledMethodLoadEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY3("CompiledMethodLoad event: %s%s (0x%p)\n", name, signature, code_addr); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } static void JNICALL CompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method, const void* code_addr) { - char *name = NULL; - char *sig = NULL; + char *name = nullptr; + char *sig = nullptr; jvmtiError err; CompiledMethodUnloadEventsCount++; NSK_DISPLAY0("CompiledMethodUnload event received\n"); // Check for the case that the class has been unloaded - err = jvmti_env->GetMethodName(method, &name, &sig, NULL); + err = jvmti_env->GetMethodName(method, &name, &sig, nullptr); if (err == JVMTI_ERROR_NONE) { NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n", name, sig, code_addr); @@ -124,7 +124,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t006a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -136,10 +136,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007.cpp index cee84708ed6..4f94aa4c430 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,7 +95,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t007(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -107,10 +107,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -125,9 +125,9 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007a.cpp index e86e00fbc23..ebd5a6569d9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,7 +95,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t007a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -107,10 +107,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008.cpp index 449f94e64b0..ebf76643958 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -165,7 +165,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t008(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -177,10 +177,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -198,13 +198,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* enable events */ - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008a.cpp index 9d4c0d81c07..9638dfdd48b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -165,7 +165,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t008a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -177,10 +177,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp index f0f3bc4a0a3..d3779929295 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,8 +39,8 @@ extern "C" { #define THREADS_FIELD_SIG "[L" THREAD_CLASS_NAME ";" /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads */ @@ -114,24 +114,24 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jclass debugeeClass = NULL; - jfieldID threadsFieldID = NULL; - jobjectArray threadsArray = NULL; + jclass debugeeClass = nullptr; + jfieldID threadsFieldID = nullptr; + jobjectArray threadsArray = nullptr; jsize threadsArrayLength = 0; jsize i; /* find debugee class */ - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; /* find static field with threads array */ if (!NSK_JNI_VERIFY(jni, (threadsFieldID = - jni->GetStaticFieldID(debugeeClass, THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != NULL)) + jni->GetStaticFieldID(debugeeClass, THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != nullptr)) return NSK_FALSE; /* get threads array from static field */ if (!NSK_JNI_VERIFY(jni, (threadsArray = (jobjectArray) - jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != NULL)) + jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != nullptr)) return NSK_FALSE; /* check array length */ @@ -142,14 +142,14 @@ static int prepare() { /* get each thread from array */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread) - jni->GetObjectArrayElement(threadsArray, i)) != NULL)) + jni->GetObjectArrayElement(threadsArray, i)) != nullptr)) return NSK_FALSE; } /* make global references to threads */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread) - jni->NewGlobalRef(threadsList[i])) != NULL)) + jni->NewGlobalRef(threadsList[i])) != nullptr)) return NSK_FALSE; } @@ -260,11 +260,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t002/sp01t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t002/sp01t002.cpp index 99b3dcc7a38..4fe02129060 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t002/sp01t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t002/sp01t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads */ @@ -142,7 +142,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int found = 0; int i; @@ -151,21 +151,21 @@ static int prepare() { /* clean threads list */ for (i = 0; i < THREADS_COUNT; i++) { - threadsList[i] = NULL; + threadsList[i] = nullptr; } /* get all live threads */ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -173,7 +173,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { int j; for (j = 0; j < THREADS_COUNT; j++) { @@ -193,7 +193,7 @@ static int prepare() { /* check if all tested threads found */ found = 0; for (i = 0; i < THREADS_COUNT; i++) { - if (threadsList[i] == NULL) { + if (threadsList[i] == nullptr) { NSK_COMPLAIN2("Not found tested thread #%d (%s)\n", i, threadsName[i]); } else { found++; @@ -205,7 +205,7 @@ static int prepare() { /* make global refs */ for (i = 0; i < THREADS_COUNT; i++) { - if (!NSK_JNI_VERIFY(jni, (threadsList[i] = jni->NewGlobalRef(threadsList[i])) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadsList[i] = jni->NewGlobalRef(threadsList[i])) != nullptr)) return NSK_FALSE; } @@ -434,7 +434,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -447,7 +447,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t003/sp01t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t003/sp01t003.cpp index 814b4bf3a1e..504f965adca 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t003/sp01t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t003/sp01t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads */ @@ -142,7 +142,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int found = 0; int i; @@ -151,21 +151,21 @@ static int prepare() { /* clean threads list */ for (i = 0; i < THREADS_COUNT; i++) { - threadsList[i] = NULL; + threadsList[i] = nullptr; } /* get all live threads */ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -173,7 +173,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { int j; for (j = 0; j < THREADS_COUNT; j++) { @@ -193,7 +193,7 @@ static int prepare() { /* check if all tested threads found */ found = 0; for (i = 0; i < THREADS_COUNT; i++) { - if (threadsList[i] == NULL) { + if (threadsList[i] == nullptr) { NSK_COMPLAIN2("Not found tested thread #%d (%s)\n", i, threadsName[i]); } else { found++; @@ -205,7 +205,7 @@ static int prepare() { /* make global refs */ for (i = 0; i < THREADS_COUNT; i++) { - if (!NSK_JNI_VERIFY(jni, (threadsList[i] = jni->NewGlobalRef(threadsList[i])) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadsList[i] = jni->NewGlobalRef(threadsList[i])) != nullptr)) return NSK_FALSE; } @@ -445,7 +445,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -458,7 +458,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t001/sp02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t001/sp02t001.cpp index 491d7f04928..9dc696c7d88 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t001/sp02t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t001/sp02t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constants */ @@ -50,12 +50,12 @@ typedef struct { /* descriptions of tested threads */ static ThreadDesc threadsDesc[THREADS_COUNT] = { - { "threadRunning", 2, NULL }, - { "threadEntering", 2, NULL }, - { "threadWaiting", 2, NULL }, - { "threadSleeping", 2, NULL }, - { "threadRunningInterrupted", 2, NULL }, - { "threadRunningNative", 2, NULL } + { "threadRunning", 2, nullptr }, + { "threadEntering", 2, nullptr }, + { "threadWaiting", 2, nullptr }, + { "threadSleeping", 2, nullptr }, + { "threadRunningInterrupted", 2, nullptr }, + { "threadRunningNative", 2, nullptr } }; /* ============================================================================= */ @@ -123,7 +123,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int found = 0; int i; @@ -132,21 +132,21 @@ static int prepare() { /* clean threads list */ for (i = 0; i < THREADS_COUNT; i++) { - threadsDesc[i].thread = (jthread)NULL; + threadsDesc[i].thread = (jthread)nullptr; } /* get all live threads */ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -154,7 +154,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { int j; for (j = 0; j < THREADS_COUNT; j++) { @@ -174,7 +174,7 @@ static int prepare() { /* check if all tested threads found */ found = 0; for (i = 0; i < THREADS_COUNT; i++) { - if (threadsDesc[i].thread == NULL) { + if (threadsDesc[i].thread == nullptr) { NSK_COMPLAIN2("Not found tested thread #%d (%s)\n", i, threadsDesc[i].threadName); } else { found++; @@ -187,7 +187,7 @@ static int prepare() { /* make global refs */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread) - jni->NewGlobalRef(threadsDesc[i].thread)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; } @@ -356,7 +356,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -369,7 +369,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t002/sp02t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t002/sp02t002.cpp index 00aa34f3fdb..eadc3fa3cc6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t002/sp02t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t002/sp02t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constants */ @@ -54,12 +54,12 @@ typedef struct { /* descriptions of tested threads */ static ThreadDesc threadsDesc[THREADS_COUNT] = { - { "threadRunning", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadEntering", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadWaiting", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadSleeping", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadRunningInterrupted", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadRunningNative", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION } + { "threadRunning", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadEntering", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadWaiting", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadSleeping", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadRunningInterrupted", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadRunningNative", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION } }; /* indexes of known threads */ @@ -143,7 +143,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int found = 0; int i; @@ -152,8 +152,8 @@ static int prepare() { /* clean threads list */ for (i = 0; i < THREADS_COUNT; i++) { - threadsDesc[i].thread = (jthread)NULL; - threadsDesc[i].method = (jmethodID)NULL; + threadsDesc[i].thread = (jthread)nullptr; + threadsDesc[i].method = (jmethodID)nullptr; threadsDesc[i].location = NSK_JVMTI_INVALID_JLOCATION; } @@ -161,14 +161,14 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -176,7 +176,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { int j; for (j = 0; j < THREADS_COUNT; j++) { @@ -196,7 +196,7 @@ static int prepare() { /* check if all tested threads found */ found = 0; for (i = 0; i < THREADS_COUNT; i++) { - if (threadsDesc[i].thread == NULL) { + if (threadsDesc[i].thread == nullptr) { NSK_COMPLAIN2("Not found tested thread #%d (%s)\n", i, threadsDesc[i].threadName); } else { found++; @@ -211,11 +211,11 @@ static int prepare() { for (i = 0; i < THREADS_COUNT; i++) { /* get thread class */ if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = - jni->GetObjectClass(threadsDesc[i].thread)) != NULL)) + jni->GetObjectClass(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; /* get frame method */ if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method = - jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL)) + jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != nullptr)) return NSK_FALSE; NSK_DISPLAY4(" thread #%d (%s): %p (%s)\n", @@ -227,10 +227,10 @@ static int prepare() { /* make global refs */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread) - jni->NewGlobalRef(threadsDesc[i].thread)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass) - jni->NewGlobalRef(threadsDesc[i].cls)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].cls)) != nullptr)) return NSK_FALSE; } @@ -313,8 +313,8 @@ static int checkThreads(int suspended, const char* kind) { j, (void*)frameStack[j].method, (long)frameStack[j].location); /* check frame method */ - if (frameStack[j].method == NULL) { - NSK_COMPLAIN3("NULL methodID in stack for %s thread #%d (%s)\n", + if (frameStack[j].method == nullptr) { + NSK_COMPLAIN3("null methodID in stack for %s thread #%d (%s)\n", kind, i, threadsDesc[i].threadName); nsk_jvmti_setFailStatus(); } else if (frameStack[j].method == threadsDesc[i].method) { @@ -419,7 +419,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -432,7 +432,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp index 20c758aed6c..0916f392a8b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constants */ @@ -54,12 +54,12 @@ typedef struct { /* descriptions of tested threads */ static ThreadDesc threadsDesc[THREADS_COUNT] = { - { "threadRunning", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadEntering", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadWaiting", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadSleeping", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadRunningInterrupted", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadRunningNative", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION } + { "threadRunning", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadEntering", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadWaiting", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadSleeping", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadRunningInterrupted", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadRunningNative", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION } }; /* indexes of known threads */ @@ -144,7 +144,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int found = 0; int i; @@ -153,8 +153,8 @@ static int prepare() { /* clean threads list */ for (i = 0; i < THREADS_COUNT; i++) { - threadsDesc[i].thread = (jthread)NULL; - threadsDesc[i].method = (jmethodID)NULL; + threadsDesc[i].thread = (jthread)nullptr; + threadsDesc[i].method = (jmethodID)nullptr; threadsDesc[i].location = NSK_JVMTI_INVALID_JLOCATION; } @@ -162,14 +162,14 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -177,7 +177,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { int j; for (j = 0; j < THREADS_COUNT; j++) { @@ -197,7 +197,7 @@ static int prepare() { /* check if all tested threads found */ found = 0; for (i = 0; i < THREADS_COUNT; i++) { - if (threadsDesc[i].thread == NULL) { + if (threadsDesc[i].thread == nullptr) { NSK_COMPLAIN2("Not found tested thread #%d (%s)\n", i, threadsDesc[i].threadName); } else { found++; @@ -212,11 +212,11 @@ static int prepare() { for (i = 0; i < THREADS_COUNT; i++) { /* get thread class */ if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = - jni->GetObjectClass(threadsDesc[i].thread)) != NULL)) + jni->GetObjectClass(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; /* get frame method */ if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method = - jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL)) + jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != nullptr)) return NSK_FALSE; NSK_DISPLAY4(" thread #%d (%s): %p (%s)\n", @@ -228,10 +228,10 @@ static int prepare() { /* make global refs */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread) - jni->NewGlobalRef(threadsDesc[i].thread)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass) - jni->NewGlobalRef(threadsDesc[i].cls)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].cls)) != nullptr)) return NSK_FALSE; } @@ -297,7 +297,7 @@ static int checkThreads(int suspended, const char* kind) { found = 0; for (j = 0; j < frameStackSize; j++) { - jmethodID qMethod = (jmethodID)NULL; + jmethodID qMethod = (jmethodID)nullptr; jlocation qLocation = NSK_JVMTI_INVALID_JLOCATION; NSK_DISPLAY3(" %d frame: method: %p, location: %ld\n", @@ -432,7 +432,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ { @@ -444,7 +444,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t001/sp03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t001/sp03t001.cpp index b0560a13a1f..8ce99cf73a1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t001/sp03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t001/sp03t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads */ @@ -146,7 +146,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int notfound = 0; int i, j; @@ -156,14 +156,14 @@ static int prepare() { /* allocate and clean threads list */ for (i = 0; i < THREADS_KINDS; i++) { threadsCounts[i] = 0; - threadsList[i] = NULL; + threadsList[i] = nullptr; if (!NSK_JVMTI_VERIFY(jvmti->Allocate(threadsCount * sizeof(jthread), (unsigned char**)&threadsList[i]))) return NSK_FALSE; for (j = 0; j < threadsCount; j++) { - threadsList[i][j] = NULL; + threadsList[i][j] = nullptr; } } @@ -171,14 +171,14 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -186,7 +186,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { for (j = 0; j < THREADS_KINDS; j++) { if (strcmp(threadInfo.name, threadsName[j]) == 0) { int k = threadsCounts[j]; @@ -222,7 +222,7 @@ static int prepare() { for (i = 0; i < THREADS_KINDS; i++) { for (j = 0; j < threadsCount; j++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i][j] = - jni->NewGlobalRef(threadsList[i][j])) != NULL)) + jni->NewGlobalRef(threadsList[i][j])) != nullptr)) return NSK_FALSE; } } @@ -235,7 +235,7 @@ static int prepare() { */ static int suspendThreadsList(int suspend) { jlong resultsSize = threadsCount * sizeof(jvmtiError); - jvmtiError* results = NULL; + jvmtiError* results = nullptr; const char* kind = (suspend ? "suspending" : "resuming"); int i, j; @@ -368,7 +368,7 @@ static int clean() { for (i = 0; i < THREADS_KINDS; i++) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadsList[i]))) return NSK_FALSE; - threadsList[i] = NULL; + threadsList[i] = nullptr; } return NSK_TRUE; @@ -443,7 +443,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -456,7 +456,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t002/sp03t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t002/sp03t002.cpp index 986d1113fc6..3001cb25902 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t002/sp03t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t002/sp03t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads */ @@ -149,7 +149,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int notfound = 0; int i, j; @@ -159,14 +159,14 @@ static int prepare() { /* allocate and clean threads list */ for (i = 0; i < THREADS_KINDS; i++) { threadsCounts[i] = 0; - threadsList[i] = NULL; + threadsList[i] = nullptr; if (!NSK_JVMTI_VERIFY(jvmti->Allocate(threadsCount * sizeof(jthread), (unsigned char**)&threadsList[i]))) return NSK_FALSE; for (j = 0; j < threadsCount; j++) { - threadsList[i][j] = NULL; + threadsList[i][j] = nullptr; } } @@ -174,14 +174,14 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -189,7 +189,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { for (j = 0; j < THREADS_KINDS; j++) { if (strcmp(threadInfo.name, threadsName[j]) == 0) { int k = threadsCounts[j]; @@ -225,7 +225,7 @@ static int prepare() { for (i = 0; i < THREADS_KINDS; i++) { for (j = 0; j < threadsCount; j++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i][j] = - jni->NewGlobalRef(threadsList[i][j])) != NULL)) + jni->NewGlobalRef(threadsList[i][j])) != nullptr)) return NSK_FALSE; } } @@ -238,7 +238,7 @@ static int prepare() { */ static int suspendThreadsList(int suspend) { jlong resultsSize = threadsCount * sizeof(jvmtiError); - jvmtiError* results = NULL; + jvmtiError* results = nullptr; const char* kind = (suspend ? "suspending" : "resuming"); int i, j; @@ -371,7 +371,7 @@ static int clean() { for (i = 0; i < THREADS_KINDS; i++) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadsList[i]))) return NSK_FALSE; - threadsList[i] = NULL; + threadsList[i] = nullptr; } return NSK_TRUE; @@ -446,7 +446,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -459,7 +459,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp index 45657600f9e..f05ae7e81f8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads */ @@ -146,7 +146,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int notfound = 0; int i, j; @@ -156,14 +156,14 @@ static int prepare() { /* allocate and clean threads list */ for (i = 0; i < THREADS_KINDS; i++) { threadsCounts[i] = 0; - threadsList[i] = NULL; + threadsList[i] = nullptr; if (!NSK_JVMTI_VERIFY(jvmti->Allocate(threadsCount * sizeof(jthread), (unsigned char**)&threadsList[i]))) return NSK_FALSE; for (j = 0; j < threadsCount; j++) { - threadsList[i][j] = NULL; + threadsList[i][j] = nullptr; } } @@ -171,14 +171,14 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -186,7 +186,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { for (j = 0; j < THREADS_KINDS; j++) { if (strcmp(threadInfo.name, threadsName[j]) == 0) { int k = threadsCounts[j]; @@ -222,7 +222,7 @@ static int prepare() { for (i = 0; i < THREADS_KINDS; i++) { for (j = 0; j < threadsCount; j++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i][j] = - jni->NewGlobalRef(threadsList[i][j])) != NULL)) + jni->NewGlobalRef(threadsList[i][j])) != nullptr)) return NSK_FALSE; } } @@ -235,7 +235,7 @@ static int prepare() { */ static int suspendThreadsList(int suspend) { jlong resultsSize = threadsCount * sizeof(jvmtiError); - jvmtiError* results = NULL; + jvmtiError* results = nullptr; const char* kind = (suspend ? "suspending" : "resuming"); int i, j; @@ -368,7 +368,7 @@ static int clean() { for (i = 0; i < THREADS_KINDS; i++) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadsList[i]))) return NSK_FALSE; - threadsList[i] = NULL; + threadsList[i] = nullptr; } return NSK_TRUE; @@ -443,7 +443,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -456,7 +456,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t002/sp04t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t002/sp04t002.cpp index 5122bd4fe55..dcd2cdfb176 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t002/sp04t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t002/sp04t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads */ @@ -146,7 +146,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int notfound = 0; int i, j; @@ -156,14 +156,14 @@ static int prepare() { /* allocate and clean threads list */ for (i = 0; i < THREADS_KINDS; i++) { threadsCounts[i] = 0; - threadsList[i] = NULL; + threadsList[i] = nullptr; if (!NSK_JVMTI_VERIFY(jvmti->Allocate(threadsCount * sizeof(jthread), (unsigned char**)&threadsList[i]))) return NSK_FALSE; for (j = 0; j < threadsCount; j++) { - threadsList[i][j] = NULL; + threadsList[i][j] = nullptr; } } @@ -171,14 +171,14 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -186,7 +186,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { for (j = 0; j < THREADS_KINDS; j++) { if (strcmp(threadInfo.name, threadsName[j]) == 0) { int k = threadsCounts[j]; @@ -222,7 +222,7 @@ static int prepare() { for (i = 0; i < THREADS_KINDS; i++) { for (j = 0; j < threadsCount; j++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i][j] = - jni->NewGlobalRef(threadsList[i][j])) != NULL)) + jni->NewGlobalRef(threadsList[i][j])) != nullptr)) return NSK_FALSE; } } @@ -235,7 +235,7 @@ static int prepare() { */ static int suspendThreadsList(int suspend) { jlong resultsSize = threadsCount * sizeof(jvmtiError); - jvmtiError* results = NULL; + jvmtiError* results = nullptr; const char* kind = (suspend ? "suspending" : "resuming"); int i, j; @@ -368,7 +368,7 @@ static int clean() { for (i = 0; i < THREADS_KINDS; i++) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadsList[i]))) return NSK_FALSE; - threadsList[i] = NULL; + threadsList[i] = nullptr; } return NSK_TRUE; @@ -443,7 +443,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -456,7 +456,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp index 04a3b498e3f..94dfb9ead45 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,8 +38,8 @@ extern "C" { #define THREADS_FIELD_SIG "[L" THREAD_CLASS_NAME ";" /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads and events */ @@ -143,7 +143,7 @@ static int enableEvents(jvmtiEventMode enable) { int i; for (i = 0; i < EVENTS_COUNT; i++) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, eventsList[i], NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, eventsList[i], nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -159,24 +159,24 @@ static int enableEvents(jvmtiEventMode enable) { * - enable events */ static int prepare() { - jclass debugeeClass = NULL; - jfieldID threadsFieldID = NULL; - jobjectArray threadsArray = NULL; + jclass debugeeClass = nullptr; + jfieldID threadsFieldID = nullptr; + jobjectArray threadsArray = nullptr; jsize threadsArrayLength = 0; jsize i; /* find debugee class */ - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; /* find static field with threads array */ if (!NSK_JNI_VERIFY(jni, (threadsFieldID = - jni->GetStaticFieldID(debugeeClass, THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != NULL)) + jni->GetStaticFieldID(debugeeClass, THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != nullptr)) return NSK_FALSE; /* get threads array from static field */ if (!NSK_JNI_VERIFY(jni, (threadsArray = (jobjectArray) - jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != NULL)) + jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != nullptr)) return NSK_FALSE; /* check array length */ @@ -187,14 +187,14 @@ static int prepare() { /* get each thread from array */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread) - jni->GetObjectArrayElement(threadsArray, i)) != NULL)) + jni->GetObjectArrayElement(threadsArray, i)) != nullptr)) return NSK_FALSE; } /* make global references to threads */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread) - jni->NewGlobalRef(threadsList[i])) != NULL)) + jni->NewGlobalRef(threadsList[i])) != nullptr)) return NSK_FALSE; } @@ -279,8 +279,8 @@ JNIEXPORT void JNICALL callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { int i; - /* check if thread is not NULL */ - if (!NSK_VERIFY(thread != NULL)) { + /* check if thread is not nullptr */ + if (!NSK_VERIFY(thread != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -306,8 +306,8 @@ JNIEXPORT void JNICALL callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { int i; - /* check if thread is not NULL */ - if (!NSK_VERIFY(thread != NULL)) { + /* check if thread is not nullptr */ + if (!NSK_VERIFY(thread != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -388,7 +388,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* set events callbacks */ @@ -402,7 +402,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp index 455f88db20c..392ff86cb21 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,8 +41,8 @@ extern "C" { #define TIMEOUT_DELTA 1000 /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads and events */ @@ -100,7 +100,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { { eventsStart = 0; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -121,7 +121,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { } if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, nullptr))) { nsk_jvmti_setFailStatus(); } @@ -150,7 +150,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { { eventsEnd = 0; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -171,7 +171,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { } if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, nullptr))) { nsk_jvmti_setFailStatus(); } @@ -231,24 +231,24 @@ static int resumeThreads(const char* kind) { * - make global refs */ static int prepare() { - jclass debugeeClass = NULL; - jfieldID threadsFieldID = NULL; - jobjectArray threadsArray = NULL; + jclass debugeeClass = nullptr; + jfieldID threadsFieldID = nullptr; + jobjectArray threadsArray = nullptr; jsize threadsArrayLength = 0; jsize i; /* find debugee class */ - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; /* find static field with threads array */ if (!NSK_JNI_VERIFY(jni, (threadsFieldID = - jni->GetStaticFieldID(debugeeClass, THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != NULL)) + jni->GetStaticFieldID(debugeeClass, THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != nullptr)) return NSK_FALSE; /* get threads array from static field */ if (!NSK_JNI_VERIFY(jni, (threadsArray = (jobjectArray) - jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != NULL)) + jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != nullptr)) return NSK_FALSE; /* check array length */ @@ -259,14 +259,14 @@ static int prepare() { /* get each thread from array */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread) - jni->GetObjectArrayElement(threadsArray, i)) != NULL)) + jni->GetObjectArrayElement(threadsArray, i)) != nullptr)) return NSK_FALSE; } /* make global references to threads */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread) - jni->NewGlobalRef(threadsList[i])) != NULL)) + jni->NewGlobalRef(threadsList[i])) != nullptr)) return NSK_FALSE; } @@ -362,8 +362,8 @@ JNIEXPORT void JNICALL callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { int i; - /* check if thread is not NULL */ - if (!NSK_VERIFY(thread != NULL)) { + /* check if thread is not nullptr */ + if (!NSK_VERIFY(thread != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -397,8 +397,8 @@ JNIEXPORT void JNICALL callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { int i; - /* check if thread is not NULL */ - if (!NSK_VERIFY(thread != NULL)) { + /* check if thread is not nullptr */ + if (!NSK_VERIFY(thread != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -487,7 +487,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities for suspending thread */ @@ -510,7 +510,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp index 4f46a0fd08e..cde5a717c8c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constants */ @@ -62,12 +62,12 @@ typedef struct { /* descriptions of tested threads */ static ThreadDesc threadsDesc[THREADS_COUNT] = { - { "threadRunning", "testedMethod", "(ZI)V", 2, NULL, NULL, NULL, NSK_FALSE }, - { "threadEntering", "testedMethod", "(ZI)V", 2, NULL, NULL, NULL, NSK_FALSE }, - { "threadWaiting", "testedMethod", "(ZI)V", 2, NULL, NULL, NULL, NSK_FALSE }, - { "threadSleeping", "testedMethod", "(ZI)V", 2, NULL, NULL, NULL, NSK_FALSE }, - { "threadRunningInterrupted", "testedMethod", "(ZI)V", 2, NULL, NULL, NULL, NSK_FALSE }, - { "threadRunningNative", "testedMethod", "(ZI)V", 2, NULL, NULL, NULL, NSK_FALSE } + { "threadRunning", "testedMethod", "(ZI)V", 2, nullptr, nullptr, nullptr, NSK_FALSE }, + { "threadEntering", "testedMethod", "(ZI)V", 2, nullptr, nullptr, nullptr, NSK_FALSE }, + { "threadWaiting", "testedMethod", "(ZI)V", 2, nullptr, nullptr, nullptr, NSK_FALSE }, + { "threadSleeping", "testedMethod", "(ZI)V", 2, nullptr, nullptr, nullptr, NSK_FALSE }, + { "threadRunningInterrupted", "testedMethod", "(ZI)V", 2, nullptr, nullptr, nullptr, NSK_FALSE }, + { "threadRunningNative", "testedMethod", "(ZI)V", 2, nullptr, nullptr, nullptr, NSK_FALSE } }; /* indexes of known threads */ @@ -152,7 +152,7 @@ static int generateEvents() { * - enable events */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int found = 0; int i; @@ -161,8 +161,8 @@ static int prepare() { /* clean threads list */ for (i = 0; i < THREADS_COUNT; i++) { - threadsDesc[i].thread = (jthread)NULL; - threadsDesc[i].method = (jmethodID)NULL; + threadsDesc[i].thread = (jthread)nullptr; + threadsDesc[i].method = (jmethodID)nullptr; threadsDesc[i].methodCompiled = NSK_FALSE; } @@ -170,20 +170,20 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo))) return NSK_FALSE; - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { int j; for (j = 0; j < THREADS_COUNT; j++) { @@ -203,7 +203,7 @@ static int prepare() { /* check if all tested threads found */ found = 0; for (i = 0; i < THREADS_COUNT; i++) { - if (threadsDesc[i].thread == NULL) { + if (threadsDesc[i].thread == nullptr) { NSK_COMPLAIN2("Not found tested thread #%d (%s)\n", i, threadsDesc[i].threadName); } else { found++; @@ -218,11 +218,11 @@ static int prepare() { for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = - jni->GetObjectClass(threadsDesc[i].thread)) != NULL)) + jni->GetObjectClass(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method = - jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL)) + jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != nullptr)) return NSK_FALSE; NSK_DISPLAY4(" thread #%d (%s): 0x%p (%s)\n", @@ -234,15 +234,15 @@ static int prepare() { /* make global refs */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread) - jni->NewGlobalRef(threadsDesc[i].thread)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass) - jni->NewGlobalRef(threadsDesc[i].cls)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].cls)) != nullptr)) return NSK_FALSE; } NSK_DISPLAY0("Enable tested events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -343,7 +343,7 @@ static int clean() { int i; NSK_DISPLAY0("Disable events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; NSK_DISPLAY0("Dispose global references to threads\n"); @@ -474,7 +474,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -495,7 +495,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t002/sp06t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t002/sp06t002.cpp index d8600af0d67..43e55d53988 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t002/sp06t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t002/sp06t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constants */ @@ -62,12 +62,12 @@ typedef struct { /* descriptions of tested threads */ static ThreadDesc threadsDesc[THREADS_COUNT] = { - { "threadRunning", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadEntering", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadWaiting", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadSleeping", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadRunningInterrupted", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadRunningNative", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE } + { "threadRunning", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadEntering", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadWaiting", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadSleeping", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadRunningInterrupted", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadRunningNative", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE } }; /* indexes of known threads */ @@ -160,7 +160,7 @@ static int generateEvents() { * - enable events */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int found = 0; int i; @@ -169,8 +169,8 @@ static int prepare() { /* clean threads list */ for (i = 0; i < THREADS_COUNT; i++) { - threadsDesc[i].thread = (jthread)NULL; - threadsDesc[i].method = (jmethodID)NULL; + threadsDesc[i].thread = (jthread)nullptr; + threadsDesc[i].method = (jmethodID)nullptr; threadsDesc[i].location = NSK_JVMTI_INVALID_JLOCATION; threadsDesc[i].methodCompiled = NSK_FALSE; } @@ -179,20 +179,20 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo))) return NSK_FALSE; - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { int j; for (j = 0; j < THREADS_COUNT; j++) { @@ -212,7 +212,7 @@ static int prepare() { /* check if all tested threads found */ found = 0; for (i = 0; i < THREADS_COUNT; i++) { - if (threadsDesc[i].thread == NULL) { + if (threadsDesc[i].thread == nullptr) { NSK_COMPLAIN2("Not found tested thread #%d (%s)\n", i, threadsDesc[i].threadName); } else { found++; @@ -227,11 +227,11 @@ static int prepare() { for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = - jni->GetObjectClass(threadsDesc[i].thread)) != NULL)) + jni->GetObjectClass(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method = - jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL)) + jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != nullptr)) return NSK_FALSE; NSK_DISPLAY4(" thread #%d (%s): 0x%p (%s)\n", @@ -243,15 +243,15 @@ static int prepare() { /* make global refs */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread) - jni->NewGlobalRef(threadsDesc[i].thread)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass) - jni->NewGlobalRef(threadsDesc[i].cls)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].cls)) != nullptr)) return NSK_FALSE; } NSK_DISPLAY0("Enable tested events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -337,8 +337,8 @@ static int checkThreads(int suspended, const char* kind0) { j, (void*)frameStack[j].method, (long)frameStack[j].location); /* check frame method */ - if (frameStack[j].method == NULL) { - NSK_COMPLAIN3("NULL methodID in stack for %s thread #%d (%s)\n", + if (frameStack[j].method == nullptr) { + NSK_COMPLAIN3("null methodID in stack for %s thread #%d (%s)\n", kind, i, threadsDesc[i].threadName); nsk_jvmti_setFailStatus(); } else if (frameStack[j].method == threadsDesc[i].method) { @@ -372,7 +372,7 @@ static int clean() { int i; NSK_DISPLAY0("Disable events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; NSK_DISPLAY0("Dispose global references to threads\n"); @@ -503,7 +503,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -524,7 +524,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp index 5c06270a977..c396f623610 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constants */ @@ -62,12 +62,12 @@ typedef struct { /* descriptions of tested threads */ static ThreadDesc threadsDesc[THREADS_COUNT] = { - { "threadRunning", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadEntering", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadWaiting", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadSleeping", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadRunningInterrupted", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadRunningNative", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE } + { "threadRunning", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadEntering", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadWaiting", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadSleeping", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadRunningInterrupted", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadRunningNative", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE } }; /* indexes of known threads */ @@ -160,7 +160,7 @@ static int generateEvents() { * - enable events */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int found = 0; int i; @@ -169,8 +169,8 @@ static int prepare() { /* clean threads list */ for (i = 0; i < THREADS_COUNT; i++) { - threadsDesc[i].thread = (jthread)NULL; - threadsDesc[i].method = (jmethodID)NULL; + threadsDesc[i].thread = (jthread)nullptr; + threadsDesc[i].method = (jmethodID)nullptr; threadsDesc[i].location = NSK_JVMTI_INVALID_JLOCATION; threadsDesc[i].methodCompiled = NSK_FALSE; } @@ -179,20 +179,20 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo))) return NSK_FALSE; - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { int j; for (j = 0; j < THREADS_COUNT; j++) { @@ -212,7 +212,7 @@ static int prepare() { /* check if all tested threads found */ found = 0; for (i = 0; i < THREADS_COUNT; i++) { - if (threadsDesc[i].thread == NULL) { + if (threadsDesc[i].thread == nullptr) { NSK_COMPLAIN2("Not found tested thread #%d (%s)\n", i, threadsDesc[i].threadName); } else { found++; @@ -227,11 +227,11 @@ static int prepare() { for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = - jni->GetObjectClass(threadsDesc[i].thread)) != NULL)) + jni->GetObjectClass(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method = - jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL)) + jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != nullptr)) return NSK_FALSE; NSK_DISPLAY4(" thread #%d (%s): 0x%p (%s)\n", @@ -243,15 +243,15 @@ static int prepare() { /* make global refs */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread) - jni->NewGlobalRef(threadsDesc[i].thread)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass) - jni->NewGlobalRef(threadsDesc[i].cls)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].cls)) != nullptr)) return NSK_FALSE; } NSK_DISPLAY0("Enable tested events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -320,7 +320,7 @@ static int checkThreads(int suspended, const char* kind0) { found = 0; for (j = 0; j < frameStackSize; j++) { - jmethodID qMethod = (jmethodID)NULL; + jmethodID qMethod = (jmethodID)nullptr; jlocation qLocation = NSK_JVMTI_INVALID_JLOCATION; NSK_DISPLAY3(" %d frame: method: 0x%p, location: %ld\n", @@ -384,7 +384,7 @@ static int clean() { int i; NSK_DISPLAY0("Disable events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; NSK_DISPLAY0("Dispose global references to threads\n"); @@ -515,7 +515,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -536,7 +536,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t001/sp07t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t001/sp07t001.cpp index 0a9125332e0..eaf871eb405 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t001/sp07t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t001/sp07t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,9 +41,9 @@ static const jlong SAMPLING_INTERVAL = 10; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jrawMonitorID waitLock = NULL; -static jrawMonitorID frameLock = NULL; +static jthread thread = nullptr; +static jrawMonitorID waitLock = nullptr; +static jrawMonitorID frameLock = nullptr; static int sampleCount = 0; static volatile int depth = 0; static jvmtiFrameInfo sampleStack[MAX_DEPTH]; @@ -55,7 +55,7 @@ static jvmtiFrameInfo frameBuffer[MAX_DEPTH]; static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -65,12 +65,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -80,11 +80,11 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } - if (info.name != NULL) { + if (info.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) return NSK_FALSE; } @@ -94,7 +94,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (thread == NULL) { + if (thread == nullptr) { NSK_COMPLAIN0("Debuggee thread not found"); return NSK_FALSE; } @@ -123,27 +123,27 @@ static int wait_for(jvmtiEnv* jvmti, jlong millis) { static int displayFrameInfo(jvmtiEnv* jvmti, jint i) { char buffer[32]; - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; - if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, nullptr))) return NSK_FALSE; NSK_DISPLAY4(" got[%d] method: %s%s, location: %s\n", i, name, signature, jlong_to_string(frameBuffer[frameCount-1-i].location, buffer)); - if (name != NULL) + if (name != nullptr) jvmti->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); - if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(sampleStack[i].method, &name, &signature, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(sampleStack[i].method, &name, &signature, nullptr))) return NSK_FALSE; NSK_DISPLAY4(" exp[%d] method: %s%s, location: %s\n", i, name, signature, jlong_to_string(sampleStack[i].location, buffer)); - if (name != NULL) + if (name != nullptr) jvmti->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); return NSK_TRUE; @@ -151,27 +151,27 @@ static int displayFrameInfo(jvmtiEnv* jvmti, jint i) { static int complainFrameInfo(jvmtiEnv* jvmti, jint i) { char buffer[32]; - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; - if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, nullptr))) return NSK_FALSE; NSK_COMPLAIN3(" got: method=%s%s, location=%s\n", name, signature, jlong_to_string(frameBuffer[frameCount-1-i].location, buffer)); - if (name != NULL) + if (name != nullptr) jvmti->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); - if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(sampleStack[i].method, &name, &signature, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(sampleStack[i].method, &name, &signature, nullptr))) return NSK_FALSE; NSK_COMPLAIN3(" expected: method=%s%s, location=%s\n", name, signature, jlong_to_string(sampleStack[i].location, buffer)); - if (name != NULL) + if (name != nullptr) jvmti->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); return NSK_TRUE; @@ -257,8 +257,8 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_scenarios_sampling_SP07_sp07t001Thread_wrapper(JNIEnv* jni, jobject obj, jint i) { jint result = 0; - jclass klass = NULL; - jmethodID method = NULL; + jclass klass = nullptr; + jmethodID method = nullptr; jvmtiEnv* jvmti = nsk_jvmti_getAgentJVMTIEnv(); if (!NSK_VERIFY(depth < MAX_DEPTH)) { @@ -269,14 +269,14 @@ Java_nsk_jvmti_scenarios_sampling_SP07_sp07t001Thread_wrapper(JNIEnv* jni, if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(frameLock))) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(jvmti->GetFrameLocation(NULL, 1, &sampleStack[depth].method, &sampleStack[depth].location))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetFrameLocation(nullptr, 1, &sampleStack[depth].method, &sampleStack[depth].location))) { nsk_jvmti_setFailStatus(); return 0; } depth++; - if (!NSK_JVMTI_VERIFY(jvmti->GetFrameLocation(NULL, 0, &sampleStack[depth].method, &sampleStack[depth].location))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetFrameLocation(nullptr, 0, &sampleStack[depth].method, &sampleStack[depth].location))) { nsk_jvmti_setFailStatus(); return 0; } @@ -286,12 +286,12 @@ Java_nsk_jvmti_scenarios_sampling_SP07_sp07t001Thread_wrapper(JNIEnv* jni, if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(frameLock))) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(obj)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(obj)) != nullptr)) { nsk_jvmti_setFailStatus(); return 0; } - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "fibonacci", "(I)I")) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "fibonacci", "(I)I")) != nullptr)) { nsk_jvmti_setFailStatus(); return 0; } @@ -325,7 +325,7 @@ JNIEXPORT jint JNI_OnLoad_sp07t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -336,14 +336,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("frameLock", &frameLock))) return NSK_FALSE; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/sp07t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/sp07t002.cpp index a83af49dc47..d256d87bdff 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/sp07t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/sp07t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,12 +41,12 @@ static const jlong SAMPLING_INTERVAL = 10; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jrawMonitorID waitLock = NULL; -static jfieldID field = NULL; -static jmethodID methodRun = NULL; -static jmethodID methodCatcher = NULL; -static jmethodID methodThrower = NULL; +static jthread thread = nullptr; +static jrawMonitorID waitLock = nullptr; +static jfieldID field = nullptr; +static jmethodID methodRun = nullptr; +static jmethodID methodCatcher = nullptr; +static jmethodID methodThrower = nullptr; static jint MAX_LADDER = 0; static int sampleCount = 0; static jint frameCount = 0; @@ -57,10 +57,10 @@ static jvmtiFrameInfo frameBuffer[MAX_DEPTH]; static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; - jclass klass = NULL; - jfieldID fid = NULL; + jclass klass = nullptr; + jfieldID fid = nullptr; int i; NSK_DISPLAY0("Prepare: find tested thread\n"); @@ -69,12 +69,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -84,11 +84,11 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } - if (info.name != NULL) { + if (info.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) return NSK_FALSE; } @@ -98,37 +98,37 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (thread == NULL) { + if (thread == nullptr) { NSK_COMPLAIN0("Debuggee thread not found"); return NSK_FALSE; } /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread field 'MAX_LADDER' */ - if (!NSK_JNI_VERIFY(jni, (fid = jni->GetStaticFieldID(klass, "MAX_LADDER", "I")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (fid = jni->GetStaticFieldID(klass, "MAX_LADDER", "I")) != nullptr)) return NSK_FALSE; MAX_LADDER = jni->GetStaticIntField(klass, fid); NSK_DISPLAY1("MAX_LADDER: %d\n", MAX_LADDER); /* get tested thread field 'depth' */ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "depth", "I")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "depth", "I")) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (methodRun = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (methodRun = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread method 'catcher' */ if (!NSK_JNI_VERIFY(jni, (methodCatcher = - jni->GetMethodID(klass, "catcher", "(II)V")) != NULL)) + jni->GetMethodID(klass, "catcher", "(II)V")) != nullptr)) return NSK_FALSE; /* get tested thread method 'thrower' */ - if (!NSK_JNI_VERIFY(jni, (methodThrower= jni->GetMethodID(klass, "thrower", "(I)V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (methodThrower= jni->GetMethodID(klass, "thrower", "(I)V")) != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("waitLock", &waitLock))) @@ -155,17 +155,17 @@ static int wait_for(jvmtiEnv* jvmti, jlong millis) { static int displayFrameInfo(jvmtiEnv* jvmti, jint i) { char buffer[32]; - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; - if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, nullptr))) return NSK_FALSE; NSK_DISPLAY4(" [%d] method: %s%s, location: %s\n", i, name, signature, jlong_to_string(frameBuffer[frameCount-1-i].location, buffer)); - if (name != NULL) + if (name != nullptr) jvmti->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); return NSK_TRUE; @@ -173,20 +173,20 @@ static int displayFrameInfo(jvmtiEnv* jvmti, jint i) { static int complainFrameInfo(jvmtiEnv* jvmti, jint i, jmethodID method) { char buffer[32]; - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; - if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, nullptr))) return NSK_FALSE; NSK_COMPLAIN3(" got method: %s%s, location: %s\n", name, signature, jlong_to_string(frameBuffer[frameCount-1-i].location, buffer)); - if (name != NULL) + if (name != nullptr) jvmti->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); - if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(method, &name, &signature, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(method, &name, &signature, nullptr))) return NSK_FALSE; NSK_COMPLAIN2(" expected method: %s%s\n", name, signature); @@ -196,7 +196,7 @@ static int complainFrameInfo(jvmtiEnv* jvmti, jint i, jmethodID method) { static int checkStackTrace(jvmtiEnv* jvmti, JNIEnv* jni) { int res = NSK_TRUE; - jmethodID method = NULL; + jmethodID method = nullptr; jint depth; jint i; int displayFlag = @@ -288,7 +288,7 @@ JNIEXPORT jint JNI_OnLoad_sp07t002(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; /* init framework and parse options */ @@ -300,7 +300,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -309,7 +309,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref001/followref001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref001/followref001.cpp index 08661336a14..e09e0040823 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref001/followref001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref001/followref001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,7 +62,7 @@ static int objectsCount = 0; static int fakeUserData = 0; static int userDataError = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static const jlong ROOT_CLASS_TAG = 9; static const jlong CHAIN_CLASS_TAG = 99; @@ -95,8 +95,6 @@ static const char* ref_kind_str[28] = { "JVMTI_HEAP_REFERENCE_OTHER" }; -#define DEREF(ptr) (((ptr) == NULL ? 0 : *(ptr))) - /* ============================================================================= */ @@ -175,7 +173,7 @@ static bool getAndTagClasses(jvmtiEnv* jvmti, jclass* rootObjectClass, 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -184,7 +182,7 @@ static bool getAndTagClasses(jvmtiEnv* jvmti, fflush(0); if (!NSK_JNI_VERIFY(jni, (*rootObjectClass = - jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -200,7 +198,7 @@ static bool getAndTagClasses(jvmtiEnv* jvmti, if (!NSK_JNI_VERIFY(jni, (*chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -227,10 +225,10 @@ static bool getFieldsAndObjects(jvmtiEnv* jvmti, jfieldID* reachableChainField, jfieldID* unreachableChainField, jfieldID* nextField) { - jfieldID rootObjectField = NULL; + jfieldID rootObjectField = nullptr; 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -239,7 +237,7 @@ static bool getFieldsAndObjects(jvmtiEnv* jvmti, fflush(0); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -248,7 +246,7 @@ static bool getFieldsAndObjects(jvmtiEnv* jvmti, fflush(0); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -258,7 +256,7 @@ static bool getFieldsAndObjects(jvmtiEnv* jvmti, fflush(0); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -267,14 +265,14 @@ static bool getFieldsAndObjects(jvmtiEnv* jvmti, fflush(0); if (!NSK_JNI_VERIFY(jni, (*rootObjectPtr = - jni->GetStaticObjectField(debugeeClass, rootObjectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, rootObjectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } printf("\nFound root object: 0x%p\n", (void*) *rootObjectPtr); fflush(0); - if (!NSK_JNI_VERIFY(jni, (*rootObjectPtr = jni->NewGlobalRef(*rootObjectPtr)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (*rootObjectPtr = jni->NewGlobalRef(*rootObjectPtr)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -296,7 +294,7 @@ static bool getAndTagChainObjects( ObjectDesc objectDescList[], jlong tag, bool reachable) { - jobject nextObj = NULL; + jobject nextObj = nullptr; jlong objTag = (reachable ? tag : -tag); if (count <= 0) { @@ -306,7 +304,7 @@ static bool getAndTagChainObjects( count--; tag++; - if (!NSK_JNI_VERIFY(jni, (nextObj = jni->GetObjectField(currObj, refField)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (nextObj = jni->GetObjectField(currObj, refField)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -350,13 +348,13 @@ static int getAndTagTestedObjects( ObjectDesc** objectDescList, jobject* rootObjectPtr) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID nextField = NULL; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID nextField = nullptr; if (!initObjectDescList(jvmti, chainLength, @@ -504,12 +502,12 @@ static void releaseTestedObjects(jvmtiEnv* jvmti, ObjectDesc* objectDescList, jobject rootObject) { - if (rootObject != NULL) { + if (rootObject != nullptr) { printf("Release object reference to root tested object: 0x%p\n", rootObject); NSK_TRACE(jni->DeleteGlobalRef(rootObject)); } - if (objectDescList != NULL) { + if (objectDescList != nullptr) { printf("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescList))) { nsk_jvmti_setFailStatus(); @@ -577,7 +575,7 @@ jint JNICALL heapReferenceCallback( nsk_jvmti_setFailStatus(); } - if (tag_ptr != NULL && *tag_ptr != 0) { + if (tag_ptr != nullptr && *tag_ptr != 0) { int found = 0; int i; @@ -724,7 +722,7 @@ jint JNICALL stringPrimitiveValueCallback( /** Agent algorithm. */ static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jobject rootObject = NULL; + jobject rootObject = nullptr; printf("Wait for tested objects created\n"); fflush(0); @@ -760,7 +758,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { fflush(0); if (!NSK_JVMTI_VERIFY(jvmti->FollowReferences((jint) 0, /* heap_filter */ - (jclass) NULL, /* class */ + (jclass) nullptr, /* class */ rootObject, /* initial_object */ &heapCallbacks, (const void *) &fakeUserData))) { @@ -803,7 +801,7 @@ JNIEXPORT jint JNI_OnLoad_followref001(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) { return JNI_ERR; @@ -814,7 +812,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(chainLength > 0)) return JNI_ERR; - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) { + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) { return JNI_ERR; } @@ -829,13 +827,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* Setting Heap Callbacks */ - heapCallbacks.heap_iteration_callback = NULL; + heapCallbacks.heap_iteration_callback = nullptr; heapCallbacks.heap_reference_callback = heapReferenceCallback; heapCallbacks.primitive_field_callback = primitiveFieldCallback; heapCallbacks.array_primitive_value_callback = arrayPrimitiveValueCallback; heapCallbacks.string_primitive_value_callback = stringPrimitiveValueCallback; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref002/followref002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref002/followref002.cpp index ee1eff158d6..d84b3b37624 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref002/followref002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref002/followref002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,7 +60,7 @@ static int objectsCount = 0; static int fakeUserData = 0; static int userDataError = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static jlong rootClassTag = 9; static jlong chainClassTag = 99; @@ -92,8 +92,6 @@ static const char* ref_kind_str[28] = { "JVMTI_HEAP_REFERENCE_OTHER" }; -#define DEREF(ptr) (((ptr) == NULL ? 0 : *(ptr))) - /* ============================================================================= */ /** Obtain chain of tested objects and tag them recursively. */ @@ -110,7 +108,7 @@ static int getAndTagChainObjects( jlong tag, int reachable) { - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (reachable ? tag : -tag); if (count <= 0) @@ -119,7 +117,7 @@ static int getAndTagChainObjects( count--; tag++; - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -159,14 +157,14 @@ static int getAndTagTestedObjects( ObjectDesc** objectDescList, jobject* rootObject) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; /* root object + reachable and unreachable object chains */ *objectsCount = 1 + 2 * chainLength; @@ -194,7 +192,7 @@ static int getAndTagTestedObjects( printf("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); fflush(0); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -202,7 +200,7 @@ static int getAndTagTestedObjects( printf("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); fflush(0); - if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -216,7 +214,7 @@ static int getAndTagTestedObjects( printf("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -230,7 +228,7 @@ static int getAndTagTestedObjects( printf("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -239,7 +237,7 @@ static int getAndTagTestedObjects( printf("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); fflush(0); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -248,7 +246,7 @@ static int getAndTagTestedObjects( printf("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); fflush(0); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -257,7 +255,7 @@ static int getAndTagTestedObjects( printf("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -266,14 +264,14 @@ static int getAndTagTestedObjects( printf("Get root object from static field: %s\n", OBJECT_FIELD_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (*rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } printf(" ... got object: 0x%p\n", (void*)*rootObject); fflush(0); - if (!NSK_JNI_VERIFY(jni, (*rootObject = jni->NewGlobalRef(*rootObject)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (*rootObject = jni->NewGlobalRef(*rootObject)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -394,12 +392,12 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList, jobject rootObject) { - if (rootObject != NULL) { + if (rootObject != nullptr) { printf("Release object reference to root tested object: 0x%p\n", rootObject); NSK_TRACE(jni->DeleteGlobalRef(rootObject)); } - if (objectDescList != NULL) { + if (objectDescList != nullptr) { printf("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescList))) { nsk_jvmti_setFailStatus(); @@ -460,13 +458,13 @@ jint JNICALL heapReferenceCallback( (int) referrer_index); fflush(0); - if (tag_ptr == NULL) { - NSK_COMPLAIN1("NULL tag_ptr is passed to heapReferenceCallback:" + if (tag_ptr == nullptr) { + NSK_COMPLAIN1("null tag_ptr is passed to heapReferenceCallback:" " tag_ptr=0x%p\n", (void*)tag_ptr); nsk_jvmti_setFailStatus(); } - if (tag_ptr != NULL && *tag_ptr != 0) { + if (tag_ptr != nullptr && *tag_ptr != 0) { int found = 0; int i; @@ -601,7 +599,7 @@ jint JNICALL stringPrimitiveValueCallback( /** Agent algorithm. */ static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jobject rootObject = NULL; + jobject rootObject = nullptr; printf("Wait for tested objects created\n"); fflush(0); @@ -635,7 +633,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { jint heap_filter = JVMTI_HEAP_FILTER_UNTAGGED | JVMTI_HEAP_FILTER_CLASS_UNTAGGED; if (!NSK_JVMTI_VERIFY(jvmti->FollowReferences(heap_filter, - (jclass) NULL, /* class */ + (jclass) nullptr, /* class */ rootObject, /* initial_object */ &heapCallbacks, (const void *) &fakeUserData))) { @@ -668,7 +666,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jint heap_filter = JVMTI_HEAP_FILTER_UNTAGGED | JVMTI_HEAP_FILTER_CLASS_UNTAGGED | JVMTI_HEAP_FILTER_TAGGED | JVMTI_HEAP_FILTER_CLASS_TAGGED; if (!NSK_JVMTI_VERIFY(jvmti->FollowReferences(heap_filter, - (jclass) NULL, /* class */ + (jclass) nullptr, /* class */ rootObject, /* initial_object */ &heapCallbacks, (const void *) &fakeUserData))) { @@ -714,7 +712,7 @@ JNIEXPORT jint JNI_OnLoad_followref002(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -726,7 +724,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -740,13 +738,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* Setting Heap Callbacks */ - heapCallbacks.heap_iteration_callback = NULL; + heapCallbacks.heap_iteration_callback = nullptr; heapCallbacks.heap_reference_callback = heapReferenceCallback; heapCallbacks.primitive_field_callback = primitiveFieldCallback; heapCallbacks.array_primitive_value_callback = arrayPrimitiveValueCallback; heapCallbacks.string_primitive_value_callback = stringPrimitiveValueCallback; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref003/followref003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref003/followref003.cpp index 22892f71a36..197a50cea1f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref003/followref003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref003/followref003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -71,7 +71,7 @@ static int objectsCount = 0; static int fakeUserData = 0; static int userDataError = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; #define TARG_THREAD_TAG 11 #define FIRST_THREAD_TAG (TARG_THREAD_TAG + 1) @@ -118,9 +118,6 @@ static const char* ref_kind_str[28] = { }; -#define DEREF(ptr) (((ptr) == NULL ? 0 : *(ptr))) - - /* ============================================================================= */ /** Obtain chain of tested objects and tag them recursively. */ @@ -129,7 +126,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jfieldID nextField, const char nextFieldName[], int count, ObjectDesc objectDescList[], jlong tag, int reachable) { - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (reachable ? tag : -tag); if (count <= 0) @@ -138,7 +135,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, count--; tag++; - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -164,14 +161,14 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList, jobject* rootObject) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; *objectsCount = 1 + 2 * chainLength; @@ -198,7 +195,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, printf("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); fflush(0); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -206,7 +203,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, printf("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); fflush(0); - if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -221,7 +218,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, printf("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -237,7 +234,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, printf("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -246,7 +243,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, printf("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); fflush(0); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -255,7 +252,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, printf("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); fflush(0); 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)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -264,7 +261,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, printf("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -273,14 +270,14 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, printf("Get root object from static field: %s\n", OBJECT_FIELD_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (*rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } printf(" ... got object: 0x%p\n", (void*)*rootObject); fflush(0); - if (!NSK_JNI_VERIFY(jni, (*rootObject = jni->NewGlobalRef(*rootObject)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (*rootObject = jni->NewGlobalRef(*rootObject)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -394,12 +391,12 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList, jobject rootObject) { - if (rootObject != NULL) { + if (rootObject != nullptr) { printf("Release object reference to root tested object: 0x%p\n", rootObject); NSK_TRACE(jni->DeleteGlobalRef(rootObject)); } - if (objectDescList != NULL) { + if (objectDescList != nullptr) { printf("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescList))) { nsk_jvmti_setFailStatus(); @@ -469,8 +466,8 @@ static int registerFrame(jlong thr_id, jint depth, jmethodID method, * (Do we have to clarify this in the JVMTI spec?) * Do not consider the test as failing in such a case. */ - if (method == NULL && ref_kind != JVMTI_HEAP_REFERENCE_JNI_LOCAL) { - NSK_COMPLAIN0("methodID must not be NULL\n"); + if (method == nullptr && ref_kind != JVMTI_HEAP_REFERENCE_JNI_LOCAL) { + NSK_COMPLAIN0("methodID must not be null\n"); failed = 1; } if (failed) { @@ -590,7 +587,7 @@ jint JNICALL heapReferenceCallback( jint depth = -1; jint slot = -1; jint index = -1; - jmethodID method = (jmethodID) NULL; + jmethodID method = (jmethodID) nullptr; jlocation location = (jlocation)(-1); jlong tag = DEREF(tag_ptr); jlong ref_tag = DEREF(referrer_tag_ptr); @@ -670,13 +667,13 @@ jint JNICALL heapReferenceCallback( (int) index); fflush(0); - if (tag_ptr == NULL) { - NSK_COMPLAIN1("NULL tag_ptr is passed to heapReferenceCallback:" + if (tag_ptr == nullptr) { + NSK_COMPLAIN1("null tag_ptr is passed to heapReferenceCallback:" " tag_ptr=0x%p\n", (void*)tag_ptr); nsk_jvmti_setFailStatus(); } - if (tag_ptr != NULL && tag != 0) { + if (tag_ptr != nullptr && tag != 0) { int found = 0; int i; @@ -878,7 +875,7 @@ static jthread getTargetThread(jvmtiEnv *jvmti) { static const char *target_thread_name = "main"; jint i; jint thread_count = -1; - jthread *threads = NULL; + jthread *threads = nullptr; jvmti->GetAllThreads(&thread_count, &threads); @@ -891,7 +888,7 @@ static jthread getTargetThread(jvmtiEnv *jvmti) { } } - return NULL; + return nullptr; } static jvmtiError setTagForTargetThread(jvmtiEnv *jvmti, jlong tag) { @@ -902,7 +899,7 @@ static jvmtiError setTagForTargetThread(jvmtiEnv *jvmti, jlong tag) { /** Agent algorithm. */ static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jobject rootObject = NULL; + jobject rootObject = nullptr; printf("Wait for tested objects created\n"); fflush(0); @@ -939,8 +936,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { fflush(0); { if (!NSK_JVMTI_VERIFY(jvmti->FollowReferences((jint) 0, /* heap_filter */ - (jclass) NULL, /* class */ - (jobject) NULL, /* initial_object */ + (jclass) nullptr, /* class */ + (jobject) nullptr, /* initial_object */ &heapCallbacks, (const void *) &fakeUserData))) { nsk_jvmti_setFailStatus(); @@ -977,8 +974,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jint heap_filter = JVMTI_HEAP_FILTER_UNTAGGED | JVMTI_HEAP_FILTER_CLASS_UNTAGGED; if (!NSK_JVMTI_VERIFY(jvmti->FollowReferences(heap_filter, - (jclass) NULL, /* class */ - (jobject) NULL, /* initial_object */ + (jclass) nullptr, /* class */ + (jobject) nullptr, /* initial_object */ &heapCallbacks, (const void *) &fakeUserData))) { nsk_jvmti_setFailStatus(); @@ -1026,7 +1023,7 @@ JNIEXPORT jint JNI_OnLoad_followref003(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -1035,7 +1032,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -1061,7 +1058,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -1075,13 +1072,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* Setting Heap Callbacks */ - heapCallbacks.heap_iteration_callback = NULL; + heapCallbacks.heap_iteration_callback = nullptr; heapCallbacks.heap_reference_callback = heapReferenceCallback; heapCallbacks.primitive_field_callback = primitiveFieldCallback; heapCallbacks.array_primitive_value_callback = arrayPrimitiveValueCallback; heapCallbacks.string_primitive_value_callback = stringPrimitiveValueCallback; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref004/followref004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref004/followref004.cpp index a1831044057..c6c24999441 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref004/followref004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref004/followref004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -146,16 +146,16 @@ static void createGlobalRefs(JNIEnv * jni) { jclass klass; - if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass(JAVA_LANG_STRING_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass(JAVA_LANG_STRING_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JNI_VERIFY(jni, (g_jniGlobalRef = jni->NewGlobalRef(klass)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (g_jniGlobalRef = jni->NewGlobalRef(klass)) != nullptr)) { nsk_jvmti_setFailStatus(); } - if (!NSK_JNI_VERIFY(jni, (g_jniWeakGlobalRef = jni->NewWeakGlobalRef(klass)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (g_jniWeakGlobalRef = jni->NewWeakGlobalRef(klass)) != nullptr)) { nsk_jvmti_setFailStatus(); } @@ -180,8 +180,8 @@ static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) createGlobalRefs(jni); retCode = jvmti->FollowReferences((jint) 0, /* heap filter */ - NULL, /* class */ - NULL, /* inital object */ + nullptr, /* class */ + nullptr, /* inital object */ &g_heapCallbacks, (const void *) &g_fakeUserData); @@ -218,7 +218,7 @@ JNIEXPORT jint JNI_OnLoad_followref004(JavaVM *jvm, char *options, void *reserve #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) { return JNI_ERR; @@ -226,13 +226,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) g_timeout = nsk_jvmti_getWaitTime() * 60 * 1000; - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) { + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) { return JNI_ERR; } /* Setting Heap Callbacks */ memset(&g_heapCallbacks, 0, sizeof(g_heapCallbacks)); - g_heapCallbacks.heap_iteration_callback = NULL; + g_heapCallbacks.heap_iteration_callback = nullptr; g_heapCallbacks.heap_reference_callback = heapReferenceCallback; g_heapCallbacks.primitive_field_callback = primitiveFieldCallback; g_heapCallbacks.array_primitive_value_callback = arrayPrimitiveValueCallback; @@ -250,7 +250,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref005/followref005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref005/followref005.cpp index 52b313b51c4..a8df86c3273 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref005/followref005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref005/followref005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,8 +46,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { " return an error if env. doesn't possess can_tag_objects capability\n"); retCode = jvmti->FollowReferences((jint) 0, /* heap filter */ - NULL, /* class */ - NULL, /* inital object */ + nullptr, /* class */ + nullptr, /* inital object */ &g_wrongHeapCallbacks, (const void *) &g_fakeUserData); @@ -57,7 +57,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } retCode = jvmti->IterateThroughHeap((jint) 0, /* heap filter */ - NULL, /* class */ + nullptr, /* class */ &g_wrongHeapCallbacks, (const void *) &g_fakeUserData); @@ -115,7 +115,7 @@ JNIEXPORT jint JNI_OnLoad_followref005(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) { return JNI_ERR; @@ -123,7 +123,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { g_timeout = nsk_jvmti_getWaitTime() * 60 * 1000; - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) { + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) { return JNI_ERR; } @@ -137,7 +137,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref006/followref006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref006/followref006.cpp index cabd4696827..d161739de62 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref006/followref006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref006/followref006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,7 @@ static void verifyReturnCodes(JNIEnv* jni, jvmtiEnv* jvmti) retCode = jvmti->FollowReferences((jint) 0, /* heap filter */ (jclass) &g_wrongHeapCallbacks , /* invalid class, but valid memory address */ - NULL, /* inital object */ + nullptr, /* inital object */ &g_wrongHeapCallbacks, (const void *) &g_fakeUserData); @@ -63,18 +63,18 @@ static void verifyReturnCodes(JNIEnv* jni, jvmtiEnv* jvmti) // When FollowReferences() is called with an invalid initial object // the behaviour according to the jvmti spec is optional. // It may return JVMTI_ERROR_INVALID_OBJECT and not follow any references. - // Or it may treat the object as NULL, and follow all references. + // Or it may treat the object as nullptr, and follow all references. // // We will accept both behaviours. We use empty callbacks since the existing // callback marks the test as failed. - emptyHeapCallbacks.heap_iteration_callback = NULL; - emptyHeapCallbacks.heap_reference_callback = NULL; - emptyHeapCallbacks.primitive_field_callback = NULL; - emptyHeapCallbacks.array_primitive_value_callback = NULL; - emptyHeapCallbacks.string_primitive_value_callback = NULL; + emptyHeapCallbacks.heap_iteration_callback = nullptr; + emptyHeapCallbacks.heap_reference_callback = nullptr; + emptyHeapCallbacks.primitive_field_callback = nullptr; + emptyHeapCallbacks.array_primitive_value_callback = nullptr; + emptyHeapCallbacks.string_primitive_value_callback = nullptr; retCode = jvmti->FollowReferences((jint) 0, // heap filter - NULL, // class + nullptr, // class (jobject) &g_wrongHeapCallbacks, // invalid inital object &emptyHeapCallbacks, // No callbacks (const void *) &g_fakeUserData); @@ -87,9 +87,9 @@ static void verifyReturnCodes(JNIEnv* jni, jvmtiEnv* jvmti) NSK_DISPLAY0("FollowReferences: Invalid callbacks:"); retCode = jvmti->FollowReferences((jint) 0, /* heap filter */ - NULL, /* class */ - NULL, /* inital object */ - NULL, + nullptr, /* class */ + nullptr, /* inital object */ + nullptr, (const void *) &g_fakeUserData); if (!NSK_VERIFY(retCode == JVMTI_ERROR_NULL_POINTER)) { @@ -105,17 +105,17 @@ static void verifyReturnCodes(JNIEnv* jni, jvmtiEnv* jvmti) nsk_jvmti_setFailStatus(); } - NSK_DISPLAY0("GetTag: NULL object pointer:"); + NSK_DISPLAY0("GetTag: null object pointer:"); - retCode = jvmti->GetTag(NULL, &tag); + retCode = jvmti->GetTag(nullptr, &tag); if (!NSK_VERIFY(retCode == JVMTI_ERROR_INVALID_OBJECT)) { nsk_jvmti_setFailStatus(); } - NSK_DISPLAY0("GetTag: NULL tag pointer:"); + NSK_DISPLAY0("GetTag: null tag pointer:"); - retCode = jvmti->GetTag((jobject) &g_wrongHeapCallbacks, NULL); + retCode = jvmti->GetTag((jobject) &g_wrongHeapCallbacks, nullptr); if (!NSK_VERIFY(retCode == JVMTI_ERROR_NULL_POINTER)) { nsk_jvmti_setFailStatus(); @@ -131,15 +131,15 @@ static void verifyReturnCodes(JNIEnv* jni, jvmtiEnv* jvmti) nsk_jvmti_setFailStatus(); } - NSK_DISPLAY0("SetTag: NULL object pointer:"); + NSK_DISPLAY0("SetTag: null object pointer:"); - retCode = jvmti->GetTag(NULL, &tag); + retCode = jvmti->GetTag(nullptr, &tag); if (!NSK_VERIFY(retCode == JVMTI_ERROR_INVALID_OBJECT)) { nsk_jvmti_setFailStatus(); } - NSK_DISPLAY0("GetTag: NULL tag pointer:"); + NSK_DISPLAY0("GetTag: null tag pointer:"); } /* verifyReturnCodes */ @@ -151,14 +151,14 @@ static void checkNoObjIterated(JNIEnv* jni, jvmtiEnv* jvmti, const char * szClas jclass klass; NSK_DISPLAY1("Verify, that no objects are returned if initial object is %s", szClassName); - if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass(szClassName)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass(szClassName)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } retCode = jvmti->FollowReferences((jint) 0, /* heap filter */ klass, /* class */ - NULL, /* inital object */ + nullptr, /* inital object */ &g_wrongHeapCallbacks, (const void *) &g_fakeUserData); @@ -211,7 +211,7 @@ JNIEXPORT jint JNI_OnLoad_followref006(JavaVM *jvm, char *options, void *reserve #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) { return JNI_ERR; @@ -219,7 +219,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) g_timeout = nsk_jvmti_getWaitTime() * 60 * 1000; - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) { + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) { return JNI_ERR; } @@ -235,7 +235,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp index 9bca3a9c004..faa370694b4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ extern "C" { #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return errCode -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; @@ -51,7 +51,7 @@ static int errCode = PASSED; static const char *sig_exp = "()J"; static const char *name_exp = "activeMethod"; -static jmethodID midActiveMethod = NULL; +static jmethodID midActiveMethod = nullptr; void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, @@ -84,13 +84,13 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretbase_suspThread(JNIEnv *env, } jclass clazz = env->GetObjectClass(earlyretThr); - if (clazz == NULL) { + if (clazz == nullptr) { printf("Cannot get class of thread object\n"); RETURN_FAILED; } midActiveMethod = env->GetMethodID(clazz, name_exp, sig_exp); - if (midActiveMethod == NULL) { + if (midActiveMethod == nullptr) { printf("Cannot find Method ID for method %s\n", name_exp); RETURN_FAILED; } @@ -137,7 +137,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretbase_doForceEarlyReturn(JNIEnv *env * that ForceEarlyReturn correctly generates them */ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_METHOD_EXIT, NULL); + JVMTI_EVENT_METHOD_EXIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable METHOD_EXIT event: %s (%d)\n", TranslateError(err), err); @@ -147,7 +147,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretbase_doForceEarlyReturn(JNIEnv *env } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FRAME_POP, NULL); + JVMTI_EVENT_FRAME_POP, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable FRAME_POP event: %s (%d)\n", TranslateError(err), err); @@ -197,7 +197,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong error code from a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretfp/earlyretfp.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretfp/earlyretfp.cpp index 0feb076932d..d4353eb9dce 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretfp/earlyretfp.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretfp/earlyretfp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,15 +36,15 @@ extern "C" { #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return #define METHCNT 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint errCode = PASSED; static jboolean printdump = JNI_TRUE; -static jmethodID midCheckPoint = NULL; -static jmethodID midRun = NULL; -static jmethodID midCountDownFloat = NULL; -static jmethodID midCountDownDouble = NULL; +static jmethodID midCheckPoint = nullptr; +static jmethodID midRun = nullptr; +static jmethodID midCountDownFloat = nullptr; +static jmethodID midCountDownDouble = nullptr; /* There is no synchronization for the counters because * they are incremented in single threaded mode. @@ -70,7 +70,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jclass cls; jlocation loc_exp = (i == 0) ? 0x16 : 0xd; char *sigClass, *name, *sig, *generic; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jint argValue; jint j; @@ -105,7 +105,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, i, TranslateError(err), err); RETURN_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, argName) == 0) { err = jvmti_env->GetLocalInt(thr, 0, @@ -125,17 +125,17 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, printf(", arg value: %d\n", argValue); } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(step %d) wrong class sig: \"%s\",\n", i, sigClass); printf(" expected: \"%s\"\n", cls_exp); RETURN_FAILED; } - if (name == NULL || strcmp(name, name_exp[methidx]) != 0) { + if (name == nullptr || strcmp(name, name_exp[methidx]) != 0) { printf("(step %d) wrong method name: \"%s\",", i, name); printf(" expected: \"%s\"\n", name_exp[methidx]); RETURN_FAILED; } - if (sig == NULL || strcmp(sig, sig_exp[methidx]) != 0) { + if (sig == nullptr || strcmp(sig, sig_exp[methidx]) != 0) { printf("(step %d) wrong method sig: \"%s\",", i, sig); printf(" expected: \"%s\"\n", sig_exp[methidx]); RETURN_FAILED; @@ -153,16 +153,16 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, RETURN_FAILED; } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -307,14 +307,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printf("Printdump is turned on!\n"); printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong error code from a valid call to GetEnv!\n"); return JNI_ERR; } @@ -370,7 +370,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretfp_getReady( JNIEnv *env, jclass c, jclass cls, jint depth, jdouble retval) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); RETURN_FAILED; } @@ -383,25 +383,25 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretfp_getReady( } midRun = env->GetMethodID(cls, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); RETURN_FAILED; } midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); RETURN_FAILED; } midCountDownFloat = env->GetMethodID(cls, "countDownFloat", "(I)F"); - if (midCountDownFloat == NULL) { + if (midCountDownFloat == nullptr) { printf("Cannot find Method ID for method countDownFloat\n"); RETURN_FAILED; } midCountDownDouble = env->GetMethodID(cls, "countDownDouble", "(I)D"); - if (midCountDownDouble == NULL) { + if (midCountDownDouble == nullptr) { printf("Cannot find Method ID for method countDownDouble\n"); RETURN_FAILED; } @@ -414,7 +414,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretfp_getReady( } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretint/earlyretint.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretint/earlyretint.cpp index 071aa1db1f3..81c0a1e5ec8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretint/earlyretint.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretint/earlyretint.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,20 +35,20 @@ extern "C" { #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint errCode = PASSED; static jboolean printdump = JNI_TRUE; -static jmethodID midCheckPoint = NULL; -static jmethodID midRun = NULL; +static jmethodID midCheckPoint = nullptr; +static jmethodID midRun = nullptr; -static jmethodID midCountDownInt = NULL; -static jmethodID midCountDownShort = NULL; -static jmethodID midCountDownChar = NULL; -static jmethodID midCountDownByte = NULL; -static jmethodID midCountDownBoolean = NULL; +static jmethodID midCountDownInt = nullptr; +static jmethodID midCountDownShort = nullptr; +static jmethodID midCountDownChar = nullptr; +static jmethodID midCountDownByte = nullptr; +static jmethodID midCountDownBoolean = nullptr; static jint framesExpected = 0; static jint framesCount = 0; @@ -78,7 +78,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jclass cls; jlocation loc_exp = (i == 0) ? 0x21 : 0xd; char *sigClass, *name, *sig, *generic; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jint argValue = -i; jint j; @@ -106,17 +106,17 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, RETURN_FAILED; } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(step %d) Wrong class sig: \"%s\",\n", i, sigClass); printf(" expected: \"%s\"\n", cls_exp); RETURN_FAILED; } - if (name == NULL || strcmp(name, name_exp[methidx]) != 0) { + if (name == nullptr || strcmp(name, name_exp[methidx]) != 0) { printf("(step %d) wrong method name: \"%s\",", i, name); printf(" expected: \"%s\"\n", name_exp[methidx]); RETURN_FAILED; } - if (sig == NULL || strcmp(sig, sign_exp[methidx]) != 0) { + if (sig == nullptr || strcmp(sig, sign_exp[methidx]) != 0) { printf("(step %d) wrong method sig: \"%s\",", i, sig); printf(" expected: \"%s\"\n", sign_exp[methidx]); RETURN_FAILED; @@ -136,7 +136,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, i, TranslateError(err), err); RETURN_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, argName) == 0) { err = jvmti_env->GetLocalInt(thr, 0, @@ -162,16 +162,16 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, RETURN_FAILED; } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -313,14 +313,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printf("Printdump is turned on!\n"); printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong error code from a valid call to GetEnv!\n"); return JNI_ERR; } @@ -375,7 +375,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretint_getReady( JNIEnv *env, jclass c, jclass cls, jint depth) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); RETURN_FAILED; } @@ -388,43 +388,43 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretint_getReady( } midRun = env->GetMethodID(cls, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); RETURN_FAILED; } midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); RETURN_FAILED; } midCountDownInt = env->GetMethodID(cls, "countDownInt", "(I)I"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method countDownInt\n"); RETURN_FAILED; } midCountDownShort = env->GetMethodID(cls, "countDownShort", "(I)S"); - if (midCountDownShort == NULL) { + if (midCountDownShort == nullptr) { printf("Cannot find Method ID for method countDownShort\n"); RETURN_FAILED; } midCountDownChar = env->GetMethodID(cls, "countDownChar", "(I)C"); - if (midCountDownChar == NULL) { + if (midCountDownChar == nullptr) { printf("Cannot find Method ID for method countDownChar\n"); RETURN_FAILED; } midCountDownByte = env->GetMethodID(cls, "countDownByte", "(I)B"); - if (midCountDownByte == NULL) { + if (midCountDownByte == nullptr) { printf("Cannot find Method ID for method countDownByte\n"); RETURN_FAILED; } midCountDownBoolean = env->GetMethodID(cls, "countDownBoolean", "(I)Z"); - if (midCountDownBoolean == NULL) { + if (midCountDownBoolean == nullptr) { printf("Cannot find Method ID for method countDownBoolean\n"); RETURN_FAILED; } @@ -437,7 +437,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretint_getReady( } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretlong/earlyretlong.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretlong/earlyretlong.cpp index 74f358e924b..7261fe3f621 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretlong/earlyretlong.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretlong/earlyretlong.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,15 +36,15 @@ extern "C" { #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint errCode = PASSED; static jboolean printdump = JNI_TRUE; -static jmethodID midRun = NULL; -static jmethodID midCountDownLong = NULL; -static jmethodID midCheckPoint = NULL; +static jmethodID midRun = nullptr; +static jmethodID midCountDownLong = nullptr; +static jmethodID midCheckPoint = nullptr; static jint framesExpected = 0; static jint framesCount = 0; @@ -64,7 +64,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jclass cls; jlocation loc_exp = (frame_no == 0) ? 0x15 : 0xd; char *sigClass, *name, *sig, *generic; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jint argValue; jint j; @@ -99,7 +99,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, frame_no, TranslateError(err), err); RETURN_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, argName) == 0) { err = jvmti_env->GetLocalInt(thr, 0, @@ -119,17 +119,17 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, printf(", arg value: %d\n", argValue); } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(step %d) Wrong class sig: \"%s\",\n", frame_no, sigClass); printf(" expected: \"%s\"\n", cls_exp); RETURN_FAILED; } - if (name == NULL || strcmp(name, name_exp) != 0) { + if (name == nullptr || strcmp(name, name_exp) != 0) { printf("(step %d) wrong method name: \"%s\",", frame_no, name); printf(" expected: \"%s\"\n", name_exp); RETURN_FAILED; } - if (sig == NULL || strcmp(sig, sig_exp) != 0) { + if (sig == nullptr || strcmp(sig, sig_exp) != 0) { printf("(step %d) wrong method sig: \"%s\",", frame_no, sig); printf(" expected: \"%s\"\n", sig_exp); RETURN_FAILED; @@ -146,16 +146,16 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, RETURN_FAILED; } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -294,14 +294,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printf("Printdump is turned on!\n"); printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong error code from a valid call to GetEnv!\n"); return JNI_ERR; } @@ -357,7 +357,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretlong_getReady( jvmtiError err; val_exp = retval_base; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); RETURN_FAILED; } @@ -370,19 +370,19 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretlong_getReady( } midRun = env->GetMethodID(cls, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); RETURN_FAILED; } midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); RETURN_FAILED; } midCountDownLong = env->GetMethodID(cls, "countDownLong", "(I)J"); - if (midCountDownLong == NULL) { + if (midCountDownLong == nullptr) { printf("Cannot find Method ID for method countDownLong\n"); RETURN_FAILED; } @@ -395,7 +395,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretlong_getReady( } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretobj/earlyretobj.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretobj/earlyretobj.cpp index 0cdbcb18029..b5f6a60f4c3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretobj/earlyretobj.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretobj/earlyretobj.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,15 +36,15 @@ extern "C" { #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint errCode = PASSED; static jboolean printdump = JNI_TRUE; -static jmethodID midRun = NULL; -static jmethodID midCountDownObject = NULL; -static jmethodID midCheckPoint = NULL; +static jmethodID midRun = nullptr; +static jmethodID midCountDownObject = nullptr; +static jmethodID midCheckPoint = nullptr; static jint framesExpected = 0; static jint framesCount = 0; @@ -52,7 +52,7 @@ static jint methodExitEventCount = 0; static const char *cls_exp = "Lnsk/jvmti/unit/ForceEarlyReturn/earlyretobj$earlyretThread;"; -static jobject val_exp = NULL; +static jobject val_exp = nullptr; static const char *sig_exp = "(I)Lnsk/jvmti/unit/ForceEarlyReturn/earlyretobj$RetObj;"; static const char *name_exp = "countDownObject"; @@ -64,7 +64,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jclass cls; jlocation loc_exp = (frame_no == 0) ? 0x15 : 0xd; char *sigClass, *name, *sig, *generic; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jint argValue; jint j; @@ -99,7 +99,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, frame_no, TranslateError(err), err); RETURN_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, argName) == 0) { err = jvmti_env->GetLocalInt(thr, 0, @@ -119,17 +119,17 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, printf(", arg value: %d\n", argValue); } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(step %d) Wrong class sig: \"%s\",\n", frame_no, sigClass); printf(" expected: \"%s\"\n", cls_exp); RETURN_FAILED; } - if (name == NULL || strcmp(name, name_exp) != 0) { + if (name == nullptr || strcmp(name, name_exp) != 0) { printf("(step %d) wrong method name: \"%s\",", frame_no, name); printf(" expected: \"%s\"\n", name_exp); RETURN_FAILED; } - if (sig == NULL || strcmp(sig, sig_exp) != 0) { + if (sig == nullptr || strcmp(sig, sig_exp) != 0) { printf("(step %d) wrong method sig: \"%s\",", frame_no, sig); printf(" expected: \"%s\"\n", sig_exp); RETURN_FAILED; @@ -146,16 +146,16 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, RETURN_FAILED; } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -292,14 +292,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printf("Printdump is turned on!\n"); printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong error code from a valid call to GetEnv!\n"); return JNI_ERR; } @@ -354,7 +354,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretobj_getReady( JNIEnv *env, jclass c, jclass cls, jint depth, jobject ret_obj) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); RETURN_FAILED; } @@ -367,19 +367,19 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretobj_getReady( } midRun = env->GetMethodID(cls, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); RETURN_FAILED; } midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); RETURN_FAILED; } midCountDownObject = env->GetMethodID(cls, "countDownObject", sig_exp); - if (midCountDownObject == NULL) { + if (midCountDownObject == nullptr) { printf("Cannot find Method ID for method countDownObject\n"); RETURN_FAILED; } @@ -392,7 +392,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretobj_getReady( } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretstr/earlyretstr.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretstr/earlyretstr.cpp index 7622d1065b0..9629ebf46dc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretstr/earlyretstr.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretstr/earlyretstr.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,15 +35,15 @@ extern "C" { #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint errCode = PASSED; static jboolean printdump = JNI_TRUE; -static jmethodID midRun = NULL; -static jmethodID midCountDownString = NULL; -static jmethodID midCheckPoint = NULL; +static jmethodID midRun = nullptr; +static jmethodID midCountDownString = nullptr; +static jmethodID midCheckPoint = nullptr; static jint framesExpected = 0; static jint framesCount = 0; @@ -51,7 +51,7 @@ static jint methodExitEventCount = 0; static const char *cls_exp = "Lnsk/jvmti/unit/ForceEarlyReturn/earlyretstr$earlyretThread;"; -static jstring str_exp = NULL; +static jstring str_exp = nullptr; static const char *sig_exp = "(I)Ljava/lang/String;"; static const char *name_exp = "countDownString"; @@ -63,7 +63,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jclass cls; jlocation loc_exp = (frame_no == 0) ? 0x15 : 0xd; char *sigClass, *name, *sig, *generic; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jint argValue; jint j; @@ -98,7 +98,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, frame_no, TranslateError(err), err); RETURN_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, argName) == 0) { err = jvmti_env->GetLocalInt(thr, 0, @@ -118,17 +118,17 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, printf(", arg value: %d\n", argValue); } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(step %d) Wrong class sig: \"%s\",\n", frame_no, sigClass); printf(" expected: \"%s\"\n", cls_exp); RETURN_FAILED; } - if (name == NULL || strcmp(name, name_exp) != 0) { + if (name == nullptr || strcmp(name, name_exp) != 0) { printf("(step %d) wrong method name: \"%s\",", frame_no, name); printf(" expected: \"%s\"\n", name_exp); RETURN_FAILED; } - if (sig == NULL || strcmp(sig, sig_exp) != 0) { + if (sig == nullptr || strcmp(sig, sig_exp) != 0) { printf("(step %d) wrong method sig: \"%s\",", frame_no, sig); printf(" expected: \"%s\"\n", sig_exp); RETURN_FAILED; @@ -145,16 +145,16 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, RETURN_FAILED; } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -291,14 +291,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printf("Printdump is turned on!\n"); printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong error code of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -353,7 +353,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretstr_getReady( JNIEnv *env, jclass c, jclass cls, jint depth, jstring expected_str) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); RETURN_FAILED; } @@ -366,19 +366,19 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretstr_getReady( } midRun = env->GetMethodID(cls, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); RETURN_FAILED; } midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); RETURN_FAILED; } midCountDownString = env->GetMethodID(cls, "countDownString", sig_exp); - if (midCountDownString == NULL) { + if (midCountDownString == nullptr) { printf("Cannot find Method ID for method countDownString\n"); RETURN_FAILED; } @@ -391,7 +391,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretstr_getReady( } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretvoid/earlyretvoid.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretvoid/earlyretvoid.cpp index 2a50307dc25..567ed23a543 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretvoid/earlyretvoid.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretvoid/earlyretvoid.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,13 +35,13 @@ extern "C" { #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint errCode = PASSED; static jboolean printdump = JNI_TRUE; -static jmethodID midCheckPoint = NULL; -static jmethodID midRun = NULL; +static jmethodID midCheckPoint = nullptr; +static jmethodID midRun = nullptr; static jint framesExpected = 0; static jint framesCount = 0; @@ -57,7 +57,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jclass cls; jlocation loc_exp = (frame_no == 0) ? 25 : 11; char *sigClass, *name, *sig, *generic; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jint argValue; jint j; @@ -92,7 +92,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, frame_no, TranslateError(err), err); RETURN_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, argName) == 0) { err = jvmti_env->GetLocalInt(thr, 0, @@ -112,17 +112,17 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, printf(", arg value: %d\n", argValue); } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(step %d) wrong class sig: \"%s\",\n", frame_no, sigClass); printf(" expected: \"%s\"\n", cls_exp); RETURN_FAILED; } - if (name == NULL || strcmp(name, name_exp) != 0) { + if (name == nullptr || strcmp(name, name_exp) != 0) { printf("(step %d) wrong method name: \"%s\",", frame_no, name); printf(" expected: \"%s\"\n", name_exp); RETURN_FAILED; } - if (sig == NULL || strcmp(sig, sig_exp) != 0) { + if (sig == nullptr || strcmp(sig, sig_exp) != 0) { printf("(step %d) wrong method sig: \"%s\",", frame_no, sig); printf(" expected: \"%s\"\n", sig_exp); RETURN_FAILED; @@ -139,16 +139,16 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, RETURN_FAILED; } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -241,14 +241,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printf("Printdump is turned on!\n"); printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong error code from a valid call to GetEnv!\n"); return JNI_ERR; } @@ -300,7 +300,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretvoid_getReady( JNIEnv *env, jclass c, jclass cls, jint depth) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); RETURN_FAILED; } @@ -312,13 +312,13 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretvoid_getReady( } midRun = env->GetMethodID(cls, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); RETURN_FAILED; } midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); RETURN_FAILED; } @@ -331,7 +331,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretvoid_getReady( } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetAllStackTraces/getallstktr001/getallstktr001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetAllStackTraces/getallstktr001/getallstktr001.cpp index 82fa5dfdfa7..a6d2804ba76 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetAllStackTraces/getallstktr001/getallstktr001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetAllStackTraces/getallstktr001/getallstktr001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -64,10 +64,10 @@ static jrawMonitorID jraw_monitor; #define MAX_FRAMES_CNT 30 -static jvmtiStackInfo *stack_buf1 = NULL; -static jvmtiStackInfo *stack_buf2 = NULL; -static jthread *thread_list = NULL; -static jvmtiThreadInfo *thread_info = NULL; +static jvmtiStackInfo *stack_buf1 = nullptr; +static jvmtiStackInfo *stack_buf2 = nullptr; +static jthread *thread_list = nullptr; +static jvmtiThreadInfo *thread_info = nullptr; static jint threads_count = 0; @@ -191,10 +191,10 @@ void compare_one_stack_trace(int ti, static const char* TEST_THREAD_NAME_PREFIX = "getallstktr001-"; size_t PFX_LEN = strlen(TEST_THREAD_NAME_PREFIX); - if (thr_info->name != NULL) { + if (thr_info->name != nullptr) { printf("compare stack #%d: thread: %s\n", ti, thr_info->name); } else { - printf("compare stack #%d: thread is NULL\n", ti); + printf("compare stack #%d: thread is null\n", ti); return; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetConstantPool/getcpool001/getcpool001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetConstantPool/getcpool001/getcpool001.cpp index feafa26dde2..0514a46224d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetConstantPool/getcpool001/getcpool001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetConstantPool/getcpool001/getcpool001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,8 +39,8 @@ static jvmtiEventCallbacks callbacks; #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return static jint errCode = PASSED; -static jvmtiEnv *jvmti = NULL; -static jmethodID midCheckPoint = NULL; +static jvmtiEnv *jvmti = nullptr; +static jmethodID midCheckPoint = nullptr; JNIEXPORT void JNICALL @@ -51,7 +51,7 @@ Java_nsk_jvmti_unit_GetConstantPool_getcpool001_getCP( int rep = 0; jint cp_cnt = 0; jint cp_bytes_cnt = 0; - unsigned char *cp_bytes = NULL; + unsigned char *cp_bytes = nullptr; err = jvmti->GetConstantPool(cls, &cp_cnt, &cp_bytes_cnt, &cp_bytes); if (err != JVMTI_ERROR_NONE) { @@ -102,7 +102,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -151,7 +151,7 @@ Java_nsk_jvmti_unit_GetConstantPool_getcpool001_getReady( JNIEnv *env, jclass c, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); RETURN_FAILED; } @@ -163,7 +163,7 @@ Java_nsk_jvmti_unit_GetConstantPool_getcpool001_getReady( } midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); RETURN_FAILED; } @@ -175,7 +175,7 @@ Java_nsk_jvmti_unit_GetConstantPool_getcpool001_getReady( RETURN_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLineNumberTable/linetab004/linetab004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLineNumberTable/linetab004/linetab004.cpp index fb3db7f4be7..9f40468f433 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLineNumberTable/linetab004/linetab004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLineNumberTable/linetab004/linetab004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -56,12 +56,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,7 +97,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { void checkGetLineNumberTable(jmethodID mid, const char *methName, int abstract, jvmtiError exp) { jint entryCount = -1; - jvmtiLineNumberEntry *table = NULL; + jvmtiLineNumberEntry *table = nullptr; jvmtiError err; int i; @@ -132,7 +132,7 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) jclass abstr; jclass interf; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -145,13 +145,13 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) printf("\n Check methods of interface:\n"); } interf = env->FindClass("nsk/jvmti/unit/GetLineNumberTable/Interface004"); - if (interf == NULL) { + if (interf == nullptr) { printf("Cannot get Interface class!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "instanceMeth0", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -159,7 +159,7 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) JVMTI_ERROR_ABSENT_INFORMATION); mid = env->GetMethodID(cls, "instanceMeth1", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -170,13 +170,13 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) printf("\n Check methods of abstract class:\n"); } abstr = env->GetSuperclass(cls); - if (abstr == NULL) { + if (abstr == nullptr) { printf("Cannot get super class!\n"); return STATUS_FAILED; } mid = env->GetMethodID(abstr, "instanceMeth0", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -184,7 +184,7 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) JVMTI_ERROR_ABSENT_INFORMATION); mid = env->GetMethodID(abstr, "instanceMeth1", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -195,7 +195,7 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) printf("\n Check methods of regular class:\n"); } mid = env->GetMethodID(cls, "instanceMeth0", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -203,7 +203,7 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) JVMTI_ERROR_ABSENT_INFORMATION); mid = env->GetMethodID(cls, "instanceMeth1", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -211,7 +211,7 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) JVMTI_ERROR_ABSENT_INFORMATION); mid = env->GetMethodID(cls, "instanceMeth2", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -222,7 +222,7 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) printf("\n Check native methods of regular class:\n"); } mid = env->GetMethodID(cls, "instanceNativeMeth", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -230,7 +230,7 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) JVMTI_ERROR_NATIVE_METHOD); mid = env->GetStaticMethodID(cls, "staticNativeMeth", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp index 1688cd1b723..4361f6df756 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,12 +34,12 @@ extern "C" { #define STATUS_PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = STATUS_PASSED; static jboolean printdump = JNI_FALSE; -static jmethodID mid = NULL; -static jvmtiLocalVariableEntry *table = NULL; +static jmethodID mid = nullptr; +static jvmtiLocalVariableEntry *table = nullptr; static jint entryCount = 0; static jint methodExitCnt = -1; @@ -140,7 +140,7 @@ MethodExit(jvmtiEnv *jvmti_env, jvmtiError err; jlocation location; - jmethodID frame_method = NULL; + jmethodID frame_method = nullptr; if (mid != method) { return; @@ -181,12 +181,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; static jvmtiCapabilities caps; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -233,12 +233,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_instMeth(JNIEnv *env, jobject inst) { jvmtiError err; - jobject obj = NULL; + jobject obj = nullptr; printf("\n Native instMeth: started\n"); // Test GetLocalInstance with native instance method instMeth() frame - err = jvmti->GetLocalInstance(NULL, 0, &obj); + err = jvmti->GetLocalInstance(nullptr, 0, &obj); printf(" Native instMeth: GetLocalInstance: %s (%d)\n", TranslateError(err), err); if (err != JVMTI_ERROR_NONE) { printf("FAIL: GetLocalInstance failed to get instance for native instance method frame\n"); @@ -250,7 +250,7 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_instMeth(JNIEnv *env, jobject i } // Test GetLocalInstance with java instance method meth01() frame - err = jvmti->GetLocalInstance(NULL, 1, &obj); + err = jvmti->GetLocalInstance(nullptr, 1, &obj); printf(" Native instMeth: GetLocalInstance: %s (%d)\n", TranslateError(err), err); if (err != JVMTI_ERROR_NONE) { printf("FAIL: GetLocalInstance failed to get instance for java instance method frame\n"); @@ -266,18 +266,18 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_instMeth(JNIEnv *env, jobject i JNIEXPORT void JNICALL Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_getMeth(JNIEnv *env, jclass cls) { jvmtiError err; - jobject obj = NULL; + jobject obj = nullptr; printf("\n Native getMeth: started\n"); - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; } mid = env->GetStaticMethodID(cls, "staticMeth", "(I)I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for staticMeth\n"); result = STATUS_FAILED; return; @@ -291,7 +291,7 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_getMeth(JNIEnv *env, jclass cls return; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable metod exit event: %s (%d)\n", TranslateError(err), err); @@ -299,7 +299,7 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_getMeth(JNIEnv *env, jclass cls } // Test GetLocalInstance with native static method getMeth() frame - err = jvmti->GetLocalInstance(NULL, 0, &obj); + err = jvmti->GetLocalInstance(nullptr, 0, &obj); printf(" Native getMeth: GetLocalInstance: %s (%d)\n", TranslateError(err), err); if (err != JVMTI_ERROR_INVALID_SLOT) { printf("FAIL: GetLocalInstance failed to return JVMTI_ERROR_INVALID_SLOT for native static method frame\n"); @@ -307,7 +307,7 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_getMeth(JNIEnv *env, jclass cls } // Test GetLocalInstance with java static method run() frame - err = jvmti->GetLocalInstance(NULL, 1, &obj); + err = jvmti->GetLocalInstance(nullptr, 1, &obj); printf(" Native getMeth: GetLocalInstance: %s (%d)\n", TranslateError(err), err); if (err != JVMTI_ERROR_INVALID_SLOT) { printf("FAIL: GetLocalInstance failed to return JVMTI_ERROR_INVALID_SLOT for java static method frame\n"); @@ -329,7 +329,7 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_checkLoc(JNIEnv *env, jint i, j; int overlap = 0; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -337,7 +337,7 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_checkLoc(JNIEnv *env, printf("\n checkLoc: START\n"); mid = env->GetStaticMethodID(cls, "staticMeth", "(I)I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for staticMeth\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp index c63875c7da5..a74ca32f27b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = STATUS_PASSED; static jboolean printdump = JNI_FALSE; @@ -61,12 +61,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; static jvmtiCapabilities caps; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -105,16 +105,16 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_nsk_jvmti_unit_GetLocalVariable_getlocal004_getMeth(JNIEnv *env, jclass cls) { - jmethodID mid = NULL; + jmethodID mid = nullptr; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; } mid = env->GetStaticMethodID(cls, "staticMeth", "(I)I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for staticMeth\n"); result = STATUS_FAILED; return; @@ -156,7 +156,7 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal004_checkLoc(JNIEnv *env, jlong locLong = 0L; jdouble locDouble = 0.0f; - if (jvmti == NULL) { + if (jvmti == nullptr) { return; } printf("\n ----------------- checkLoc: %d -----------------\n\n", scope_no); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/IsSynthetic/issynth001/issynth001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/IsSynthetic/issynth001/issynth001.cpp index 7587d47178b..8ebe8508577 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/IsSynthetic/issynth001/issynth001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/IsSynthetic/issynth001/issynth001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define JVM_ACC_SYNTHETIC 0x1000 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -54,12 +54,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -102,9 +102,9 @@ checkClassMethods(jclass klass) { jmethodID mid; jboolean isSynthetic; jint meth_cnt = 0; - jmethodID* methods_ptr = NULL; - char* name_ptr = NULL; - char* sign_ptr = NULL; + jmethodID* methods_ptr = nullptr; + char* name_ptr = nullptr; + char* sign_ptr = nullptr; int i; err = jvmti->GetClassMethods(klass, &meth_cnt, &methods_ptr); @@ -118,7 +118,7 @@ checkClassMethods(jclass klass) { jint mods; mid = methods_ptr[i]; err = jvmti->GetMethodName(mid, &name_ptr, - &sign_ptr, (char **) NULL); + &sign_ptr, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(GetMethodName#%d) unexpected error: %s (%d)\n", i, TranslateError(err), err); @@ -160,12 +160,12 @@ checkClassFields(jclass klass) { jfieldID fid; jboolean isSynthetic; jint fld_cnt = 0; - jfieldID* fields_ptr = NULL; - char* name_ptr = NULL; - char* sign_ptr = NULL; + jfieldID* fields_ptr = nullptr; + char* name_ptr = nullptr; + char* sign_ptr = nullptr; int i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -181,7 +181,7 @@ checkClassFields(jclass klass) { jint mods; fid = fields_ptr[i]; err = jvmti->GetFieldName(klass, fid, &name_ptr, - &sign_ptr, (char **) NULL); + &sign_ptr, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(GetFieldName#%d) unexpected error: %s (%d)\n", i, TranslateError(err), err); @@ -222,13 +222,13 @@ Java_nsk_jvmti_unit_IsSynthetic_issynth001_check(JNIEnv *env, jclass cls, jclass klass) { jvmtiError err; - char* class_sign = NULL; + char* class_sign = nullptr; if (!caps.can_get_synthetic_attribute) { return result; } - err = jvmti->GetClassSignature(cls, &class_sign, (char **) NULL); + err = jvmti->GetClassSignature(cls, &class_sign, nullptr); if (err != JVMTI_ERROR_NONE) { printf("GetSourceFileName unexpected error: %s (%d)\n", TranslateError(err), err); @@ -249,7 +249,7 @@ Java_nsk_jvmti_unit_IsSynthetic_issynth001_check(JNIEnv *env, return result; } - err = jvmti->GetClassSignature(klass, &class_sign, (char **) NULL); + err = jvmti->GetClassSignature(klass, &class_sign, nullptr); if (err != JVMTI_ERROR_NONE) { printf("GetSourceFileName unexpected error: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/MethodBind/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/MethodBind/JvmtiTest/JvmtiTest.cpp index a70807450d6..b68e220470b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/MethodBind/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/MethodBind/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -77,7 +77,7 @@ findLoadClass_type findLoadedClass_func; JNIEXPORT jclass JNICALL my_findLoadedClass(JNIEnv *env, jobject loader, jstring name) { - const char* sname = env->GetStringUTFChars(name, NULL); + const char* sname = env->GetStringUTFChars(name, nullptr); debug_printf("Intercepted findLoadedClass, name = %s\n", sname); return (*findLoadedClass_func)(env, loader, name); } @@ -102,7 +102,7 @@ void JNICALL testNativeMethodBind(jvmtiEnv* jvmti_env, JNIEnv *jni_env, debug_printf("bind event: \n"); print_method_name(mid); - ret = jvmti_env->GetMethodName(mid, &mname, &signature, NULL); + ret = jvmti_env->GetMethodName(mid, &mname, &signature, nullptr); if (ret == JVMTI_ERROR_NONE) { if (strcmp(mname, "findLoadedClass") == 0) { findLoadedClass_func = (findLoadClass_type)func; @@ -161,13 +161,13 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for vm death event returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for native method bind event returned error", res); return JNI_OK; @@ -275,14 +275,14 @@ print_method_name(jmethodID mid) { return; } - ret = jvmti->GetClassSignature(klass, &clname, NULL); + ret = jvmti->GetClassSignature(klass, &clname, nullptr); if (ret != JVMTI_ERROR_NONE) { printf("Error: GetClassSignature %d \n", ret); iGlobalStatus = 2; return; } - ret = jvmti->GetMethodName(mid, &mname, &signature, NULL); + ret = jvmti->GetMethodName(mid, &mname, &signature, nullptr); if (ret != JVMTI_ERROR_NONE) { printf("Error: GetMethodName %d \n", ret); iGlobalStatus = 2; @@ -296,7 +296,7 @@ print_method_name(jmethodID mid) { JNIEXPORT void JNICALL Java_nsk_jvmti_unit_MethodBind_JvmtiTest_GetStackTrace(JNIEnv * env, jclass cls, jobject thr) { jvmtiError ret; - jvmtiFrameInfo *stack_buffer = NULL; + jvmtiFrameInfo *stack_buffer = nullptr; jint max_count = 20; jint count; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/StackTrace/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/StackTrace/JvmtiTest/JvmtiTest.cpp index 572ff53c5ef..fbaf0fa1816 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/StackTrace/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/StackTrace/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -195,8 +195,8 @@ Java_nsk_jvmti_unit_StackTrace_JvmtiTest_GetFrameCount(JNIEnv * env, jclass cls, JNIEXPORT void JNICALL Java_nsk_jvmti_unit_StackTrace_JvmtiTest_GetStackTrace(JNIEnv * env, jclass cls, jobject thr) { jvmtiError ret; - jvmtiFrameInfo *stack_buffer = NULL; - jvmtiFrameInfo *compare_buffer = NULL; + jvmtiFrameInfo *stack_buffer = nullptr; + jvmtiFrameInfo *compare_buffer = nullptr; jint max_count = 20; jint count; jclass klass; @@ -291,14 +291,14 @@ Java_nsk_jvmti_unit_StackTrace_JvmtiTest_GetStackTrace(JNIEnv * env, jclass cls, return; } - ret = jvmti->GetClassSignature(klass, &clname, NULL); + ret = jvmti->GetClassSignature(klass, &clname, nullptr); if (ret != JVMTI_ERROR_NONE) { printf("Error: GetClassSignature %d \n", ret); iGlobalStatus = 2; return; } - ret = jvmti->GetMethodName(stack_buffer[i].method, &mname, &signature, NULL); + ret = jvmti->GetMethodName(stack_buffer[i].method, &mname, &signature, nullptr); if (ret != JVMTI_ERROR_NONE) { printf("Error: GetMethodName %d \n", ret); iGlobalStatus = 2; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/agentthr/agentthr.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/agentthr/agentthr.cpp index 58e2cfe9498..17e7f517923 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/agentthr/agentthr.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/agentthr/agentthr.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 static JavaVM *jvm_ins; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -121,13 +121,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } jvm_ins = jvm; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -140,7 +140,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/clsldrclss00x/clsldrclss00x.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/clsldrclss00x/clsldrclss00x.cpp index 2efbf140649..c1adeb386ff 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/clsldrclss00x/clsldrclss00x.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/clsldrclss00x/clsldrclss00x.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_clsldrclss00x(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -74,7 +74,7 @@ Java_nsk_jvmti_unit_clsldrclss00x_check(JNIEnv *env, jclass appCls, jclass objCl jboolean found; jint i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -86,8 +86,8 @@ Java_nsk_jvmti_unit_clsldrclss00x_check(JNIEnv *env, jclass appCls, jclass objCl result = STATUS_FAILED; return result; } - if (appClassloader == NULL) { - printf("(GetClassLoader app) unexpected loader - NULL\n"); + if (appClassloader == nullptr) { + printf("(GetClassLoader app) unexpected loader - null\n"); result = STATUS_FAILED; return result; } @@ -99,8 +99,8 @@ Java_nsk_jvmti_unit_clsldrclss00x_check(JNIEnv *env, jclass appCls, jclass objCl result = STATUS_FAILED; return result; } - if (objClassloader != NULL) { - printf("(GetClassLoader obj) unexpected loader - !NULL\n"); + if (objClassloader != nullptr) { + printf("(GetClassLoader obj) unexpected loader - !null\n"); result = STATUS_FAILED; return result; } @@ -117,7 +117,7 @@ Java_nsk_jvmti_unit_clsldrclss00x_check(JNIEnv *env, jclass appCls, jclass objCl for (i = 0; i < classCount; ++i) { char *classSig; jclass k = classes[i]; - err = jvmti->GetClassSignature(k, &classSig, NULL); + err = jvmti->GetClassSignature(k, &classSig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Error (getClassSignature): %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp index 37ba70728c1..59ed1561bb2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { #define STATUS_FAILED 2 #define PASSED 0 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -63,12 +63,12 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *env, char *sig; char *gen; - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { if (printdump == JNI_TRUE) { printf("Received class file load hook event for class %s\n", name); } - if (redefined_class != NULL) { + if (redefined_class != nullptr) { err = jvmti->GetClassSignature(redefined_class, &sig, &gen); if (err != JVMTI_ERROR_NONE) { printf("(GetClassSignature) unexpected error: %s (%d)\n", @@ -106,7 +106,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } @@ -150,14 +150,14 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable event JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable event JVMTI_EVENT_CLASS_FILE_LOAD_HOOK: %s (%d)\n", TranslateError(err), err); @@ -173,7 +173,7 @@ Java_nsk_jvmti_unit_events_redefineCFLH_JvmtiTest_makeRedefinition(JNIEnv *env, jvmtiClassDefinition classDef; jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -185,7 +185,7 @@ Java_nsk_jvmti_unit_events_redefineCFLH_JvmtiTest_makeRedefinition(JNIEnv *env, /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (fl == 2) { printf(">>>>>>>> Invoke RedefineClasses():\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/extmech/extmech.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/extmech/extmech.cpp index 4d7b9868670..3dfa394efc5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/extmech/extmech.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/extmech/extmech.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -100,7 +100,7 @@ Java_nsk_jvmti_unit_extmech_enableClassUnloadEvent if (strcmp(ext_events[i].id, (char*)"com.sun.hotspot.events.ClassUnload") == 0) { err = jvmti->SetExtensionEventCallback(ext_events[i].extension_event_index, - enable ? (jvmtiExtensionEvent)ClassUnload : NULL); + enable ? (jvmtiExtensionEvent)ClassUnload : nullptr); if (err != JVMTI_ERROR_NONE) { fprintf(stderr, "SetExtenionEventCallback failed: %d\n", err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/AddToBootstrapClassLoaderSearch/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/AddToBootstrapClassLoaderSearch/JvmtiTest/JvmtiTest.cpp index 4d38e540d87..1ef592cd959 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/AddToBootstrapClassLoaderSearch/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/AddToBootstrapClassLoaderSearch/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -143,13 +143,13 @@ classFileLoadEvent(jvmtiEnv *jvmti_env, JNIEnv *env, jint* new_class_data_len, unsigned char** new_class_data) { - if (name != NULL && (strcmp(name, BOOT_CLASS) == 0)) { + if (name != nullptr && (strcmp(name, BOOT_CLASS) == 0)) { debug_printf("Received class file load hook event for class: \n\t%s\n", name); debug_printf("Received class loader: 0x%p \n", loader); /* Check to make sure Boot class got loaded from bootstrap class path.*/ - if (loader == NULL) { + if (loader == nullptr) { boot_class_count++; } } @@ -192,7 +192,7 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { strncpy(segment, options, (size_t) sizeof(segment)/sizeof(char)); segment[(size_t) sizeof(segment)/sizeof(char) - 1] = 0; idx = strchr(segment, ','); - if (idx != NULL) *idx = 0; + if (idx != nullptr) *idx = 0; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); @@ -214,19 +214,19 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_START returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for NATIVE_METHOD_BIND returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_DEATH returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode CLASS_FILE_LOAD_HOOK returned error", res); strcat(segment, "/newclass"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/Dispose/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/Dispose/JvmtiTest/JvmtiTest.cpp index f85d438a68a..24066525e63 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/Dispose/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/Dispose/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -115,7 +115,7 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { JVMTI_ERROR_CHECK("GetAddCapabilities returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res); res = jvmti->GetSystemProperties(&count, &properties); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/ForceGarbageCollection/gc/gc.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/ForceGarbageCollection/gc/gc.cpp index f3ff582ea8d..e1c57fa08d2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/ForceGarbageCollection/gc/gc.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/ForceGarbageCollection/gc/gc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -134,16 +134,16 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for vm death event returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for gc start returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for gc finish returned error", res); return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendMonitorInfo/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendMonitorInfo/JvmtiTest/JvmtiTest.cpp index 4c0e6fbbc6b..66799c3d004 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendMonitorInfo/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendMonitorInfo/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -134,10 +134,10 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for vm death event returned error", res); return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendStackTrace/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendStackTrace/JvmtiTest/JvmtiTest.cpp index c3934dd0b90..432045f98e2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendStackTrace/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendStackTrace/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -133,10 +133,10 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for vm death event returned error", res); return JNI_OK; @@ -233,7 +233,7 @@ Java_nsk_jvmti_unit_functions_nosuspendStackTrace_JvmtiTest_GetFrameCount(JNIEnv JNIEXPORT void JNICALL Java_nsk_jvmti_unit_functions_nosuspendStackTrace_JvmtiTest_GetStackTrace(JNIEnv * env, jclass cls, jobject thr) { jvmtiError ret; - jvmtiFrameInfo *stack_buffer = NULL; + jvmtiFrameInfo *stack_buffer = nullptr; jint count = 20; jclass klass; char *mname; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/rawmonitor/rawmonitor.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/rawmonitor/rawmonitor.cpp index b7df38f8ecc..55267f99ead 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/rawmonitor/rawmonitor.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/rawmonitor/rawmonitor.cpp @@ -1,6 +1,6 @@ /* s - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -222,13 +222,13 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for vm death event returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode CLASS_FILE_LOAD_HOOK returned error", res); /* acquire lock in onload */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/heapref/heapref.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/heapref/heapref.cpp index 640779eb75c..bab6bfbbfca 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/heapref/heapref.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/heapref/heapref.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jvmtiCapabilities jvmti_caps; @@ -70,8 +70,8 @@ typedef struct _refLink { struct _refLink *next; } refLink; -static MyTag *fakeRoot = NULL; -static MyTag *missed = NULL; +static MyTag *fakeRoot = nullptr; +static MyTag *missed = nullptr; static void breakpoint() { printf("Continuing from BREAKPOINT\n"); @@ -82,10 +82,10 @@ static MyTag *newTag(refKind kind, jlong size, const char* name) { static jlong seq_num = 0; - MyTag* new_tag = NULL; + MyTag* new_tag = nullptr; new_tag = (MyTag*) malloc(sizeof(MyTag)); - if (NULL == new_tag) { + if (nullptr == new_tag) { printf("Error (newTag malloc): failed\n"); result = STATUS_FAILED; } @@ -95,7 +95,7 @@ static MyTag *newTag(refKind kind, new_tag->sequence = ++seq_num; new_tag->visited = JNI_FALSE; new_tag->name = name; - new_tag->ref = NULL; + new_tag->ref = nullptr; return new_tag; } @@ -103,11 +103,11 @@ static void setTag(JNIEnv *env, jobject obj, refKind kind, const char* name) { - MyTag *new_tag = NULL; - MyTag *class_tag = NULL; + MyTag *new_tag = nullptr; + MyTag *class_tag = nullptr; jvmtiError err; jlong size = 0; - jclass obj_class = NULL; + jclass obj_class = nullptr; jlong haba = 0; err = jvmti->GetObjectSize(obj, &size); @@ -124,7 +124,7 @@ static void setTag(JNIEnv *env, printf("Error (GetTag): %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; } - if (class_tag != NULL && class_tag->kind != rclass) { + if (class_tag != nullptr && class_tag->kind != rclass) { printf("Error class tag which is not a class\n"); result = STATUS_FAILED; } @@ -142,7 +142,7 @@ static void addRef(MyTag *from, int reference_kind, MyTag *to) { refLink *new_ref; new_ref = (refLink*) malloc(sizeof(refLink)); - if (NULL == new_ref) { + if (nullptr == new_ref) { printf("Error (addRef malloc): failed\n"); result = STATUS_FAILED; } @@ -215,7 +215,7 @@ static void walk(MyTag* tag, jint depth, const char* ref_label) { const char *indent = spaces + (len - 2 * depth); const MyTag* const ctag = tag->class_tag; - const char* const cname = ctag != NULL ? ctag->name : ""; + const char* const cname = ctag != nullptr ? ctag->name : ""; printf("%s", indent); @@ -258,12 +258,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -281,7 +281,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiIterationControl JNICALL heapMarkCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) { - const MyTag* const tag = newTag(rmark, (const MyTag*)(intptr_t)class_tag, size, NULL); + const MyTag* const tag = newTag(rmark, (const MyTag*)(intptr_t)class_tag, size, nullptr); *tag_ptr = (intptr_t)tag; if (user_data != &dummy_user_data && user_data_error_flag == JNI_FALSE) { @@ -300,7 +300,7 @@ heapRootCallback(jvmtiHeapRootKind root_kind, if (0 == *tag_ptr) { /* new tag */ - MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, NULL); + MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, nullptr); addRef(fakeRoot, HEAP_ROOT_REF_KIND_BASE+root_kind, tag); *tag_ptr = (intptr_t)tag; } else { @@ -326,7 +326,7 @@ stackReferenceCallback(jvmtiHeapRootKind root_kind, if (0 == *tag_ptr) { /* new tag */ - MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, NULL); + MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, nullptr); addRef(fakeRoot, HEAP_ROOT_REF_KIND_BASE+root_kind, tag); *tag_ptr = (intptr_t)tag; } else { @@ -347,7 +347,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, jlong* tag_ptr, jlong referrer_tag, jint referrer_index, void* user_data) { refKind kind = rother; - MyTag* referrer = NULL; + MyTag* referrer = nullptr; if (0 == referrer_tag) { referrer = missed; @@ -357,7 +357,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, if (0 == *tag_ptr) { /* new tag */ - MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, NULL); + MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, nullptr); addRef(referrer, reference_kind, tag); *tag_ptr = (intptr_t) tag; } else { @@ -382,13 +382,13 @@ Java_nsk_jvmti_unit_heapref_check(JNIEnv *env, jclass cls) { jint threadCount = 0; jint i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } - fakeRoot = newTag(rother, (const MyTag *)NULL, 0, "FAKE_ROOT"); - missed = newTag(rother, (const MyTag *)NULL, 0, "MISSED"); + fakeRoot = newTag(rother, nullptr, 0, "FAKE_ROOT"); + missed = newTag(rother, nullptr, 0, "MISSED"); if (env->PushLocalFrame(500) != 0) { printf("Error (PushLocalFrame): failed\n"); @@ -404,7 +404,7 @@ Java_nsk_jvmti_unit_heapref_check(JNIEnv *env, jclass cls) { for (i = 0; i < classCount; ++i) { char *classSig; jclass k = classes[i]; - err = jvmti->GetClassSignature(k, &classSig, NULL); + err = jvmti->GetClassSignature(k, &classSig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Error (getClassSignature): %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; @@ -414,7 +414,7 @@ Java_nsk_jvmti_unit_heapref_check(JNIEnv *env, jclass cls) { if (classSig[len-1] == ';') { classSig[len-1] = 0; } - if (*classSig == 'L' && slash != NULL) { + if (*classSig == 'L' && slash != nullptr) { classSig = slash + 1; } setTag(env, k, rclass, (const char*)classSig); @@ -439,7 +439,7 @@ Java_nsk_jvmti_unit_heapref_check(JNIEnv *env, jclass cls) { } } - env->PopLocalFrame(NULL); + env->PopLocalFrame(nullptr); user_data_error_flag = JNI_FALSE; err = jvmti->IterateOverHeap( diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/refignore/refignore.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/refignore/refignore.cpp index bdf8f3b368d..eb840e39061 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/refignore/refignore.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/refignore/refignore.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jvmtiCapabilities jvmti_caps; @@ -70,8 +70,8 @@ typedef struct _refLink { struct _refLink *next; } refLink; -static MyTag *fakeRoot = NULL; -static MyTag *missed = NULL; +static MyTag *fakeRoot = nullptr; +static MyTag *missed = nullptr; static void breakpoint() { printf("Continuing from BREAKPOINT\n"); @@ -82,10 +82,10 @@ static MyTag *newTag(refKind kind, jlong size, const char* name) { static jlong seq_num = 0; - MyTag* new_tag = NULL; + MyTag* new_tag = nullptr; new_tag = (MyTag*) malloc(sizeof(MyTag)); - if (NULL == new_tag) { + if (nullptr == new_tag) { printf("Error (newTag malloc): failed\n"); result = STATUS_FAILED; } @@ -95,7 +95,7 @@ static MyTag *newTag(refKind kind, new_tag->sequence = ++seq_num; new_tag->visited = JNI_FALSE; new_tag->name = name; - new_tag->ref = NULL; + new_tag->ref = nullptr; return new_tag; } @@ -103,11 +103,11 @@ static void setTag(JNIEnv *env, jobject obj, refKind kind, const char* name) { - MyTag *new_tag = NULL; - MyTag *class_tag = NULL; + MyTag *new_tag = nullptr; + MyTag *class_tag = nullptr; jvmtiError err; jlong size = 0; - jclass obj_class = NULL; + jclass obj_class = nullptr; jlong haba = 0; err = jvmti->GetObjectSize(obj, &size); @@ -124,7 +124,7 @@ static void setTag(JNIEnv *env, printf("Error (GetTag): %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; } - if (class_tag != NULL && class_tag->kind != rclass) { + if (class_tag != nullptr && class_tag->kind != rclass) { printf("Error class tag which is not a class\n"); result = STATUS_FAILED; } @@ -142,7 +142,7 @@ static void addRef(MyTag *from, int reference_kind, MyTag *to) { refLink *new_ref; new_ref = (refLink*) malloc(sizeof(refLink)); - if (NULL == new_ref) { + if (nullptr == new_ref) { printf("Error (addRef malloc): failed\n"); result = STATUS_FAILED; } @@ -215,7 +215,7 @@ static void walk(MyTag* tag, jint depth, const char* ref_label) { const char *indent = spaces + (len - 2 * depth); const MyTag* const ctag = tag->class_tag; - const char* const cname = ctag != NULL ? ctag->name : ""; + const char* const cname = ctag != nullptr ? ctag->name : ""; printf("%s", indent); @@ -256,12 +256,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -279,7 +279,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiIterationControl JNICALL heapMarkCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) { - const MyTag* const tag = newTag(rmark, (const MyTag*)(intptr_t)class_tag, size, NULL); + const MyTag* const tag = newTag(rmark, (const MyTag*)(intptr_t)class_tag, size, nullptr); *tag_ptr = (intptr_t)tag; if (user_data != &dummy_user_data && user_data_error_flag == JNI_FALSE) { @@ -298,7 +298,7 @@ heapRootCallback(jvmtiHeapRootKind root_kind, if (0 == *tag_ptr) { /* new tag */ - MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, NULL); + MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, nullptr); addRef(fakeRoot, HEAP_ROOT_REF_KIND_BASE+root_kind, tag); *tag_ptr = (intptr_t)tag; } else { @@ -324,7 +324,7 @@ stackReferenceCallback(jvmtiHeapRootKind root_kind, if (0 == *tag_ptr) { /* new tag */ - MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, NULL); + MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, nullptr); addRef(fakeRoot, HEAP_ROOT_REF_KIND_BASE+root_kind, tag); *tag_ptr = (intptr_t)tag; } else { @@ -345,7 +345,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, jlong* tag_ptr, jlong referrer_tag, jint referrer_index, void* user_data) { refKind kind = rother; - MyTag* referrer = NULL; + MyTag* referrer = nullptr; if (0 == referrer_tag) { referrer = missed; @@ -355,7 +355,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, if (0 == *tag_ptr) { /* new tag */ - MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, NULL); + MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, nullptr); addRef(referrer, reference_kind, tag); *tag_ptr = (intptr_t) tag; } else { @@ -380,13 +380,13 @@ Java_nsk_jvmti_unit_refignore_check(JNIEnv *env, jclass cls) { jint threadCount = 0; jint i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } - fakeRoot = newTag(rother, (const MyTag *)NULL, 0, "FAKE_ROOT"); - missed = newTag(rother, (const MyTag *)NULL, 0, "MISSED"); + fakeRoot = newTag(rother, nullptr, 0, "FAKE_ROOT"); + missed = newTag(rother, nullptr, 0, "MISSED"); if (env->PushLocalFrame(500) != 0) { printf("Error (PushLocalFrame): failed\n"); @@ -402,7 +402,7 @@ Java_nsk_jvmti_unit_refignore_check(JNIEnv *env, jclass cls) { for (i = 0; i < classCount; ++i) { char *classSig; jclass k = classes[i]; - err = jvmti->GetClassSignature(k, &classSig, NULL); + err = jvmti->GetClassSignature(k, &classSig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Error (getClassSignature): %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; @@ -412,7 +412,7 @@ Java_nsk_jvmti_unit_refignore_check(JNIEnv *env, jclass cls) { if (classSig[len-1] == ';') { classSig[len-1] = 0; } - if (*classSig == 'L' && slash != NULL) { + if (*classSig == 'L' && slash != nullptr) { classSig = slash + 1; } setTag(env, k, rclass, (const char*)classSig); @@ -437,7 +437,7 @@ Java_nsk_jvmti_unit_refignore_check(JNIEnv *env, jclass cls) { } } - env->PopLocalFrame(NULL); + env->PopLocalFrame(nullptr); user_data_error_flag = JNI_FALSE; err = jvmti->IterateOverHeap( diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/setNullVMInit/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/setNullVMInit/JvmtiTest/JvmtiTest.cpp index f670dfafbb5..1ce5facd4eb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/setNullVMInit/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/setNullVMInit/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ VMInit initial thread arg. SetThreadLocalStorage and SetEnvironmentLocalStorage should allow - value to be set to NULL. + value to be set to nullptr. */ #include @@ -105,13 +105,13 @@ void check_val(intptr_t x, intptr_t y, const char* msg) { void JNICALL vmInit(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread) { check_val(get_thread_local(thread), 0, "thread initial"); - check_val(get_thread_local(NULL), 0, "thread initial"); + check_val(get_thread_local(nullptr), 0, "thread initial"); set_thread_local(thread, 35); check_val(get_thread_local(thread), 35, "thread set non-zero"); - check_val(get_thread_local(NULL), 35, "thread set non-zero"); - set_thread_local(NULL, 0); + check_val(get_thread_local(nullptr), 35, "thread set non-zero"); + set_thread_local(nullptr, 0); check_val(get_thread_local(thread), 0, "thread set zero"); - check_val(get_thread_local(NULL), 0, "thread set zero"); + check_val(get_thread_local(nullptr), 0, "thread set zero"); check_val(get_env_local(), 14, "env set non-zero"); set_env_local(77); @@ -161,7 +161,7 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT,NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT,nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res); return JNI_OK; @@ -175,7 +175,7 @@ Java_nsk_jvmti_unit_setNullVMInit_JvmtiTest_check(JNIEnv *env, jclass cls) { set_env_local(0); check_val(get_env_local(), 0, "env reset to zero"); - check_val(get_thread_local(NULL), 0, "thread check"); + check_val(get_thread_local(nullptr), 0, "thread check"); return iGlobalStatus; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.cpp index d9be94340e7..b903de9b7ec 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -143,10 +143,10 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); JVMTI_ERROR_CHECK_DURING_ONLOAD("SetEventCallbacks returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); JVMTI_ERROR_CHECK_DURING_ONLOAD("SetEventNotificationMode for VM_INIT returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); JVMTI_ERROR_CHECK_DURING_ONLOAD("SetEventNotificationMode for vm death event returned error", res); return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.cpp b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.cpp index 5b907b42a7e..3e46cc25368 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ extern "C" { #define GET_OBJECT_CLASS(_class, _obj)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->GetObjectClass(_obj)) != NULL))\ + env->GetObjectClass(_obj)) != nullptr))\ return 2 #define CALL_STATIC_VOID_NOPARAM(_class, _methodName)\ @@ -39,12 +39,12 @@ extern "C" { #define GET_STATIC_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetStaticMethodID(_class, _methodName, _sig)) != NULL))\ + env->GetStaticMethodID(_class, _methodName, _sig)) != nullptr))\ return 2 #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetMethodID(_class, _methodName, _sig)) != NULL))\ + env->GetMethodID(_class, _methodName, _sig)) != nullptr))\ return 2 #define CALL_VOID_NOPARAM(_obj, _class, _methodName)\ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp index 3e8530d0ecc..e5fbc02b46d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,17 +31,17 @@ extern "C" { #define FIND_CLASS(_class, _className)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->FindClass(_className)) != NULL))\ + env->FindClass(_className)) != nullptr))\ return #define GET_OBJECT_CLASS(_class, _obj)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->GetObjectClass(_obj)) != NULL))\ + env->GetObjectClass(_obj)) != nullptr))\ return #define GET_STATIC_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\ if (!NSK_JNI_VERIFY(env, (_fieldID = \ - env->GetStaticFieldID(_class, _fieldName, _fieldSig)) != NULL))\ + env->GetStaticFieldID(_class, _fieldName, _fieldSig)) != nullptr))\ return #define GET_STATIC_OBJ_FIELD(_value, _class, _fieldName, _fieldSig)\ @@ -54,7 +54,7 @@ extern "C" { #define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\ if (!NSK_JNI_VERIFY(env, (_fieldID = \ - env->GetFieldID(_class, _fieldName, _fieldSig)) != NULL))\ + env->GetFieldID(_class, _fieldName, _fieldSig)) != nullptr))\ return #define GET_INT_FIELD(_value, _obj, _class, _fieldName)\ @@ -90,12 +90,12 @@ extern "C" { #define GET_STATIC_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetStaticMethodID(_class, _methodName, _sig)) != NULL))\ + env->GetStaticMethodID(_class, _methodName, _sig)) != nullptr))\ return #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetMethodID(_class, _methodName, _sig)) != NULL))\ + env->GetMethodID(_class, _methodName, _sig)) != nullptr))\ return #define CALL_STATIC_VOID_NOPARAM(_class, _methodName)\ @@ -134,7 +134,7 @@ extern "C" { #define NEW_OBJ(_obj, _class, _constructorName, _sig, _params)\ GET_METHOD_ID(method, _class, _constructorName, _sig);\ if (!NSK_JNI_VERIFY(env, (_obj = \ - env->NewObject(_class, method, _params)) != NULL))\ + env->NewObject(_class, method, _params)) != nullptr))\ return #define MONITOR_ENTER(x) \ @@ -487,23 +487,23 @@ extern "C" { jint state; if (!NSK_VERIFY(env->GetJavaVM(&vm) == 0)) { - return NULL; + return nullptr; } if (!NSK_VERIFY(vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1) == JNI_OK)) { - return NULL; + return nullptr; } if (!NSK_VERIFY(jvmti->GetThreadState((jthread)thread, &state) == JVMTI_ERROR_NONE)) { - return NULL; + return nullptr; } stateName = getStateName(env, state); - if (!NSK_JNI_VERIFY(env, (ThreadState = env->FindClass("java/lang/Thread$State")) != NULL)) - return NULL; + if (!NSK_JNI_VERIFY(env, (ThreadState = env->FindClass("java/lang/Thread$State")) != nullptr)) + return nullptr; - if (!NSK_JNI_VERIFY(env, (method = env->GetStaticMethodID(ThreadState, "valueOf", "(Ljava/lang/String;)Ljava/lang/Thread$State;")) != NULL)) - return NULL; + if (!NSK_JNI_VERIFY(env, (method = env->GetStaticMethodID(ThreadState, "valueOf", "(Ljava/lang/String;)Ljava/lang/Thread$State;")) != nullptr)) + return nullptr; threadState = env->CallStaticObjectMethod(ThreadState, method, stateName); return threadState; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.cpp b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.cpp index 6e2c066b94e..5c9a22e2464 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,12 +27,12 @@ extern "C" { #define FIND_CLASS(_class, _className)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->FindClass(_className)) != NULL))\ + env->FindClass(_className)) != nullptr))\ return #define GET_OBJECT_CLASS(_class, _obj)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->GetObjectClass(_obj)) != NULL))\ + env->GetObjectClass(_obj)) != nullptr))\ return #define GET_OBJ_FIELD(_value, _obj, _class, _fieldName, _fieldSig)\ @@ -41,12 +41,12 @@ extern "C" { #define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\ if (!NSK_JNI_VERIFY(env, (_fieldID = \ - env->GetFieldID(_class, _fieldName, _fieldSig)) != NULL))\ + env->GetFieldID(_class, _fieldName, _fieldSig)) != nullptr))\ return #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetMethodID(_class, _methodName, _sig)) != NULL)) \ + env->GetMethodID(_class, _methodName, _sig)) != nullptr)) \ return #define CALL_VOID_NOPARAM(_obj, _class, _methodName)\ @@ -72,23 +72,23 @@ JNIEXPORT void JNICALL Java_nsk_monitoring_share_thread_Deadlock_00024NativeLock FIND_CLASS(testBugClass, "nsk/share/TestBug"); GET_OBJ_FIELD(lock, o, nativeLockerClass, "lock", "Ljava/lang/Object;"); GET_OBJ_FIELD(step1, o, nativeLockerClass, "step1", "Lnsk/share/Wicket;"); - if (step1 == NULL) { + if (step1 == nullptr) { env->ThrowNew(testBugClass, "step1 field is null"); return; } GET_OBJ_FIELD(step2, o, nativeLockerClass, "step2", "Lnsk/share/Wicket;"); - if (step2 == NULL) { + if (step2 == nullptr) { env->ThrowNew(testBugClass, "step2 field is null"); return; } GET_OBJ_FIELD(step3, o, nativeLockerClass, "step3", "Lnsk/share/Wicket;"); - if (step3 == NULL) { + if (step3 == nullptr) { env->ThrowNew(testBugClass, "step3 field is null"); return; } GET_OBJ_FIELD(inner, o, lockerClass, "inner", "Lnsk/monitoring/share/thread/Deadlock$Locker;"); if (env->MonitorEnter(lock) == JNI_OK) { - if (inner == NULL) { + if (inner == nullptr) { env->ThrowNew(testBugClass, "Should not reach here"); } else { CALL_VOID_NOPARAM(step1, wicketClass, "unlock"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.cpp b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.cpp index c8870989fa6..604b0620c5b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,12 +27,12 @@ extern "C" { #define FIND_CLASS(_class, _className)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->FindClass(_className)) != NULL))\ + env->FindClass(_className)) != nullptr))\ return #define GET_OBJECT_CLASS(_class, _obj)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->GetObjectClass(_obj)) != NULL))\ + env->GetObjectClass(_obj)) != nullptr))\ return #define GET_OBJ_FIELD(_value, _obj, _class, _fieldName, _fieldSig)\ @@ -41,12 +41,12 @@ extern "C" { #define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\ if (!NSK_JNI_VERIFY(env, (_fieldID = \ - env->GetFieldID(_class, _fieldName, _fieldSig)) != NULL))\ + env->GetFieldID(_class, _fieldName, _fieldSig)) != nullptr))\ return #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetMethodID(_class, _methodName, _sig)) != NULL))\ + env->GetMethodID(_class, _methodName, _sig)) != nullptr))\ return #define CALL_VOID_NOPARAM(_obj, _class, _methodName)\ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.cpp b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.cpp index d5349b037ff..6926c8f712e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,17 +29,17 @@ extern "C" { #define FIND_CLASS(_class, _className)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->FindClass(_className)) != NULL))\ + env->FindClass(_className)) != nullptr))\ return #define GET_OBJECT_CLASS(_class, _obj)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->GetObjectClass(_obj)) != NULL))\ + env->GetObjectClass(_obj)) != nullptr))\ return #define GET_STATIC_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\ if (!NSK_JNI_VERIFY(env, (_fieldID = \ - env->GetStaticFieldID(_class, _fieldName, _fieldSig)) != NULL))\ + env->GetStaticFieldID(_class, _fieldName, _fieldSig)) != nullptr))\ return #define GET_STATIC_OBJ_FIELD(_value, _class, _fieldName, _fieldSig)\ @@ -52,7 +52,7 @@ extern "C" { #define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\ if (!NSK_JNI_VERIFY(env, (_fieldID = \ - env->GetFieldID(_class, _fieldName, _fieldSig)) != NULL))\ + env->GetFieldID(_class, _fieldName, _fieldSig)) != nullptr))\ return #define GET_INT_FIELD(_value, _obj, _class, _fieldName)\ @@ -84,12 +84,12 @@ extern "C" { #define GET_STATIC_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetStaticMethodID(_class, _methodName, _sig)) != NULL))\ + env->GetStaticMethodID(_class, _methodName, _sig)) != nullptr))\ return #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetMethodID(_class, _methodName, _sig)) != NULL))\ + env->GetMethodID(_class, _methodName, _sig)) != nullptr))\ return #define CALL_STATIC_VOID_NOPARAM(_class, _methodName)\ @@ -124,7 +124,7 @@ extern "C" { #define NEW_OBJ(_obj, _class, _constructorName, _sig, _params)\ GET_METHOD_ID(method, _class, _constructorName, _sig);\ if (!NSK_JNI_VERIFY(env, (_obj = \ - env->NewObject(_class, method, _params)) != NULL))\ + env->NewObject(_class, method, _params)) != nullptr))\ return #define MONITOR_ENTER(x) \ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/ExceptionCheckingJniEnv/exceptionjni001/exceptionjni001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/ExceptionCheckingJniEnv/exceptionjni001/exceptionjni001.cpp index 342ef4d2ccd..1c70c90388e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/ExceptionCheckingJniEnv/exceptionjni001/exceptionjni001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/ExceptionCheckingJniEnv/exceptionjni001/exceptionjni001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2019, Google and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -33,9 +33,9 @@ // methods. static bool is_error_called; static const char* const null_return_expected_message_start = - "JNI method GetFieldID : Return is NULL from exceptionjni001.cpp : "; + "JNI method GetFieldID : Return is null from exceptionjni001.cpp : "; static const char* const null_file_expected_message_start = - "JNI method GetFieldID : Return is NULL from Unknown File : "; + "JNI method GetFieldID : Return is null from Unknown File : "; // Used by the ErrorCheckerMessage and the tests to determine test success. static long expected_line_number; @@ -52,11 +52,11 @@ static bool CheckMessage(JNIEnv* env, const char* message, const char* expected_ size_t len = strlen(expected_message); - char* end_ptr = NULL; + char* end_ptr = nullptr; long actual_line = strtol(message + len, &end_ptr, 0); - if (end_ptr == NULL || *end_ptr != '\0') { - fprintf(stderr, "end_ptr == NULL or *end_ptr terminating from %s\n", message); + if (end_ptr == nullptr || *end_ptr != '\0') { + fprintf(stderr, "end_ptr == null or *end_ptr terminating from %s\n", message); return false; } @@ -101,7 +101,7 @@ static bool checkFailureMessageEmptyFile(JNIEnv* env, jclass cls) { expected_message_start = null_file_expected_message_start; expected_line_number = __LINE__ + 1; - ec_jni->GetFieldID(cls, "whatever", "does not matter", __LINE__, NULL); + ec_jni->GetFieldID(cls, "whatever", "does not matter", __LINE__, nullptr); return is_error_called && error_message_ok; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp index 69dc2da5b57..59395c6fcf6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ extern "C" { -static jvmtiEnv *jvmti = NULL; /* JVMTI env */ +static jvmtiEnv *jvmti = nullptr; /* JVMTI env */ static jvmtiEventCallbacks callbacks; static jrawMonitorID eventLock; /* raw monitor used for exclusive ownership of HotSwap function */ @@ -106,9 +106,9 @@ typedef struct { /* test class info */ } class_info; -static const char *shortTestName = NULL; /* name of the test without package prefix */ +static const char *shortTestName = nullptr; /* name of the test without package prefix */ static jclass rasCls; /* reference to the auxiliary class RASagent used for HotSwap */ -static class_info *clsInfo = NULL, *clsInfoFst = NULL; +static class_info *clsInfo = nullptr, *clsInfoFst = nullptr; static void lock(JNIEnv*); static void unlock(JNIEnv*); @@ -160,11 +160,11 @@ ClassLoad(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jclass klass) { lock(jni_env); display(0, "#### JVMTIagent: ClassLoad: >>>>>>>> entered the raw monitor \"eventLock\" ####\n"); - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &cls_sig, /*&generic*/NULL))) + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &cls_sig, /*&generic*/nullptr))) jni_env->FatalError("JVMTIagent: failed to get class signature\n"); else { - if (shortTestName != NULL) { - if (strstr((const char*) cls_sig, shortTestName) != NULL) { + if (shortTestName != nullptr) { + if (strstr((const char*) cls_sig, shortTestName) != nullptr) { display(0, "#### JVMTIagent: found test class matched with \"%s\"\n" "\tsignature=%s\n", @@ -198,7 +198,7 @@ CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, display(1, "#### JVMTIagent: CompiledMethodLoad occurred ####\n"); - getVerdict(NULL, "CompiledMethodLoad"); + getVerdict(nullptr, "CompiledMethodLoad"); } void JNICALL @@ -207,7 +207,7 @@ CompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method, display(1, "#### JVMTIagent: CompiledMethodUnload occurred ####\n"); - getVerdict(NULL, "CompiledMethodUnload"); + getVerdict(nullptr, "CompiledMethodUnload"); } void JNICALL @@ -215,7 +215,7 @@ DataDumpRequest(jvmtiEnv *jvmti_env) { display(1, "#### JVMTIagent: DataDumpRequest occurred ####\n"); - getVerdict(NULL, "DataDumpRequest"); + getVerdict(nullptr, "DataDumpRequest"); } void JNICALL @@ -226,7 +226,7 @@ DynamicCodeGenerated(jvmtiEnv *jvmti_env, display(1, "#### JVMTIagent: DynamicCodeGenerated occurred ####\n"); - getVerdict(NULL, "DynamicCodeGenerated"); + getVerdict(nullptr, "DynamicCodeGenerated"); } void JNICALL @@ -286,7 +286,7 @@ GarbageCollectionFinish(jvmtiEnv *jvmti_env) { display(1, "#### JVMTIagent: GarbageCollectionFinish occurred ####\n"); - getVerdict(NULL, "GarbageCollectionFinish"); + getVerdict(nullptr, "GarbageCollectionFinish"); } void JNICALL @@ -294,7 +294,7 @@ GarbageCollectionStart(jvmtiEnv *jvmti_env) { display(1, "#### JVMTIagent: GarbageCollectionStart occurred ####\n"); - getVerdict(NULL, "GarbageCollectionStart"); + getVerdict(nullptr, "GarbageCollectionStart"); } void JNICALL @@ -347,7 +347,7 @@ ObjectFree(jvmtiEnv *jvmti_env, jlong tag) { display(1, "#### JVMTIagent: ObjectFree occurred ####\n"); - getVerdict(NULL, "ObjectFree"); + getVerdict(nullptr, "ObjectFree"); } void JNICALL @@ -489,10 +489,10 @@ JNIEXPORT jint JNICALL Java_nsk_share_RASagent_setHotSwapMode(JNIEnv *jni_env, jclass cls, jboolean vrb, jint level, jstring shortName) { jvmtiCapabilities capabil; - jmethodID mid = NULL; + jmethodID mid = nullptr; - if (jvmti == NULL) { - printf("ERROR(%s,%d): JVMTIagent was not properly loaded: JVMTI env = NULL\n", + if (jvmti == nullptr) { + printf("ERROR(%s,%d): JVMTIagent was not properly loaded: JVMTI env = null\n", __FILE__, __LINE__); return 1; } @@ -554,14 +554,14 @@ Java_nsk_share_RASagent_setHotSwapMode(JNIEnv *jni_env, jclass cls, return 1; } - if (!NSK_JNI_VERIFY(jni_env, (shortTestName = jni_env->GetStringUTFChars(shortName, NULL)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (shortTestName = jni_env->GetStringUTFChars(shortName, nullptr)) != nullptr)) { printf("ERROR: JVMTIagent: unable to get UTF-8 characters of the string\n"); return 1; } display(0, "#### JVMTIagent: short name of current test is \"%s\"\n", shortTestName); - if (!NSK_JNI_VERIFY(jni_env, (rasCls = jni_env->NewGlobalRef(cls)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (rasCls = jni_env->NewGlobalRef(cls)) != nullptr)) { printf("ERROR JVMTIagent: unable to create a new global reference of the class \"RASagent\"\n"); return 1; } @@ -576,19 +576,19 @@ Java_nsk_share_RASagent_setHotSwapMode(JNIEnv *jni_env, jclass cls, } static jint allocClsInfo(JNIEnv *jni_env, char *cls_sig, jclass clazz) { - class_info *_clsInfo = NULL; - jmethodID mid = NULL; + class_info *_clsInfo = nullptr; + jmethodID mid = nullptr; jbyteArray classBytes; jboolean isCopy; _clsInfo = (class_info*) malloc(sizeof(class_info)); - if (_clsInfo == NULL) + if (_clsInfo == nullptr) jni_env->FatalError("JVMTIagent: cannot allocate memory for class_info\n"); /* fill the structure class_info */ _clsInfo->clazzsig = cls_sig; - if (!NSK_JNI_VERIFY(jni_env, ((*_clsInfo).cls = jni_env->NewGlobalRef(clazz)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, ((*_clsInfo).cls = jni_env->NewGlobalRef(clazz)) != nullptr)) { printf("ERROR: JVMTIagent: unable to create a new global reference of class \"%s\"\n", _clsInfo->clazzsig); free(_clsInfo); @@ -597,7 +597,7 @@ static jint allocClsInfo(JNIEnv *jni_env, char *cls_sig, jclass clazz) { } if (!NSK_JNI_VERIFY(jni_env, (mid = - jni_env->GetStaticMethodID(rasCls, "loadFromClassFile", "(Ljava/lang/String;)[B")) != NULL)) + jni_env->GetStaticMethodID(rasCls, "loadFromClassFile", "(Ljava/lang/String;)[B")) != nullptr)) jni_env->FatalError("JVMTIagent: unable to get ID of the method \"loadFromClassFile\"\n"); classBytes = (jbyteArray) jni_env->CallStaticObjectMethod(rasCls, mid, jni_env->NewStringUTF(cls_sig)); @@ -609,9 +609,9 @@ static jint allocClsInfo(JNIEnv *jni_env, char *cls_sig, jclass clazz) { (*_clsInfo).clsBytes = jni_env->GetByteArrayElements(classBytes, &isCopy); - _clsInfo->next = NULL; + _clsInfo->next = nullptr; - if (clsInfo != NULL) { + if (clsInfo != nullptr) { clsInfo->next = (struct class_info*) _clsInfo; } else { @@ -627,7 +627,7 @@ static void deallocClsInfo(JNIEnv *jni_env) { NSK_TRACE(jni_env->DeleteGlobalRef(rasCls)); - while (clsInfoCurr != NULL) { + while (clsInfoCurr != nullptr) { class_info *_clsInfo = clsInfoCurr; if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) clsInfoCurr->clazzsig))) @@ -640,16 +640,16 @@ static void deallocClsInfo(JNIEnv *jni_env) { free(_clsInfo); } /* fix for 4756585: indicate that stucture class_info is empty now */ - clsInfoFst = NULL; + clsInfoFst = nullptr; } static int findAndHotSwap(JNIEnv *jni_env, jclass clazz) { int ret_code = 0; - char *clazzsig = NULL; + char *clazzsig = nullptr; class_info *clsInfoCurr = clsInfoFst; display(1, "\n#### JVMTIagent: findAndHotSwap: obtaining class signature of class to be hotswap ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(clazz, &clazzsig, /*&generic*/NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(clazz, &clazzsig, /*&generic*/nullptr))) jni_env->FatalError("JVMTIagent: findAndHotSwap: failed to get class signature\n"); else { display(1, "#### JVMTIagent: findAndHotSwap: ... class signature obtained: \"%s\"\n", @@ -659,7 +659,7 @@ static int findAndHotSwap(JNIEnv *jni_env, jclass clazz) { lock(jni_env); display(0, "#### JVMTIagent: findAndHotSwap: >>>>>>>> entered the raw monitor \"eventLock\" ####\n"); - while (clsInfoCurr != NULL) { + while (clsInfoCurr != nullptr) { if (hotswap == HOTSWAP_EVERY_METHOD_ENTRY_FOR_EVERY_CLASS || hotswap == HOTSWAP_EVERY_EXCEPTION_FOR_EVERY_CLASS) { display(1, "\n#### JVMTIagent: findAndHotSwap: going to hotswap tested class \"%s\" during execution of class \"%s\" ...\n", @@ -735,7 +735,7 @@ static int addStressEvents() { callbacks.SingleStep = &SingleStep; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, nullptr))) return JNI_ERR; stepEventSet = JNI_TRUE; @@ -751,7 +751,7 @@ static int addStressEvents() { callbacks.MethodEntry = &MethodEntry; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting MethodEntry events done\n"); @@ -761,7 +761,7 @@ static int addStressEvents() { callbacks.MethodExit = &MethodExit; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting MethodExit events done\n"); @@ -777,7 +777,7 @@ static int addStressEvents() { callbacks.ExceptionCatch = &ExceptionCatch; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr))) return JNI_ERR; excCatchEventSet = JNI_TRUE; @@ -822,7 +822,7 @@ static int enableEventsCaps() { callbacks.Breakpoint = &Breakpoint; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting Breakpoint events done\n"); @@ -831,7 +831,7 @@ static int enableEventsCaps() { callbacks.ClassFileLoadHook = &ClassFileLoadHook; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting ClassFileLoadHook events done\n"); @@ -840,7 +840,7 @@ static int enableEventsCaps() { callbacks.ClassLoad = &ClassLoad; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting ClassLoad events done\n"); @@ -849,7 +849,7 @@ static int enableEventsCaps() { callbacks.ClassPrepare = &ClassPrepare; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting ClassPrepare events done\n"); @@ -858,7 +858,7 @@ static int enableEventsCaps() { callbacks.CompiledMethodLoad = &CompiledMethodLoad; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting CompiledMethodLoad events done\n"); @@ -867,7 +867,7 @@ static int enableEventsCaps() { callbacks.CompiledMethodUnload = &CompiledMethodUnload; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting CompiledMethodUnload events done\n"); @@ -876,7 +876,7 @@ static int enableEventsCaps() { callbacks.DataDumpRequest = &DataDumpRequest; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DATA_DUMP_REQUEST, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DATA_DUMP_REQUEST, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting DataDumpRequest events done\n"); @@ -885,7 +885,7 @@ static int enableEventsCaps() { callbacks.DynamicCodeGenerated = &DynamicCodeGenerated; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting DynamicCodeGenerated events done\n"); @@ -894,7 +894,7 @@ static int enableEventsCaps() { callbacks.Exception = &Exception; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting Exception events done\n"); @@ -903,7 +903,7 @@ static int enableEventsCaps() { callbacks.FieldAccess = &FieldAccess; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting FieldAccess events done\n"); @@ -912,7 +912,7 @@ static int enableEventsCaps() { callbacks.FieldModification = &FieldModification; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting FieldModification events done\n"); @@ -921,7 +921,7 @@ static int enableEventsCaps() { callbacks.FramePop = &FramePop; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting FramePop events done\n"); @@ -930,7 +930,7 @@ static int enableEventsCaps() { callbacks.GarbageCollectionFinish = &GarbageCollectionFinish; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting GarbageCollectionFinish events done\n"); @@ -939,7 +939,7 @@ static int enableEventsCaps() { callbacks.GarbageCollectionStart = &GarbageCollectionStart; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting GarbageCollectionStart events done\n"); @@ -948,7 +948,7 @@ static int enableEventsCaps() { callbacks.MonitorContendedEnter = &MonitorContendedEnter; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting MonitorContendedEnter events done\n"); @@ -957,7 +957,7 @@ static int enableEventsCaps() { callbacks.MonitorContendedEntered = &MonitorContendedEntered; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting MonitorContendedEntered events done\n"); @@ -966,7 +966,7 @@ static int enableEventsCaps() { callbacks.MonitorWait = &MonitorWait; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting MonitorWait events done\n"); @@ -975,7 +975,7 @@ static int enableEventsCaps() { callbacks.MonitorWaited = &MonitorWaited; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting MonitorWaited events done\n"); @@ -984,7 +984,7 @@ static int enableEventsCaps() { callbacks.NativeMethodBind = &NativeMethodBind; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting NativeMethodBind events done\n"); @@ -993,7 +993,7 @@ static int enableEventsCaps() { callbacks.ObjectFree = &ObjectFree; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting ObjectFree events done\n"); @@ -1002,7 +1002,7 @@ static int enableEventsCaps() { callbacks.ThreadEnd = &ThreadEnd; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting ThreadEnd events done\n"); @@ -1011,7 +1011,7 @@ static int enableEventsCaps() { callbacks.ThreadStart = &ThreadStart; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting ThreadStart events done\n"); @@ -1020,7 +1020,7 @@ static int enableEventsCaps() { callbacks.VMDeath = &VMDeath; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting VMDeath events done\n"); @@ -1029,7 +1029,7 @@ static int enableEventsCaps() { callbacks.VMInit = &VMInit; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting VMInit events done\n"); @@ -1038,7 +1038,7 @@ static int enableEventsCaps() { callbacks.VMStart = &VMStart; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting VMStart events done\n"); @@ -1047,7 +1047,7 @@ static int enableEventsCaps() { callbacks.VMObjectAlloc = &VMObjectAlloc; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting VMObjectAlloc events done\n"); @@ -1153,7 +1153,7 @@ static void getVerdict(JNIEnv *jni_env, const char *evnt) { snprintf(error_msg, sizeof(error_msg), "JVMTIagent: getVerdict: %s event occured after VMDeath", evnt); - if (jni_env == NULL) { /* some event callbacks have no pointer to jni */ + if (jni_env == nullptr) { /* some event callbacks have no pointer to jni */ printf("ERROR: %s\n", error_msg); exit(97); } @@ -1181,7 +1181,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; doSetup(options); @@ -1198,7 +1198,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp index 4219ad9a0f4..b3b076b2ef7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,13 +44,13 @@ void nsk_aod_internal_error() { } void nsk_free_options(Options* options) { - if (options != NULL) { + if (options != nullptr) { int i; for (i = 0; i < NSK_AOD_MAX_OPTIONS; i++) { - if (options->names[i] != NULL) { + if (options->names[i] != nullptr) { free(options->names[i]); } - if (options->values[i] != NULL) { + if (options->values[i] != nullptr) { free(options->values[i]); } } @@ -71,20 +71,20 @@ static Options* nsk_aod_createOptionsObject(char* optionsString) { char* value; char* sep; - if (optionsString == NULL) { + if (optionsString == nullptr) { NSK_COMPLAIN0("options were not passed to the native agent\n"); - return NULL; + return nullptr; } options = (Options*) malloc(sizeof(Options)); memset(options, 0, sizeof(Options)); options->size = 0; name = optionsString; - while (name != NULL && i < NSK_AOD_MAX_OPTIONS) { + while (name != nullptr && i < NSK_AOD_MAX_OPTIONS) { sep = strchr(name, '='); - if (sep == NULL) { // name not found + if (sep == nullptr) { // name not found NSK_COMPLAIN1("Invalid options format: '%s'\n", optionsString); nsk_free_options(options); - return NULL; + return nullptr; } *sep = '\0'; options->names[i] = strdup(name); @@ -92,10 +92,10 @@ static Options* nsk_aod_createOptionsObject(char* optionsString) { if (*value == '\0') { // value not found NSK_COMPLAIN1("Option '%s' is empty\n", options->names[i]); nsk_free_options(options); - return NULL; + return nullptr; } sep = strchr(value, ' '); - if (sep != NULL) { + if (sep != nullptr) { *sep = '\0'; name = sep + 1; } else { @@ -105,10 +105,10 @@ static Options* nsk_aod_createOptionsObject(char* optionsString) { i++; if (*name == '\0') { - name = NULL; + name = nullptr; } } - if (name != NULL) { + if (name != nullptr) { NSK_COMPLAIN1("WARNING: not all options were parsed, only %d options can be specified\n", NSK_AOD_MAX_OPTIONS); } @@ -119,12 +119,12 @@ static Options* nsk_aod_createOptionsObject(char* optionsString) { Options* nsk_aod_createOptions(char* optionsString) { Options* options; - if (!NSK_VERIFY((options = (Options*) nsk_aod_createOptionsObject(optionsString)) != NULL)) - return NULL; + if (!NSK_VERIFY((options = (Options*) nsk_aod_createOptionsObject(optionsString)) != nullptr)) + return nullptr; if (!NSK_VERIFY(nsk_aod_optionSpecified(options, NSK_AOD_AGENT_NAME_OPTION))) { NSK_COMPLAIN0("Agent name wasn't specified\n"); - return NULL; + return nullptr; } /* @@ -143,9 +143,9 @@ Options* nsk_aod_createOptions(char* optionsString) { const char* nsk_aod_getOptionValue(Options* options, const char* option) { int i; - if (!NSK_VERIFY(options != NULL)) { - NSK_COMPLAIN0("Options NULL\n"); - return NULL; + if (!NSK_VERIFY(options != nullptr)) { + NSK_COMPLAIN0("Options null\n"); + return nullptr; } for (i = 0; i < options->size; i++) { @@ -156,14 +156,14 @@ const char* nsk_aod_getOptionValue(Options* options, const char* option) { NSK_COMPLAIN1("Option '%s' isn't defined\n", option); - return NULL; + return nullptr; } int nsk_aod_optionSpecified(Options* options, const char* option) { int i; - if (!NSK_VERIFY(options != NULL)) { - NSK_COMPLAIN0("Options NULL\n"); + if (!NSK_VERIFY(options != nullptr)) { + NSK_COMPLAIN0("Options null\n"); return NSK_FALSE; } @@ -188,9 +188,9 @@ static const char* AGENT_LOADED_METHOD_SIGNATURE = "(Ljava/lang/String;)V"; static const char* AGENT_FINISHED_METHOD_NAME = "agentFinished"; static const char* AGENT_FINISHED_METHOD_SIGNATURE = "(Ljava/lang/String;Z)V"; -static jclass targetAppClass = NULL; -static jmethodID agentLoadedMethod = NULL; -static jmethodID agentFinishedMethod = NULL; +static jclass targetAppClass = nullptr; +static jmethodID agentLoadedMethod = nullptr; +static jmethodID agentFinishedMethod = nullptr; // this function is used to notify target application that native agent has been loaded int nsk_aod_agentLoaded(JNIEnv* jni, const char* agentName) { @@ -198,31 +198,31 @@ int nsk_aod_agentLoaded(JNIEnv* jni, const char* agentName) { NSK_DISPLAY1("Agent %s is loaded\n", agentName); - if (targetAppClass == NULL) { + if (targetAppClass == nullptr) { /* * FindClass returns local reference, to cache reference to target application class * global reference should be created */ jclass localTargetAppClass; if (!NSK_JNI_VERIFY(jni, (localTargetAppClass = - jni->FindClass(TARGET_APP_CLASS_NAME)) != NULL)) { + jni->FindClass(TARGET_APP_CLASS_NAME)) != nullptr)) { return NSK_FALSE; } if (!NSK_JNI_VERIFY(jni, (targetAppClass = (jclass) - jni->NewGlobalRef(localTargetAppClass)) != NULL)) { + jni->NewGlobalRef(localTargetAppClass)) != nullptr)) { return NSK_FALSE; } } - if (agentLoadedMethod == NULL) { + if (agentLoadedMethod == nullptr) { if (!NSK_JNI_VERIFY(jni, (agentLoadedMethod = - jni->GetStaticMethodID(targetAppClass, AGENT_LOADED_METHOD_NAME, AGENT_LOADED_METHOD_SIGNATURE)) != NULL)) + jni->GetStaticMethodID(targetAppClass, AGENT_LOADED_METHOD_NAME, AGENT_LOADED_METHOD_SIGNATURE)) != nullptr)) return NSK_FALSE; } if (!NSK_JNI_VERIFY(jni, (agentNameString = - jni->NewStringUTF(agentName)) != NULL)) + jni->NewStringUTF(agentName)) != nullptr)) return NSK_FALSE; jni->CallStaticVoidMethod(targetAppClass, agentLoadedMethod, agentNameString); @@ -252,13 +252,13 @@ int nsk_aod_agentFinished(JNIEnv* jni, const char* agentName, int success) { NSK_DISPLAY2("Agent %s finished (success: %d)\n", agentName, success); - if (agentFinishedMethod == NULL) { + if (agentFinishedMethod == nullptr) { if (!NSK_JNI_VERIFY(jni, (agentFinishedMethod = - jni->GetStaticMethodID(targetAppClass, AGENT_FINISHED_METHOD_NAME, AGENT_FINISHED_METHOD_SIGNATURE)) != NULL)) + jni->GetStaticMethodID(targetAppClass, AGENT_FINISHED_METHOD_NAME, AGENT_FINISHED_METHOD_SIGNATURE)) != nullptr)) return NSK_FALSE; } - if (!NSK_JNI_VERIFY(jni, (agentNameString = jni->NewStringUTF(agentName)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (agentNameString = jni->NewStringUTF(agentName)) != nullptr)) return NSK_FALSE; jni->CallStaticVoidMethod(targetAppClass, agentFinishedMethod, agentNameString, success ? JNI_TRUE : JNI_FALSE); @@ -276,7 +276,7 @@ JNIEnv* nsk_aod_createJNIEnv(JavaVM* vm) { JNIEnv* jni; vm->GetEnv((void**)&jni, JNI_VERSION_1_2); - NSK_VERIFY(jni != NULL); + NSK_VERIFY(jni != nullptr); return jni; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.cpp index a64f108222f..2ad70dfe076 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_BooleanArrayCriticalLocker @@ -45,31 +45,31 @@ JNIEXPORT jboolean JNICALL Java_nsk_share_gc_lock_jni_BooleanArrayCriticalLocker jboolean hash = JNI_TRUE; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } arr = (jbooleanArray) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetArrayLength(arr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (difftime(current_time, start_time) < enterTime) { hash = JNI_TRUE; - pa = (jboolean*) ec_jni->GetPrimitiveArrayCritical(arr, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = (jboolean*) ec_jni->GetPrimitiveArrayCritical(arr, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash ^= pa[i]; } } else { - jni_env->FatalError("GetPrimitiveArrayCritical returned NULL"); + jni_env->FatalError("GetPrimitiveArrayCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleasePrimitiveArrayCritical(arr, pa, 0, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, arr, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.cpp index ae13774efee..1feb98d9ef5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_ByteArrayCriticalLocker @@ -44,31 +44,31 @@ JNIEXPORT jbyte JNICALL Java_nsk_share_gc_lock_jni_ByteArrayCriticalLocker_criti jbyte hash = 0; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } arr = (jbyteArray) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetArrayLength(arr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (difftime(current_time, start_time) < enterTime) { hash = 0; - pa = (jbyte*) ec_jni->GetPrimitiveArrayCritical(arr, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = (jbyte*) ec_jni->GetPrimitiveArrayCritical(arr, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash ^= pa[i]; } } else { - jni_env->FatalError("GetPrimitiveArrayCritical returned NULL"); + jni_env->FatalError("GetPrimitiveArrayCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleasePrimitiveArrayCritical(arr, pa, 0, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, arr, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.cpp index 8c46de5dd42..9c6231a0a16 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_CharArrayCriticalLocker @@ -45,31 +45,31 @@ JNIEXPORT jchar JNICALL Java_nsk_share_gc_lock_jni_CharArrayCriticalLocker_criti jchar hash = 0; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } arr = (jcharArray) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetArrayLength(arr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); current_time = 0; enterTime /= 1000; while (difftime(current_time, start_time) < enterTime) { hash = 0; - pa = (jchar*) ec_jni->GetPrimitiveArrayCritical(arr, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = (jchar*) ec_jni->GetPrimitiveArrayCritical(arr, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash ^= pa[i]; } } else { - jni_env->FatalError("GetPrimitiveArrayCritical returned NULL"); + jni_env->FatalError("GetPrimitiveArrayCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleasePrimitiveArrayCritical(arr, pa, 0, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, arr, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.cpp index fd6bba4822b..773ffc533a1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_DoubleArrayCriticalLocker @@ -45,31 +45,31 @@ JNIEXPORT jdouble JNICALL Java_nsk_share_gc_lock_jni_DoubleArrayCriticalLocker_c jdouble hash = 0; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } arr = (jdoubleArray) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetArrayLength(arr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (difftime(current_time, start_time) < enterTime) { hash = 0; - pa = (jdouble*) ec_jni->GetPrimitiveArrayCritical(arr, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = (jdouble*) ec_jni->GetPrimitiveArrayCritical(arr, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash += pa[i]; } } else { - jni_env->FatalError("GetPrimitiveArrayCritical returned NULL"); + jni_env->FatalError("GetPrimitiveArrayCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleasePrimitiveArrayCritical(arr, pa, 0, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, arr, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.cpp index a82e9425338..e24138792fb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_FloatArrayCriticalLocker @@ -45,31 +45,31 @@ JNIEXPORT jfloat JNICALL Java_nsk_share_gc_lock_jni_FloatArrayCriticalLocker_cri jfloat hash = 0; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } arr = (jfloatArray) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetArrayLength(arr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (difftime(current_time, start_time) < enterTime) { hash = 0; - pa = (jfloat*) ec_jni->GetPrimitiveArrayCritical(arr, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = (jfloat*) ec_jni->GetPrimitiveArrayCritical(arr, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash += pa[i]; } } else { - jni_env->FatalError("GetPrimitiveArrayCritical returned NULL"); + jni_env->FatalError("GetPrimitiveArrayCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleasePrimitiveArrayCritical(arr, pa, 0, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, arr, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.cpp index 465e4c56b32..b863984f9ac 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_IntArrayCriticalLocker @@ -45,31 +45,31 @@ JNIEXPORT jint JNICALL Java_nsk_share_gc_lock_jni_IntArrayCriticalLocker_critica jint hash = 0; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } arr = (jintArray) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetArrayLength(arr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (difftime(current_time, start_time) < enterTime) { hash = 0; - pa = (jint*) ec_jni->GetPrimitiveArrayCritical(arr, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = (jint*) ec_jni->GetPrimitiveArrayCritical(arr, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash ^= pa[i]; } } else { - jni_env->FatalError("GetPrimitiveArrayCritical returned NULL"); + jni_env->FatalError("GetPrimitiveArrayCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleasePrimitiveArrayCritical(arr, pa, 0, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, arr, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.cpp index 8073e9ed36e..dae07c708db 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_LongArrayCriticalLocker @@ -45,31 +45,31 @@ JNIEXPORT jlong JNICALL Java_nsk_share_gc_lock_jni_LongArrayCriticalLocker_criti jlong hash = 0; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } arr = (jlongArray) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetArrayLength(arr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (difftime(current_time, start_time) < enterTime) { hash = 0; - pa = (jlong*) ec_jni->GetPrimitiveArrayCritical(arr, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = (jlong*) ec_jni->GetPrimitiveArrayCritical(arr, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash ^= pa[i]; } } else { - jni_env->FatalError("GetPrimitiveArrayCritical returned NULL"); + jni_env->FatalError("GetPrimitiveArrayCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleasePrimitiveArrayCritical(arr, pa, 0, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, arr, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.cpp index a91a3cc37df..2b03591a709 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_ShortArrayCriticalLocker @@ -45,31 +45,31 @@ JNIEXPORT jshort JNICALL Java_nsk_share_gc_lock_jni_ShortArrayCriticalLocker_cri jshort hash = 0; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } arr = (jshortArray) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetArrayLength(arr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (current_time - start_time < enterTime) { hash = 0; - pa = (jshort*) ec_jni->GetPrimitiveArrayCritical(arr, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = (jshort*) ec_jni->GetPrimitiveArrayCritical(arr, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash ^= pa[i]; } } else { - jni_env->FatalError("GetPrimitiveArrayCritical returned NULL"); + jni_env->FatalError("GetPrimitiveArrayCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleasePrimitiveArrayCritical(arr, pa, 0, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, arr, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.cpp index bbb41cfef96..a8049b2bea9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_StringCriticalLocker @@ -45,31 +45,31 @@ JNIEXPORT jchar JNICALL Java_nsk_share_gc_lock_jni_StringCriticalLocker_critical jchar hash = 0; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } str = (jstring) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetStringLength(str, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (current_time - start_time < enterTime) { hash = 0; - pa = ec_jni->GetStringCritical(str, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = ec_jni->GetStringCritical(str, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash ^= pa[i]; } } else { - jni_env->FatalError("GetStringCritical returned NULL"); + jni_env->FatalError("GetStringCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleaseStringCritical(str, pa, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, str, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.cpp index 7cde57969c7..4bbbef6e204 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jniref_JNIGlobalRefLocker @@ -44,13 +44,13 @@ JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNIGlobalRefLocker_critical jobject gref; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } obj = ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); - start_time = time(NULL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (current_time - start_time < enterTime) { @@ -58,7 +58,7 @@ JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNIGlobalRefLocker_critical mssleep((long) sleepTime); ec_jni->DeleteGlobalRef(gref, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, obj, TRACE_JNI_CALL); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.cpp index 20095130270..127322728a5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jniref_JNILocalRefLocker @@ -43,13 +43,13 @@ JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNILocalRefLocker_criticalN jobject gref; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } obj = ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); - start_time = time(NULL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (current_time - start_time < enterTime) { @@ -57,7 +57,7 @@ JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNILocalRefLocker_criticalN mssleep((long) sleepTime); ec_jni->DeleteLocalRef(gref, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, obj, TRACE_JNI_CALL); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.cpp index a15c487cfd3..0fb552a8b03 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jniref_JNIRefLocker @@ -43,15 +43,15 @@ JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNIRefLocker_criticalNative jobject gref, lref, gwref; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } obj = ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (current_time - start_time < enterTime) { @@ -63,7 +63,7 @@ JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNIRefLocker_criticalNative ec_jni->DeleteLocalRef(lref, TRACE_JNI_CALL); ec_jni->DeleteWeakGlobalRef(gwref, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, obj, TRACE_JNI_CALL); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.cpp index d98379998ee..f4c35b20d90 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jniref_JNIWeakGlobalRefLocker @@ -43,14 +43,14 @@ JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNIWeakGlobalRefLocker_crit jobject gref; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } obj = ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (current_time - start_time < enterTime) { @@ -58,7 +58,7 @@ JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNIWeakGlobalRefLocker_crit mssleep((long) sleepTime); ec_jni->DeleteWeakGlobalRef(gref, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, obj, TRACE_JNI_CALL); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.cpp index f9a232fd679..ca3e5dfff74 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2019, Google and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -35,8 +35,8 @@ static const char* get_dirname(const char* fullname) { const char* p; const char* base = fullname;; - if (fullname == NULL) { - return NULL; + if (fullname == nullptr) { + return nullptr; } for (p = fullname; *p != '\0'; p++) { @@ -52,7 +52,7 @@ class JNIVerifier { public: JNIVerifier(ExceptionCheckingJniEnv *env, const char* base_message, int line, const char* file) - : _env(env), _base_message(base_message), _error_message(NULL), + : _env(env), _base_message(base_message), _error_message(nullptr), _line(line), _file(get_dirname(file)) { } @@ -61,7 +61,7 @@ class JNIVerifier { JNIVerifier(ExceptionCheckingJniEnv *env, const char* base_message, U parameter, int line, const char* file) - : _env(env), _base_message(base_message), _error_message(NULL), + : _env(env), _base_message(base_message), _error_message(nullptr), _line(line), _file(get_dirname(file)) { PrintPreCall(parameter); } @@ -71,7 +71,7 @@ class JNIVerifier { U parameter1, V parameter2, int line, const char* file) - : _env(env), _base_message(base_message), _error_message(NULL), + : _env(env), _base_message(base_message), _error_message(nullptr), _line(line), _file(get_dirname(file)) { PrintPreCall(parameter1, parameter2); } @@ -80,7 +80,7 @@ class JNIVerifier { JNIVerifier(ExceptionCheckingJniEnv *env, const char* base_message, U parameter1, V parameter2, W parameter3, int line, const char* file) - : _env(env), _base_message(base_message), _error_message(NULL), + : _env(env), _base_message(base_message), _error_message(nullptr), _line(line), _file(get_dirname(file)) { PrintPreCall(parameter1, parameter2, parameter3); } @@ -93,7 +93,7 @@ class JNIVerifier { _error_message = "internal error"; } - if (_error_message != NULL) { + if (_error_message != nullptr) { GenerateErrorMessage(); } } @@ -173,7 +173,7 @@ class JNIVerifier { len += MAX_INTEGER_DIGITS + 1; char* full_message = (char*) malloc(len); - if (full_message == NULL) { + if (full_message == nullptr) { _env->HandleError(_error_message); return; } @@ -199,8 +199,8 @@ class JNIVerifier { } T ResultNotNull(T ptr) { - if (ptr == NULL) { - _error_message = "Return is NULL"; + if (ptr == nullptr) { + _error_message = "Return is null"; } return ptr; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.hpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.hpp index af6c0489991..2db7177c8f7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.hpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2019, Google and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -36,8 +36,8 @@ * * ... JNIEnv* env ... * jclass klass = env->GetObjectClass(o); - * if (klass == NULL) { - * printf("Error: GetObjectClass returned NULL\n"); + * if (klass == nullptr) { + * printf("Error: GetObjectClass returned null\n"); * return; * } * if (env->ExceptionCheck()) { @@ -48,7 +48,7 @@ * ... ExceptionCheckingJniEnv* env ... * jclass klass = env->GetObjectClass(o, TRACE_JNI_CALL); * - * Where now the JNI Exception checking and the NULL return checking are done + * Where now the JNI Exception checking and the null return checking are done * internally and will perform whatever action the ErrorHandler requires. * * Note the TRACE_JNI_CALL parameter that allows to trace where the call is diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.cpp index 7fa0f0d15ab..50b59a157e9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ extern "C" { -static jobject* globalReferences = NULL; -static jweak* weakReferences = NULL; +static jobject* globalReferences = nullptr; +static jweak* weakReferences = nullptr; JNIEXPORT jint JNICALL Java_nsk_share_ReferringObject_createJNIGlobalReferenceNative(JNIEnv *env, @@ -37,19 +37,19 @@ Java_nsk_share_ReferringObject_createJNIGlobalReferenceNative(JNIEnv *env, jint i; jint result = -1; - if (globalReferences == NULL) + if (globalReferences == nullptr) { globalReferences = (jobject*)malloc(sizeof(jobject) * maxJNIGlobalReferences); - if (globalReferences == NULL) + if (globalReferences == nullptr) { - NSK_COMPLAIN0("malloc return NULL\n"); + NSK_COMPLAIN0("malloc return null\n"); return -1; } for (i = 0; i < maxJNIGlobalReferences; i++) { - globalReferences[i] = NULL; + globalReferences[i] = nullptr; } } @@ -57,17 +57,17 @@ Java_nsk_share_ReferringObject_createJNIGlobalReferenceNative(JNIEnv *env, { jobject reference = globalReferences[i]; - if (reference == NULL) + if (reference == nullptr) { reference = env->NewGlobalRef(object); - if (reference == NULL) + if (reference == nullptr) { - NSK_COMPLAIN0("NewGlobalRef return NULL\n"); + NSK_COMPLAIN0("NewGlobalRef return null\n"); env->ThrowNew( env->FindClass("nsk/share/TestJNIError"), - "NewGlobalRef return NULL"); + "NewGlobalRef return null"); } globalReferences[i] = reference; @@ -87,18 +87,18 @@ Java_nsk_share_ReferringObject_deleteJNIGlobalReferenceNative(JNIEnv *env, { jobject reference = globalReferences[index]; - if (reference == NULL) + if (reference == nullptr) { - NSK_COMPLAIN1("globalReferences[%d] = NULL, possible wrong index is passed\n", index); + NSK_COMPLAIN1("globalReferences[%d] = null, possible wrong index is passed\n", index); env->ThrowNew( env->FindClass("nsk/share/TestBug"), - "Requested globalReferences[] element is NULL, possible wrong index is passed"); + "Requested globalReferences[] element is null, possible wrong index is passed"); } env->DeleteGlobalRef(reference); - globalReferences[index] = NULL; + globalReferences[index] = nullptr; } @@ -109,13 +109,13 @@ Java_nsk_share_ReferringObject_createJNILocalReferenceNative(JNIEnv *env, jobject reference = env->NewLocalRef(object); jclass klass; - if (reference == NULL) + if (reference == nullptr) { - NSK_COMPLAIN0("NewLocalRef return NULL\n"); + NSK_COMPLAIN0("NewLocalRef return null\n"); env->ThrowNew( env->FindClass("nsk/share/TestJNIError"), - "NewLocalRef return NULL"); + "NewLocalRef return null"); } klass = env->GetObjectClass(createWicket); @@ -136,20 +136,20 @@ Java_nsk_share_ReferringObject_createJNIWeakReferenceNative(JNIEnv *env, jint i; jint result = -1; - if (weakReferences == NULL) + if (weakReferences == nullptr) { weakReferences = (jweak*)malloc(sizeof(jweak) * maxJNIWeakReferences); - if (weakReferences == NULL) + if (weakReferences == nullptr) { - NSK_COMPLAIN0("malloc return NULL\n"); + NSK_COMPLAIN0("malloc return null\n"); return -1; } for (i = 0; i < maxJNIWeakReferences; i++) { - weakReferences[i] = NULL; + weakReferences[i] = nullptr; } } @@ -157,17 +157,17 @@ Java_nsk_share_ReferringObject_createJNIWeakReferenceNative(JNIEnv *env, { jobject reference = weakReferences[i]; - if (reference == NULL) + if (reference == nullptr) { reference = env->NewWeakGlobalRef(object); - if (reference == NULL) + if (reference == nullptr) { - NSK_COMPLAIN0("NewWeakGlobalRef return NULL\n"); + NSK_COMPLAIN0("NewWeakGlobalRef return null\n"); env->ThrowNew( env->FindClass("nsk/share/TestJNIError"), - "NewWeakGlobalRef return NULL"); + "NewWeakGlobalRef return null"); } weakReferences[i] = reference; @@ -187,16 +187,16 @@ Java_nsk_share_ReferringObject_deleteJNIWeakReferenceNative(JNIEnv *env, { jweak reference = weakReferences[index]; - if (reference == NULL) + if (reference == nullptr) { - NSK_COMPLAIN1("weakReferences[%d] = NULL, possible wrong index is passed\n", index); + NSK_COMPLAIN1("weakReferences[%d] = null, possible wrong index is passed\n", index); env->ThrowNew( env->FindClass("nsk/share/TestBug"), - "Requested weakReferences[] element is NULL, possible wrong index is passed"); + "Requested weakReferences[] element is null, possible wrong index is passed"); } - if (env->IsSameObject(reference, NULL) == JNI_TRUE) + if (env->IsSameObject(reference, nullptr) == JNI_TRUE) { NSK_COMPLAIN0("TEST BUG: Weak reference was collected\n"); @@ -207,7 +207,7 @@ Java_nsk_share_ReferringObject_deleteJNIWeakReferenceNative(JNIEnv *env, env->DeleteWeakGlobalRef(reference); - weakReferences[index] = NULL; + weakReferences[index] = nullptr; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp index f8b9df264c9..2f5a5ff3bc0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,7 @@ int nsk_jni_check_exception(JNIEnv* jni, const char file[], int line) jthrowable throwable; NSK_TRACE(throwable = jni->ExceptionOccurred()); - if (throwable != NULL) { + if (throwable != nullptr) { nsk_lcomplain(file, line, "Exception in JNI call (cleared):\n"); NSK_TRACE(jni->ExceptionDescribe()); NSK_TRACE(jni->ExceptionClear()); @@ -107,7 +107,7 @@ void mssleep(long millis) { struct timeval timeout; timeout.tv_sec = millis / 1000; timeout.tv_usec = (millis % 1000) * 1000; - select(0, NULL, NULL, NULL, &timeout); + select(0, nullptr, nullptr, nullptr, &timeout); #endif } @@ -131,7 +131,7 @@ JavaVMOption* jni_create_vmoptions(int size, char *args[], int argsCnt) { int i; - JavaVMOption *options = NULL; + JavaVMOption *options = nullptr; if (size <= 0) return options; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch_agent.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch_agent.cpp index 128b33bbf36..4340391d413 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch_agent.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch_agent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -156,16 +156,16 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiEnv* jvmti; const char *p_segment1, *p_segment2, *phase_to_check; - jvmti = NULL; - p_segment1 = p_segment2 = phase_to_check = NULL; + jvmti = nullptr; + p_segment1 = p_segment2 = phase_to_check = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; timeout = nsk_jvmti_getWaitTime() * 60 * 1000; - p_segment1 = nsk_jvmti_findOptionStringValue("segment1", NULL); - if (!NSK_VERIFY(p_segment1 != NULL)) { + p_segment1 = nsk_jvmti_findOptionStringValue("segment1", nullptr); + if (!NSK_VERIFY(p_segment1 != nullptr)) { return JNI_ERR; } else { strncpy(segment1, p_segment1, (size_t) sizeof(segment1)/sizeof(char)); @@ -173,20 +173,20 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } // 'segment2' parameter is not mandatory - p_segment2 = nsk_jvmti_findOptionStringValue("segment2", NULL); - if (p_segment2 != NULL) { + p_segment2 = nsk_jvmti_findOptionStringValue("segment2", nullptr); + if (p_segment2 != nullptr) { strncpy(segment2, p_segment2, (size_t) sizeof(segment2)/sizeof(char)); segment2[(size_t) sizeof(segment2)/sizeof(char) - 1] = 0; use_segment2 = JNI_TRUE; } if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; // Check what phase(s) we are going to test - phase_to_check = nsk_jvmti_findOptionStringValue("phasetocheck", NULL); - if (!NSK_VERIFY(phase_to_check != NULL)) { + phase_to_check = nsk_jvmti_findOptionStringValue("phasetocheck", nullptr); + if (!NSK_VERIFY(phase_to_check != nullptr)) { return JNI_ERR; } else if (strcmp(phase_to_check, "onload") == 0) { jvmti_phase_to_check = JVMTI_PHASE_ONLOAD; @@ -227,7 +227,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiEvent eventsList[] = { JVMTI_EVENT_VM_INIT, JVMTI_EVENT_VM_DEATH }; if (!NSK_VERIFY(nsk_jvmti_enableEvents( - JVMTI_ENABLE, sizeof(eventsList)/sizeof(jvmtiEvent), eventsList, NULL))) { + JVMTI_ENABLE, sizeof(eventsList)/sizeof(jvmtiEvent), eventsList, nullptr))) { return JNI_ERR; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToSystemClassLoaderSearch/systemclssearch_agent.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToSystemClassLoaderSearch/systemclssearch_agent.cpp index 6be44a4f147..1d123242d49 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToSystemClassLoaderSearch/systemclssearch_agent.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToSystemClassLoaderSearch/systemclssearch_agent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -156,16 +156,16 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiEnv* jvmti; const char *p_segment1, *p_segment2, *phase_to_check; - jvmti = NULL; - p_segment1 = p_segment2 = phase_to_check = NULL; + jvmti = nullptr; + p_segment1 = p_segment2 = phase_to_check = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; timeout = nsk_jvmti_getWaitTime() * 60 * 1000; - p_segment1 = nsk_jvmti_findOptionStringValue("segment1", NULL); - if (!NSK_VERIFY(p_segment1 != NULL)) { + p_segment1 = nsk_jvmti_findOptionStringValue("segment1", nullptr); + if (!NSK_VERIFY(p_segment1 != nullptr)) { return JNI_ERR; } else { strncpy(segment1, p_segment1, (size_t) sizeof(segment1)/sizeof(char)); @@ -173,20 +173,20 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } // 'segment2' parameter is not mandatory - p_segment2 = nsk_jvmti_findOptionStringValue("segment2", NULL); - if (p_segment2 != NULL) { + p_segment2 = nsk_jvmti_findOptionStringValue("segment2", nullptr); + if (p_segment2 != nullptr) { strncpy(segment2, p_segment2, (size_t) sizeof(segment2)/sizeof(char)); segment2[(size_t) sizeof(segment2)/sizeof(char) - 1] = 0; use_segment2 = JNI_TRUE; } if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; // Check what phase(s) we are going to test - phase_to_check = nsk_jvmti_findOptionStringValue("phasetocheck", NULL); - if (!NSK_VERIFY(phase_to_check != NULL)) { + phase_to_check = nsk_jvmti_findOptionStringValue("phasetocheck", nullptr); + if (!NSK_VERIFY(phase_to_check != nullptr)) { return JNI_ERR; } else if (strcmp(phase_to_check, "onload") == 0) { jvmti_phase_to_check = JVMTI_PHASE_ONLOAD; @@ -227,7 +227,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiEvent eventsList[] = { JVMTI_EVENT_VM_INIT, JVMTI_EVENT_VM_DEATH }; if (!NSK_VERIFY(nsk_jvmti_enableEvents( - JVMTI_ENABLE, sizeof(eventsList)/sizeof(jvmtiEvent), eventsList, NULL))) { + JVMTI_ENABLE, sizeof(eventsList)/sizeof(jvmtiEvent), eventsList, nullptr))) { return JNI_ERR; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.cpp index 6246c6c4884..b69faf76ffa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -221,7 +221,7 @@ extern "C" { NSK_DISPLAY1("copying ConstantPool: %d\n", constantPoolSize); constantPool = (char**) malloc(constantPoolSize * sizeof(char*)); - if (!NSK_VERIFY(constantPool != NULL)) { + if (!NSK_VERIFY(constantPool != nullptr)) { NSK_COMPLAIN0("out of memory\n"); return NSK_FALSE; } @@ -262,7 +262,7 @@ extern "C" { case CONSTANT_Utf8: len = copy_u2(); utf8 = (char*) malloc(len + 1); - if (!NSK_VERIFY(utf8 != NULL)) { + if (!NSK_VERIFY(utf8 != nullptr)) { NSK_COMPLAIN0("out of memory\n"); return NSK_FALSE; } @@ -295,7 +295,7 @@ extern "C" { u2 i; for (i = 1; i < constantPoolSize; i++) { - if (constantPool[i] != NULL) { + if (constantPool[i] != nullptr) { free(constantPool[i]); } } @@ -1138,7 +1138,7 @@ extern "C" { inputPos = (u1*) orig; endPos = orig + old_length; gen = (u1*) malloc(old_length * GROWTH_FACTOR); - if (!NSK_VERIFY(gen != NULL)) { + if (!NSK_VERIFY(gen != nullptr)) { NSK_COMPLAIN0("out of memory\n"); return NSK_FALSE; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_tools.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_tools.cpp index b75f237c6a7..dc4da9bcf89 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_tools.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_tools.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,9 +37,9 @@ extern "C" { * Now the same source is used to build different agent libs, so these * variables are not shared between agents */ -static jthread agentThread = NULL; -static jvmtiStartFunction agentThreadProc = NULL; -static void* agentThreadArg = NULL; +static jthread agentThread = nullptr; +static jvmtiStartFunction agentThreadProc = nullptr; +static void* agentThreadArg = nullptr; typedef enum { NEW, RUNNABLE, WAITING, SUSPENDED, TERMINATED } thread_state_t; @@ -52,9 +52,9 @@ typedef struct agent_data_t { static agent_data_t agent_data; -static jvmtiEnv* jvmti_env = NULL; -static JavaVM* jvm = NULL; -static JNIEnv* jni_env = NULL; +static jvmtiEnv* jvmti_env = nullptr; +static JavaVM* jvm = nullptr; +static JNIEnv* jni_env = nullptr; static volatile int currentAgentStatus = NSK_STATUS_PASSED; @@ -101,12 +101,12 @@ jvmtiEnv* nsk_jvmti_createJVMTIEnv(JavaVM* javaVM, void* reserved) { jvm = javaVM; if (!NSK_VERIFY(javaVM->GetEnv((void **)&jvmti_env, JVMTI_VERSION_1_1) == JNI_OK)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } if (!NSK_JVMTI_VERIFY(init_agent_data(jvmti_env, &agent_data))) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } return jvmti_env; @@ -114,7 +114,7 @@ jvmtiEnv* nsk_jvmti_createJVMTIEnv(JavaVM* javaVM, void* reserved) { /** Dispose JVMTI environment */ static int nsk_jvmti_disposeJVMTIEnv(jvmtiEnv* jvmti_env) { - if (jvmti_env != NULL) { + if (jvmti_env != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti_env->DisposeEnvironment())) { nsk_jvmti_setFailStatus(); return NSK_FALSE; @@ -153,7 +153,7 @@ agentThreadWrapper(jvmtiEnv* jvmti_env, JNIEnv* agentJNI, void* arg) { rawMonitorEnter(jvmti_env, agent_data.monitor); agent_data.thread_state = TERMINATED; agentJNI->DeleteGlobalRef(agentThread); - agentThread = NULL; + agentThread = nullptr; rawMonitorNotify(jvmti_env, agent_data.monitor); rawMonitorExit(jvmti_env, agent_data.monitor); @@ -167,31 +167,31 @@ static jthread startAgentThreadWrapper(JNIEnv *jni_env, jvmtiEnv* jvmti_env) { const char* THREAD_CTOR_NAME = ""; const char* THREAD_CTOR_SIGNATURE = "(Ljava/lang/String;)V"; - jobject threadName = NULL; - jclass threadClass = NULL; - jmethodID threadCtor = NULL; - jobject threadObject = NULL; - jobject threadGlobalRef = NULL; + jobject threadName = nullptr; + jclass threadClass = nullptr; + jmethodID threadCtor = nullptr; + jobject threadObject = nullptr; + jobject threadGlobalRef = nullptr; - if (!NSK_JNI_VERIFY(jni_env, (threadClass = jni_env->FindClass(THREAD_CLASS_NAME)) != NULL)) { - return NULL; + if (!NSK_JNI_VERIFY(jni_env, (threadClass = jni_env->FindClass(THREAD_CLASS_NAME)) != nullptr)) { + return nullptr; } if (!NSK_JNI_VERIFY(jni_env, (threadCtor = - jni_env->GetMethodID(threadClass, THREAD_CTOR_NAME, THREAD_CTOR_SIGNATURE)) != NULL)) - return NULL; + jni_env->GetMethodID(threadClass, THREAD_CTOR_NAME, THREAD_CTOR_SIGNATURE)) != nullptr)) + return nullptr; - if (!NSK_JNI_VERIFY(jni_env, (threadName = jni_env->NewStringUTF(THREAD_NAME)) != NULL)) - return NULL; + if (!NSK_JNI_VERIFY(jni_env, (threadName = jni_env->NewStringUTF(THREAD_NAME)) != nullptr)) + return nullptr; if (!NSK_JNI_VERIFY(jni_env, (threadObject = - jni_env->NewObject(threadClass, threadCtor, threadName)) != NULL)) - return NULL; + jni_env->NewObject(threadClass, threadCtor, threadName)) != nullptr)) + return nullptr; if (!NSK_JNI_VERIFY(jni_env, (threadGlobalRef = - jni_env->NewGlobalRef(threadObject)) != NULL)) { + jni_env->NewGlobalRef(threadObject)) != nullptr)) { jni_env->DeleteLocalRef(threadObject); - return NULL; + return nullptr; } agentThread = (jthread)threadGlobalRef; @@ -199,7 +199,7 @@ static jthread startAgentThreadWrapper(JNIEnv *jni_env, jvmtiEnv* jvmti_env) { jvmti_env->RunAgentThread(agentThread, &agentThreadWrapper, agentThreadArg, THREAD_PRIORITY))) { jni_env->DeleteGlobalRef(threadGlobalRef); jni_env->DeleteLocalRef(threadObject); - return NULL; + return nullptr; } return agentThread; } @@ -220,9 +220,9 @@ jthread nsk_jvmti_getAgentThread() { static jthread nsk_jvmti_runAgentThread(JNIEnv *jni_env, jvmtiEnv* jvmti_env) { /* start agent thread wrapper */ jthread thread = startAgentThreadWrapper(jni_env, jvmti_env); - if (thread == NULL) { + if (thread == nullptr) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } return thread; @@ -247,7 +247,7 @@ static jint syncDebuggeeStatus(JNIEnv* jni_env, jvmtiEnv* jvmti_env, jint debugg /* we don't enter if-stmt in second call */ if (agent_data.thread_state == NEW) { - if (nsk_jvmti_runAgentThread(jni_env, jvmti_env) == NULL) + if (nsk_jvmti_runAgentThread(jni_env, jvmti_env) == nullptr) goto monitor_exit_and_return; /* SP2.2-w - wait for agent thread */ @@ -371,31 +371,31 @@ Java_nsk_share_jvmti_DebugeeClass_resetAgentData(JNIEnv* jni_env, jclass cls) { /** Find loaded class by signature. */ jclass nsk_jvmti_classBySignature(const char signature[]) { - jclass* classes = NULL; + jclass* classes = nullptr; jint count = 0; - jclass foundClass = NULL; + jclass foundClass = nullptr; int i; - if (!NSK_VERIFY(signature != NULL)) { + if (!NSK_VERIFY(signature != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } if (!NSK_JVMTI_VERIFY(jvmti_env->GetLoadedClasses(&count, &classes))) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } for (i = 0; i < count; i++) { - char* sig = NULL; - char* generic = NULL; + char* sig = nullptr; + char* generic = nullptr; if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(classes[i], &sig, &generic))) { nsk_jvmti_setFailStatus(); break; } - if (sig != NULL && strcmp(signature, sig) == 0) { + if (sig != nullptr && strcmp(signature, sig) == 0) { foundClass = classes[i]; } @@ -405,19 +405,19 @@ jclass nsk_jvmti_classBySignature(const char signature[]) { break; } - if (foundClass != NULL) + if (foundClass != nullptr) break; } if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)classes))) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } if (!NSK_JNI_VERIFY(jni_env, (foundClass = (jclass) - jni_env->NewGlobalRef(foundClass)) != NULL)) { + jni_env->NewGlobalRef(foundClass)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } return foundClass; @@ -425,19 +425,19 @@ jclass nsk_jvmti_classBySignature(const char signature[]) { /** Find alive thread by name. */ jthread nsk_jvmti_threadByName(const char name[]) { - jthread* threads = NULL; + jthread* threads = nullptr; jint count = 0; - jthread foundThread = NULL; + jthread foundThread = nullptr; int i; - if (!NSK_VERIFY(name != NULL)) { + if (!NSK_VERIFY(name != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } if (!NSK_JVMTI_VERIFY(jvmti_env->GetAllThreads(&count, &threads))) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } for (i = 0; i < count; i++) { @@ -448,27 +448,27 @@ jthread nsk_jvmti_threadByName(const char name[]) { break; } - if (info.name != NULL && strcmp(name, info.name) == 0) { + if (info.name != nullptr && strcmp(name, info.name) == 0) { foundThread = threads[i]; } if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)info.name))) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } - if (foundThread != NULL) { + if (foundThread != nullptr) { break; } } if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)threads))) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } if (!NSK_JNI_VERIFY(jni_env, (foundThread = (jthread) - jni_env->NewGlobalRef(foundThread)) != NULL)) { + jni_env->NewGlobalRef(foundThread)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } return foundThread; @@ -507,7 +507,7 @@ int nsk_jvmti_addBreakpointCapabilities() { /** Find line location. */ jlocation nsk_jvmti_getLineLocation(jclass cls, jmethodID method, int line) { jint count = 0; - jvmtiLineNumberEntry* table = NULL; + jvmtiLineNumberEntry* table = nullptr; jlocation location = NSK_JVMTI_INVALID_JLOCATION; int i; @@ -574,7 +574,7 @@ int nsk_jvmti_enableEvents(jvmtiEventMode enable, int size, jvmtiEvent list[], j typedef jint (JNICALL *checkStatus_type)(JNIEnv* jni_env, jclass cls, jint debuggeeStatus); -static checkStatus_type checkStatus_func = NULL; +static checkStatus_type checkStatus_func = nullptr; /** * Proxy function to gain sequential access to checkStatus of each agent @@ -600,9 +600,9 @@ static void JNICALL nativeMethodBind(jvmtiEnv* jvmti_env, JNIEnv *jni_env, jvmtiPhase phase; jclass cls; - char *class_sig = NULL; - char *name = NULL; - char *sig = NULL; + char *class_sig = nullptr; + char *name = nullptr; + char *sig = nullptr; if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) { nsk_jvmti_setFailStatus(); @@ -612,12 +612,12 @@ static void JNICALL nativeMethodBind(jvmtiEnv* jvmti_env, JNIEnv *jni_env, if (phase != JVMTI_PHASE_START && phase != JVMTI_PHASE_LIVE) return; - if (NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(mid, &name, &sig, NULL))) { + if (NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(mid, &name, &sig, nullptr))) { if (strcmp(name, BIND_METHOD_NAME) == 0 && strcmp(sig, BIND_METHOD_SIGNATURE) == 0) { if (NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(mid, &cls)) - && NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(cls, &class_sig, NULL)) + && NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(cls, &class_sig, nullptr)) && strcmp(class_sig, BIND_CLASS_NAME) == 0 && address != (void*)Java_nsk_share_jvmti_DebugeeClass_checkStatus) { checkStatus_func = (checkStatus_type)address; @@ -626,13 +626,13 @@ static void JNICALL nativeMethodBind(jvmtiEnv* jvmti_env, JNIEnv *jni_env, } } - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (sig != NULL) + if (sig != nullptr) jvmti_env->Deallocate((unsigned char*)sig); - if (class_sig != NULL) + if (class_sig != nullptr) jvmti_env->Deallocate((unsigned char*)class_sig); } @@ -642,14 +642,14 @@ static void JNICALL nativeMethodBind(jvmtiEnv* jvmti_env, JNIEnv *jni_env, */ int nsk_jvmti_init_MA(jvmtiEventCallbacks* callbacks) { - if (callbacks == NULL) { - NSK_COMPLAIN0("callbacks should not be NULL\n"); + if (callbacks == nullptr) { + NSK_COMPLAIN0("callbacks should not be null\n"); nsk_jvmti_setFailStatus(); return NSK_FALSE; } - if (callbacks->NativeMethodBind != NULL) { - NSK_COMPLAIN0("callbacks.NativeMethodBind should be NULL\n"); + if (callbacks->NativeMethodBind != nullptr) { + NSK_COMPLAIN0("callbacks.NativeMethodBind should be null\n"); nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -667,7 +667,7 @@ int nsk_jvmti_init_MA(jvmtiEventCallbacks* callbacks) { return NSK_FALSE; if (!NSK_JVMTI_VERIFY( - jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL))) + jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr))) return NSK_FALSE; return NSK_TRUE; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.cpp index 6269379d8c7..98d82172679 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -79,7 +79,7 @@ Options* nsk_jvmti_aod_getMultiagentsOptions(jvmtiEnv *jvmti) { NSK_COMPLAIN1("Options for jvmtiEnv %p weren't found\n", jvmti); - return NULL; + return nullptr; } /* @@ -101,7 +101,7 @@ void nsk_jvmti_aod_deallocate(jvmtiEnv *jvmti, unsigned char* mem) { int nsk_jvmti_aod_getClassName(jvmtiEnv *jvmti, jclass klass, char classNameBuffer[]) { char* className; - if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &className, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &className, nullptr))) { NSK_COMPLAIN0("Failed to get class name\n"); classNameBuffer[0] = '\0'; return NSK_FALSE; @@ -161,25 +161,25 @@ jthread nsk_jvmti_aod_createThread(JNIEnv *jni) { jmethodID threadConstructor; jthread thread; - if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass("java/lang/Thread")) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass("java/lang/Thread")) != nullptr)) { NSK_COMPLAIN0("Failed to get the java.lang.Thread class\n"); - return NULL; + return nullptr; } if (!NSK_JNI_VERIFY(jni, - (threadConstructor = jni->GetMethodID(klass, "", "()V")) != NULL)) { + (threadConstructor = jni->GetMethodID(klass, "", "()V")) != nullptr)) { NSK_COMPLAIN0("Failed to get java.lang.Thread constructor\n"); - return NULL; + return nullptr; } if (!NSK_JNI_VERIFY (jni, - (thread = jni->NewObject(klass, threadConstructor, NULL)) != NULL)) { + (thread = jni->NewObject(klass, threadConstructor, nullptr)) != nullptr)) { NSK_COMPLAIN0("Failed to create Thread object\n"); - return NULL; + return nullptr; } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) { NSK_COMPLAIN0("Failed to create global reference\n"); - return NULL; + return nullptr; } return thread; @@ -191,28 +191,28 @@ jthread nsk_jvmti_aod_createThreadWithName(JNIEnv *jni, const char* threadName) jthread thread; jstring threadNameString; - if (!NSK_JNI_VERIFY(jni, (threadNameString = jni->NewStringUTF(threadName)) != NULL)) - return NULL; + if (!NSK_JNI_VERIFY(jni, (threadNameString = jni->NewStringUTF(threadName)) != nullptr)) + return nullptr; - if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass("java/lang/Thread")) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass("java/lang/Thread")) != nullptr)) { NSK_COMPLAIN0("Failed to get the java.lang.Thread class\n"); - return NULL; + return nullptr; } if (!NSK_JNI_VERIFY(jni, - (threadConstructor = jni->GetMethodID(klass, "", "(Ljava/lang/String;)V")) != NULL)) { + (threadConstructor = jni->GetMethodID(klass, "", "(Ljava/lang/String;)V")) != nullptr)) { NSK_COMPLAIN0("Failed to get java.lang.Thread constructor\n"); - return NULL; + return nullptr; } if (!NSK_JNI_VERIFY(jni, - (thread = jni->NewObject(klass, threadConstructor, threadNameString)) != NULL)) { + (thread = jni->NewObject(klass, threadConstructor, threadNameString)) != nullptr)) { NSK_COMPLAIN0("Failed to create Thread object\n"); - return NULL; + return nullptr; } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) { NSK_COMPLAIN0("Failed to create global reference\n"); - return NULL; + return nullptr; } return thread; @@ -230,8 +230,8 @@ int nsk_jvmti_aod_redefineClass( NSK_COMPLAIN1("Option '%s' isn't specified\n", PATH_TO_NEW_BYTE_CODE_OPTION); return NSK_FALSE; } - if (fileName == NULL) { - NSK_COMPLAIN0("File name is NULL\n"); + if (fileName == nullptr) { + NSK_COMPLAIN0("File name is null\n"); return NSK_FALSE; } { @@ -250,7 +250,7 @@ int nsk_jvmti_aod_redefineClass( bytecode = fopen(file, "rb"); error= JVMTI_ERROR_NONE; - if (bytecode == NULL) { + if (bytecode == nullptr) { NSK_COMPLAIN1("Error opening file '%s'\n", file); return NSK_FALSE; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/hotswap/HotSwap.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/hotswap/HotSwap.cpp index 97f30c106c0..5976eb39ec7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/hotswap/HotSwap.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/hotswap/HotSwap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,17 +59,17 @@ static int vm_mode = VM_MODE_COMPILED; static int bci_mode = BCI_MODE_EMCP; static int sync_freq = 0; -static jclass profile_klass = NULL; -static jfieldID count_field = NULL; +static jclass profile_klass = nullptr; +static jfieldID count_field = nullptr; /* test objects */ static int max_classes; -static char** names = NULL; -static jvmtiClassDefinition* old_class_def = NULL; -static jvmtiClassDefinition* new_class_def = NULL; +static char** names = nullptr; +static jvmtiClassDefinition* old_class_def = nullptr; +static jvmtiClassDefinition* new_class_def = nullptr; static int classCount = 0; /* lock to access classCount */ -static jrawMonitorID classLoadLock = NULL; +static jrawMonitorID classLoadLock = nullptr; static int newFlag = NSK_FALSE; /* ========================================================================== */ @@ -99,8 +99,8 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jint *new_class_data_len, unsigned char** new_class_data) { jint name_len; - if (name != NULL && - class_being_redefined == NULL && + if (name != nullptr && + class_being_redefined == nullptr && (strcmp(name, PROFILE_CLASS_NAME) != 0) && (strncmp(name, package_name, package_name_length) == 0)) { if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(classLoadLock))) { @@ -139,20 +139,20 @@ static void JNICALL CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, const void* code_addr, jint map_length, const jvmtiAddrLocationMap* map, const void* compile_info) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; CompiledMethodLoadEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY3("CompiledMethodLoad event: %s%s (0x%p)\n", name, signature, code_addr); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -175,20 +175,20 @@ Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, if (sync_freq && ((ExceptionEventsCount % sync_freq) == 0)) { if (nsk_getVerboseMode()) { - jclass klass = NULL; - char *signature = NULL; + jclass klass = nullptr; + char *signature = nullptr; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("Exception event %d: %s\n", ExceptionEventsCount.load(), signature); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -200,7 +200,7 @@ Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, if (vm_mode == VM_MODE_MIXED) { if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode( ((newFlag) ? JVMTI_DISABLE : JVMTI_ENABLE), - JVMTI_EVENT_SINGLE_STEP, NULL))) + JVMTI_EVENT_SINGLE_STEP, nullptr))) nsk_jvmti_setFailStatus(); } @@ -217,16 +217,16 @@ Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, /* ========================================================================== */ -static jrawMonitorID waitLock = NULL; +static jrawMonitorID waitLock = nullptr; static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { int i; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return NSK_FALSE; if (vm_mode != VM_MODE_COMPILED) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, nullptr))) return NSK_FALSE; } @@ -235,27 +235,27 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { for (i = 0; i < classCount; i++) { NSK_DISPLAY1("Find class: %s\n", names[i]); - if (!NSK_JNI_VERIFY(jni, (old_class_def[i].klass = jni->FindClass(names[i])) != NULL)) + if (!NSK_JNI_VERIFY(jni, (old_class_def[i].klass = jni->FindClass(names[i])) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (old_class_def[i].klass = (jclass) - jni->NewGlobalRef(old_class_def[i].klass)) != NULL)) + jni->NewGlobalRef(old_class_def[i].klass)) != nullptr)) return NSK_FALSE; } if (bci_mode != BCI_MODE_EMCP) { NSK_DISPLAY1("Find class: %s\n", PROFILE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (profile_klass = jni->FindClass(PROFILE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (profile_klass = jni->FindClass(PROFILE_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (profile_klass = (jclass) - jni->NewGlobalRef(profile_klass)) != NULL)) + jni->NewGlobalRef(profile_klass)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (count_field = jni->GetStaticFieldID(profile_klass, (bci_mode == BCI_MODE_CALL) ? "callCount" : "allocCount", - "I")) != NULL)) + "I")) != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->Allocate(classCount * sizeof(jvmtiClassDefinition), @@ -273,7 +273,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { } if (sync_freq) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, nullptr))) return NSK_FALSE; } @@ -318,7 +318,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; if (sync_freq) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION, nullptr))) nsk_jvmti_setFailStatus(); } else { @@ -333,7 +333,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (vm_mode == VM_MODE_MIXED) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( (((i % 2) == 0) ? JVMTI_DISABLE : JVMTI_ENABLE), - JVMTI_EVENT_SINGLE_STEP, NULL))) + JVMTI_EVENT_SINGLE_STEP, nullptr))) nsk_jvmti_setFailStatus(); } @@ -348,7 +348,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } if (vm_mode != VM_MODE_COMPILED) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, nullptr))) nsk_jvmti_setFailStatus(); } @@ -360,7 +360,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /** Agent library initialization. */ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; const char* optValue; @@ -388,7 +388,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { package_name = nsk_jvmti_findOptionStringValue("package", DEFAULT_PACKAGE_NAME); - if (!NSK_VERIFY(package_name != NULL)) + if (!NSK_VERIFY(package_name != nullptr)) return JNI_ERR; NSK_DISPLAY1("package: %s\n", package_name); @@ -403,7 +403,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY1("classes: %d\n", max_classes); optValue = nsk_jvmti_findOptionValue("mode"); - if (optValue != NULL) { + if (optValue != nullptr) { if (strcmp(optValue, "compiled") == 0) vm_mode = VM_MODE_COMPILED; else if (strcmp(optValue, "interpreted") == 0) @@ -417,7 +417,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } optValue = nsk_jvmti_findOptionValue("bci"); - if (optValue != NULL) { + if (optValue != nullptr) { if (strcmp(optValue, "emcp") == 0) bci_mode = BCI_MODE_EMCP; else if (strcmp(optValue, "call") == 0) @@ -437,7 +437,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* allocate tables for classes */ @@ -464,7 +464,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* set event callbacks */ @@ -481,9 +481,9 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* enable events */ - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp index 2a9931971b5..bf48fd1da73 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -131,13 +131,13 @@ JNIEXPORT jboolean JNICALL Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects jboolean fCopy; const char * s; - if (!NSK_VERIFY((s = jni->GetStringUTFChars(sInfo, &fCopy)) != NULL)) { + if (!NSK_VERIFY((s = jni->GetStringUTFChars(sInfo, &fCopy)) != nullptr)) { NSK_COMPLAIN1("Can't get string at %#p\n", sInfo); return JNI_FALSE; } if (!s) { - NSK_COMPLAIN1("Can't get string at %#p: NULL\n", sInfo); + NSK_COMPLAIN1("Can't get string at %#p: null\n", sInfo); return JNI_FALSE; } @@ -193,7 +193,7 @@ static RefToVerify * findRefToVerify(jlong tagFrom, jlong tagTo, jint refKind) } } - return NULL; + return nullptr; } static jboolean addRefToVerify(jlong tagFrom, jlong tagTo, jint refKind, int expectedCount, int actualCount) @@ -238,7 +238,7 @@ JNIEXPORT jboolean JNICALL Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects } pRefRec = findRefToVerify(tagFrom, tagTo, refKind); - if (pRefRec != NULL) { + if (pRefRec != nullptr) { pRefRec->_expectedCount += count; return JNI_TRUE; } @@ -251,7 +251,7 @@ jboolean markRefToVerify(jlong tagFrom, jlong tagTo, int refKind) RefToVerify * pRefRec; pRefRec = findRefToVerify(tagFrom, tagTo, refKind); - if (pRefRec != NULL) { + if (pRefRec != nullptr) { pRefRec->_actualCount++; return JNI_TRUE; } @@ -380,14 +380,14 @@ jint JNICALL wrongStringPrimitiveValueCallback( void jvmti_FollowRefObject_init() { - g_wrongHeapCallbacks.heap_iteration_callback = NULL; + g_wrongHeapCallbacks.heap_iteration_callback = nullptr; g_wrongHeapCallbacks.heap_reference_callback = wrongHeapReferenceCallback; g_wrongHeapCallbacks.primitive_field_callback = wrongPrimitiveFieldCallback; g_wrongHeapCallbacks.array_primitive_value_callback = wrongArrayPrimitiveValueCallback; g_wrongHeapCallbacks.string_primitive_value_callback = wrongStringPrimitiveValueCallback; - Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_resetTags(NULL, NULL); - Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_resetRefsToVerify(NULL, NULL); + Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_resetTags(nullptr, nullptr); + Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_resetRefsToVerify(nullptr, nullptr); } /* ============================================================================= */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp index 444e5c55d1f..e07c453fd0e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -100,9 +100,9 @@ static int check_option(int dashed, const char name[], const char value[]) { return NSK_FALSE; } { - char* end = NULL; + char* end = nullptr; long n = strtol(value, &end, 10); - if (end == NULL || end == value || *end != '\0') { + if (end == nullptr || end == value || *end != '\0') { nsk_complain("nsk_jvmti_parseOptions(): not integer value in option: %s=%s\n", name, value); return NSK_FALSE; } @@ -140,7 +140,7 @@ static int add_option(const char opt[], int opt_len, const char val[], int val_l name = (char*)malloc(opt_len + 1); value = (char*)malloc(val_len + 1); - if (name == NULL || value == NULL) { + if (name == nullptr || value == nullptr) { nsk_complain("nsk_jvmti_parseOptions(): out of memory\n"); success = NSK_FALSE; } else { @@ -166,9 +166,9 @@ static int add_option(const char opt[], int opt_len, const char val[], int val_l } if (!success) { - if (name != NULL) + if (name != nullptr) free(name); - if (value != NULL) + if (value != nullptr) free(value); } @@ -184,9 +184,9 @@ static void nsk_jvmti_free() { } context.options.count = 0; } - if (context.options.string != NULL) { + if (context.options.string != nullptr) { free(context.options.string); - context.options.string = NULL; + context.options.string = nullptr; } } @@ -198,18 +198,18 @@ static char* token(char **s, const char *delim) { char *p; char *start = *s; - if (s == NULL || *s == NULL) { - return NULL; + if (s == nullptr || *s == nullptr) { + return nullptr; } p = strpbrk(*s, delim); - if (p != NULL) { + if (p != nullptr) { /* Advance to next token. */ *p = '\0'; *s = p + 1; } else { /* End of tokens. */ - *s = NULL; + *s = nullptr; } return start; @@ -218,11 +218,11 @@ static char* token(char **s, const char *delim) { int nsk_jvmti_parseOptions(const char options[]) { int success = NSK_TRUE; - char *str = NULL; - char *name = NULL; - char *value = NULL; + char *str = nullptr; + char *name = nullptr; + char *value = nullptr; const char *delimiters = " ,~"; - if (options == NULL) + if (options == nullptr) return success; /* @@ -233,10 +233,10 @@ int nsk_jvmti_parseOptions(const char options[]) { /* Create a temporary copy of the options string to be tokenized. */ str = strdup(options); - while ((name = token(&str, delimiters)) != NULL) { + while ((name = token(&str, delimiters)) != nullptr) { value = strchr(name, '='); - if (value != NULL) { + if (value != nullptr) { *value++ = '\0'; } if (!add_option(name, (int)strlen(name), value, @@ -248,7 +248,7 @@ int nsk_jvmti_parseOptions(const char options[]) { if (!success) { nsk_jvmti_free(); } - if (str != NULL) { + if (str != nullptr) { free(str); } return success; @@ -257,45 +257,45 @@ int nsk_jvmti_parseOptions(const char options[]) { /*************************************************************/ /** - * Returns value of given option name; or NULL if no such option found. - * If search name is NULL then complains an error and returns NULL. + * Returns value of given option name; or nullptr if no such option found. + * If search name is nullptr then complains an error and returns nullptr. */ const char* nsk_jvmti_findOptionValue(const char name[]) { int i; - if (name == NULL) { - nsk_complain("nsk_jvmti_findOptionValue(): option name is NULL\n"); - return NULL; + if (name == nullptr) { + nsk_complain("nsk_jvmti_findOptionValue(): option name is null\n"); + return nullptr; } for (i = 0; i < context.options.count; i++) { if (strcmp(name, context.options.names[i]) == 0) return context.options.values[i]; } - return NULL; + return nullptr; } /** * Returns string value of given option; or defaultValue if no such option found. - * If options is specified but has empty value then complains an error and returns NULL. + * If options is specified but has empty value then complains an error and returns nullptr. */ const char* nsk_jvmti_findOptionStringValue(const char name[], const char* defaultValue) { const char* value; - if (name == NULL) { - nsk_complain("nsk_jvmti_findOptionStringValue(): option name is NULL\n"); - return NULL; + if (name == nullptr) { + nsk_complain("nsk_jvmti_findOptionStringValue(): option name is null\n"); + return nullptr; } value = nsk_jvmti_findOptionValue(name); - if (value == NULL) { + if (value == nullptr) { return defaultValue; } if (strlen(value) <= 0) { nsk_complain("nsk_jvmti_findOptionStringValue(): empty value of option: %s=%s\n", name, value); - return NULL; + return nullptr; } return value; } @@ -307,13 +307,13 @@ const char* nsk_jvmti_findOptionStringValue(const char name[], const char* defau int nsk_jvmti_findOptionIntValue(const char name[], int defaultValue) { const char* value; - if (name == NULL) { - nsk_complain("nsk_jvmti_findOptionIntValue(): option name is NULL\n"); + if (name == nullptr) { + nsk_complain("nsk_jvmti_findOptionIntValue(): option name is null\n"); return -1; } value = nsk_jvmti_findOptionValue(name); - if (value == NULL) { + if (value == nullptr) { return defaultValue; } @@ -324,10 +324,10 @@ int nsk_jvmti_findOptionIntValue(const char name[], int defaultValue) { } { - char* endptr = NULL; + char* endptr = nullptr; int n = strtol(value, &endptr, 10); - if (endptr == NULL || *endptr != '\0') { + if (endptr == nullptr || *endptr != '\0') { nsk_complain("nsk_jvmti_findOptionIntValue(): not integer value of option: %s=%s\n", name, value); return -1; @@ -345,24 +345,24 @@ int nsk_jvmti_getOptionsCount() { /** * Returns name of i-th parsed option. - * If no such option then complains an error and returns NULL. + * If no such option then complains an error and returns nullptr. */ const char* nsk_jvmti_getOptionName(int i) { if (i < 0 || i >= context.options.count) { nsk_complain("nsk_jvmti_getOptionName(): option index out of bounds: %d\n", i); - return NULL; + return nullptr; } return context.options.names[i]; } /** * Returns value of i-th parsed option. - * If no such option then complains an error and returns NULL. + * If no such option then complains an error and returns nullptr. */ const char* nsk_jvmti_getOptionValue(int i) { if (i < 0 || i >= context.options.count) { nsk_complain("nsk_jvmti_getOptionValue(): option index out of bounds: %d\n", i); - return NULL; + return nullptr; } return context.options.values[i]; } @@ -414,10 +414,10 @@ int nsk_jvmti_lverify(int positive, jvmtiError error, jvmtiError expected, JNIEXPORT jstring JNICALL Java_nsk_share_jvmti_ArgumentHandler_getAgentOptionsString(JNIEnv *jni, jobject obj) { - jstring str_obj = NULL; + jstring str_obj = nullptr; - if (!NSK_JNI_VERIFY(jni, (str_obj = jni->NewStringUTF(context.options.string)) != NULL)) { - return NULL; + if (!NSK_JNI_VERIFY(jni, (str_obj = jni->NewStringUTF(context.options.string)) != nullptr)) { + return nullptr; } return str_obj; } @@ -453,13 +453,13 @@ int nsk_jvmti_redefineClass(jvmtiEnv * jvmti, jclass classToRedefine, const char * fileName) { redefineAttempted = NSK_TRUE; - if (nsk_jvmti_findOptionValue(NSK_JVMTI_OPT_PATH_TO_NEW_BYTE_CODE) == NULL) { + if (nsk_jvmti_findOptionValue(NSK_JVMTI_OPT_PATH_TO_NEW_BYTE_CODE) == nullptr) { nsk_printf("# error expected: %s \n", NSK_JVMTI_OPT_PATH_TO_NEW_BYTE_CODE); nsk_printf("Hint :: missing java -agentlib:agentlib=%s=DirName, ($TESTBASE/bin) \n", NSK_JVMTI_OPT_PATH_TO_NEW_BYTE_CODE); return NSK_FALSE; } - if (fileName == NULL) { + if (fileName == nullptr) { nsk_printf("# error file name expected did not found \n"); return NSK_FALSE; } @@ -479,7 +479,7 @@ int nsk_jvmti_redefineClass(jvmtiEnv * jvmti, bytecode = fopen(file, "rb"); error= JVMTI_ERROR_NONE; - if (bytecode == NULL) { + if (bytecode == nullptr) { nsk_printf("# error **Agent::error opening file %s \n",file); return NSK_FALSE; } @@ -594,7 +594,7 @@ int suspendThreadAtMethod(jvmtiEnv *jvmti, jclass cls, jobject thread, jmethodID } int result = NSK_TRUE; - jmethodID method = NULL; + jmethodID method = nullptr; jlocation loc; // We need to ensure that the thread is suspended at the right place when the top diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/unit/Heap.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/unit/Heap.cpp index fe7f3f16f16..8306fd07c5e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/unit/Heap.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/unit/Heap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ static jboolean user_data_error_flag = JNI_FALSE; static jvmtiEventObjectFree object_free_callback; static void JNICALL default_object_free(jvmtiEnv *env, jlong tag) { - if (object_free_callback != NULL) { + if (object_free_callback != nullptr) { (*object_free_callback)(env, tag); } } @@ -58,9 +58,9 @@ static jvmtiIterationControl JNICALL default_heap_object_callback } static jvmtiHeapObjectCallback heap_object_callback = default_heap_object_callback; -static jvmtiHeapRootCallback heap_root_callback = NULL; -static jvmtiStackReferenceCallback stack_ref_callback = NULL; -static jvmtiObjectReferenceCallback object_ref_callback = NULL; +static jvmtiHeapRootCallback heap_root_callback = nullptr; +static jvmtiStackReferenceCallback stack_ref_callback = nullptr; +static jvmtiObjectReferenceCallback object_ref_callback = nullptr; /* * Basic tagging functions @@ -182,13 +182,13 @@ JNIEXPORT jint JNICALL Java_nsk_share_jvmti_unit_Heap_getObjectsWithTags /* get rid of any arrays that we are holding from a previous call */ - if (object_results_ref != NULL) { + if (object_results_ref != nullptr) { env->DeleteGlobalRef(object_results_ref); - object_results_ref = NULL; + object_results_ref = nullptr; } - if (tag_results_ref != NULL) { + if (tag_results_ref != nullptr) { env->DeleteGlobalRef(tag_results_ref); - tag_results_ref = NULL; + tag_results_ref = nullptr; } /* copy input list-of-tags from java into C */ @@ -210,7 +210,7 @@ JNIEXPORT jint JNICALL Java_nsk_share_jvmti_unit_Heap_getObjectsWithTags cls = env->FindClass("java/lang/Object"); - object_array = env->NewObjectArray(count, cls, NULL); + object_array = env->NewObjectArray(count, cls, nullptr); tag_array = env->NewLongArray(count); for (i=0; iSetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, nullptr); if (err != JVMTI_ERROR_NONE) { fprintf(stderr, "SetEventNotificationMode failed, error=%d\n", err); return -1; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp index c6e95b11f78..d17856ee22a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -73,12 +73,12 @@ typedef /***************************************************************/ /** - * Return a new thread mirror, or NULL if failed. + * Return a new thread mirror, or nullptr if failed. */ void* THREAD_new(PROCEDURE procedure, void* context) { THREAD* thread = (THREAD*)malloc(sizeof(THREAD)); - if (thread == NULL) - return NULL; + if (thread == nullptr) + return nullptr; thread->procedure = procedure; thread->context = context; thread->started = 0; /* No */ @@ -102,30 +102,30 @@ void* procedure(void* t) { } /** - * Return the thread if started OK, or NULL if failed. + * Return the thread if started OK, or nullptr if failed. */ void* THREAD_start(void* t) { THREAD* thread = (THREAD*)t; - if (thread == NULL) - return NULL; + if (thread == nullptr) + return nullptr; if (thread->started != 0) - return NULL; + return nullptr; /* thread->started = 0; -- not yet */ thread->finished = 0; thread->status = 0; { #ifdef windows - uintptr_t result = _beginthreadex(NULL,0,procedure,thread,0,&(thread->id)); + uintptr_t result = _beginthreadex(nullptr,0,procedure,thread,0,&(thread->id)); if (result == 0) { perror("failed to create a native thread"); - return NULL; + return nullptr; } #elif sun - int result = thr_create(NULL,0,procedure,thread,0,&(thread->id)); + int result = thr_create(nullptr,0,procedure,thread,0,&(thread->id)); if (result != 0) { perror("failed to create a native thread"); - return NULL; + return nullptr; } #else // !windows & !sun pthread_attr_t attr; @@ -135,7 +135,7 @@ void* THREAD_start(void* t) { int result = pthread_create(&(thread->id), &attr, procedure, thread); if (result != 0) { perror("failed to create a native thread"); - return NULL; + return nullptr; } pthread_attr_destroy(&attr); #endif // !windows & !sun @@ -147,11 +147,11 @@ void* THREAD_start(void* t) { /** * Return 1 if the thread has been started, or 0 if not, - * or -1 if thread == NULL. + * or -1 if thread == nullptr. */ int THREAD_isStarted(void* t) { THREAD* thread = (THREAD*)t; - if (thread == NULL) + if (thread == nullptr) return -1; return (thread->started == 1); } @@ -159,11 +159,11 @@ int THREAD_isStarted(void* t) { /** * 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 -1 if thread == NULL. + * or -1 if thread == nullptr. */ int THREAD_hasFinished(void* t) { THREAD* thread = (THREAD*)t; - if (thread == NULL) + if (thread == nullptr) return -1; return (thread->finished == 1); } @@ -171,11 +171,11 @@ int THREAD_hasFinished(void* t) { /** * Return thread->status if thread has finished, * or return 0 if thread hasn't finished, - * or retuen -1 if thread == NULL. + * or retuen -1 if thread == nullptr. */ int THREAD_status(void* t) { THREAD* thread = (THREAD*)t; - if (thread == NULL) + if (thread == nullptr) return -1; return thread->status; } @@ -184,11 +184,11 @@ int THREAD_status(void* t) { /** * Cycle with 1 second sleeps until the thread has finished; - * or return immediately, if thread == NULL. + * or return immediately, if thread == nullptr. */ void THREAD_waitFor(void* t) { THREAD* thread = (THREAD*)t; - if (thread == NULL) + if (thread == nullptr) return; while (thread->finished == 0) THREAD_sleep(1); /* yield for a second */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp index 74f2416dfce..63708bd84f4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,16 +48,16 @@ const void* nsk_list_create() { /* create nsk_list_info */ list_info = (nsk_list_info *)malloc(sizeof(nsk_list_info)); - if (list_info == NULL) { - return NULL; + if (list_info == nullptr) { + return nullptr; } list_info->allocated_count = NSK_LIST_INIT_COUNT; list_info->elements_count = 0; list_info->arr = (const void **)malloc(list_info->allocated_count * nsk_list_size_void); - if (list_info->arr == NULL) { + if (list_info->arr == nullptr) { free(list_info); - return NULL; + return nullptr; } return list_info; @@ -84,7 +84,7 @@ int nsk_list_add(const void *plist, const void *p) { if (list_info->elements_count >= list_info->allocated_count) { list_info->allocated_count += NSK_LIST_INIT_COUNT; list_info->arr = (const void **)realloc((void *)list_info->arr, list_info->allocated_count * nsk_list_size_void); - if (list_info->arr == NULL) { + if (list_info->arr == nullptr) { return NSK_FALSE; } } @@ -131,7 +131,7 @@ const void* nsk_list_get(const void *plist, int i) { return list_info->arr[i]; } - return NULL; + return nullptr; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.cpp index d057e364dea..305317ffffa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ MUTEX* MUTEX_create() MUTEX* mutex = (MUTEX*)malloc(sizeof(pthread_mutex_t)); if (mutex) { - pthread_mutex_init((pthread_mutex_t*)mutex, NULL); + pthread_mutex_init((pthread_mutex_t*)mutex, nullptr); } return mutex; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp index 91992159a96..3ba69427fd6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,8 +67,8 @@ static const char* file_basename(const char* fullname) { const char* p; const char* base = fullname;; - if (fullname == NULL) - return NULL; + if (fullname == nullptr) + return nullptr; for (p = fullname; *p != '\0'; p++) { if (*p == '/' || *p == '\\') @@ -82,7 +82,7 @@ static const char* file_basename(const char* fullname) { void nsk_display(const char format[], ...) { va_list ap; va_start(ap,format); - nsk_lvdisplay(NULL,0,format,ap); + nsk_lvdisplay(nullptr,0,format,ap); va_end(ap); } @@ -94,14 +94,14 @@ void nsk_ldisplay(const char file[], int line, const char format[], ...) { } void nsk_vdisplay(const char format[], va_list ap) { - nsk_lvdisplay(NULL,0,format,ap); + nsk_lvdisplay(nullptr,0,format,ap); } void nsk_lvdisplay(const char file[], int line, const char format[], va_list ap) { if (!nsk_context.verbose) return; - if (file != NULL) + if (file != nullptr) (void) nsk_printf("- %s, %d: ",file_basename(file),line); (void) nsk_vprintf(format,ap); } @@ -111,7 +111,7 @@ void nsk_lvdisplay(const char file[], int line, const char format[], va_list ap) void nsk_complain(const char format[], ...) { va_list ap; va_start(ap,format); - nsk_lvcomplain(NULL,0,format,ap); + nsk_lvcomplain(nullptr,0,format,ap); va_end(ap); } @@ -124,7 +124,7 @@ void nsk_lcomplain(const char file[], int line, const char format[], ...) } void nsk_vcomplain(const char format[], va_list ap) { - nsk_lvcomplain(NULL,0,format,ap); + nsk_lvcomplain(nullptr,0,format,ap); } void nsk_lvcomplain(const char file[], int line, @@ -157,7 +157,7 @@ void nsk_lvcomplain(const char file[], int line, strncpy(msg_buf2, msg_buf, sizeof(msg_buf2)); // Only include up to the 1st newline in the exception's error message. nl_ptr = strchr(msg_buf2, '\n'); - if (nl_ptr != NULL) { + if (nl_ptr != nullptr) { nl_ptr++; // Skip past the newline char. *nl_ptr = '\0'; // Terminate the string after the newline char. } else if (strlen(msg_buf2) != 0) { @@ -165,14 +165,14 @@ void nsk_lvcomplain(const char file[], int line, } (void) nsk_printf("The following fake exception stacktrace is for failure analysis. \n"); (void) nsk_printf("nsk.share.Fake_Exception_for_RULE_Creation: "); - if (file != NULL) { + if (file != nullptr) { (void) nsk_printf("(%s:%d) ", file_basename(file), line); } (void) nsk_printf(msg_buf2); (void) nsk_printf("\tat nsk_lvcomplain(%s:%d)\n", file_basename(__FILE__), __LINE__); } - if (file != NULL) { + if (file != nullptr) { (void) nsk_printf("# ERROR: %s, %d: ", file_basename(file), line); } else { (void) nsk_printf("# ERROR: "); @@ -265,7 +265,7 @@ void nsk_printHexBytes(const char indent[], int columns, size_t i; - if (size <= 0 || bytes == NULL) + if (size <= 0 || bytes == nullptr) return; for (i = 0; i < size; i += columns) { @@ -298,7 +298,7 @@ void nsk_printHexBytes(const char indent[], int columns, /*************************************************************/ const char* nsk_null_string(const char* str) { - return (str == NULL)? "" : str; + return (str == nullptr)? "" : str; } /*************************************************************/ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/gclocker/libgcl001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/gclocker/libgcl001.cpp index 54b9e9df6e4..773b2aae28b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/gclocker/libgcl001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/gclocker/libgcl001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,22 +37,22 @@ #define BODY(type) \ int hash = 0; \ jsize i, arraySize, stringSize; \ - jchar *nativeStr = NULL; \ - type *nativeArray = NULL; \ + jchar *nativeStr = nullptr; \ + type *nativeArray = nullptr; \ \ arraySize = env->GetArrayLength(array); CE \ stringSize = env->GetStringLength(str); CE \ \ - nativeArray = (type *)env->GetPrimitiveArrayCritical(array, NULL); CE \ + nativeArray = (type *)env->GetPrimitiveArrayCritical(array, nullptr); CE \ qsort(nativeArray, arraySize, sizeof(type), *type##comp); \ \ - nativeStr = (jchar *)env->GetStringCritical(str, NULL); CE \ + nativeStr = (jchar *)env->GetStringCritical(str, nullptr); CE \ \ for (i = 0; i < stringSize; ++i) \ hash += (int)nativeStr[i]; \ env->ReleaseStringCritical(str, nativeStr); CE \ \ - nativeStr = (jchar *)env->GetStringCritical(str, NULL); CE \ + nativeStr = (jchar *)env->GetStringCritical(str, nullptr); CE \ \ env->ReleasePrimitiveArrayCritical(array, nativeArray, 0); CE \ \ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress001.cpp index 2e056006824..2eaba727ff4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -108,8 +108,8 @@ Java_nsk_stress_jni_JNIter001_jnistress (JNIEnv *env, jobject jobj, jstring jstr } if (memcmp(digest, element->checkstr[j], DIGESTLENGTH) == 0) { env->ReleaseStringUTFChars(jstr, element->str[j]); CE - element->str[j] = NULL; - element->checkstr[j] = NULL; + element->str[j] = nullptr; + element->checkstr[j] = nullptr; } else { compared = 0; printf("The element No. %d has been corrupted %s vs %s\n", j, @@ -217,8 +217,8 @@ Java_nsk_stress_jni_JNIter001_jnistress1(JNIEnv *env, jobject jobj, jstring jstr free(elem); if (memcmp(digest, javachars->checkstr[j], javachars->size[j]) == 0) { env->ReleaseStringChars(jstr, javachars->str[j]); CE - javachars->str[j] = NULL; - javachars->checkstr[j] = NULL; + javachars->str[j] = nullptr; + javachars->checkstr[j] = nullptr; javachars->size[j] = 0; } else { equal = 0; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress003.cpp index 7bccbc95900..7fa25b831c2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -141,8 +141,8 @@ Java_nsk_stress_jni_JNIter003_jniBodyChangeArray (JNIEnv *env, jobject jobj, jdouble *doubleOrig, *doubleClone; int i; - if ((orig == NULL) || (clone == NULL)) { - fprintf(stderr, "JNI received a NULL array from Java\n"); + if ((orig == nullptr) || (clone == nullptr)) { + fprintf(stderr, "JNI received a null array from Java\n"); return JNI_FALSE; } if (count == limit) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp index 4cc89978fd1..77f83b374c0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ JNI_OnLoad(JavaVM *vm, void *reserved) FIND_CLASS(stackOverflowErrorClass, "java/lang/StackOverflowError"); stackOverflowErrorClass = (jclass) env->NewGlobalRef(stackOverflowErrorClass); - if (stackOverflowErrorClass == NULL) { + if (stackOverflowErrorClass == nullptr) { printf("Can't create global ref for stack overflow class\n"); return 0; } @@ -56,7 +56,7 @@ JNI_OnUnload(JavaVM *vm, void *reserved) JNIEnv *env; if (vm->GetEnv((void **) &env, JNI_VERSION) != JNI_OK) { - if (stackOverflowErrorClass != NULL) { + if (stackOverflowErrorClass != nullptr) { env->DeleteGlobalRef(stackOverflowErrorClass); } } else { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace006.cpp index 9b5329f2cb9..a70030fb095 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ JNI_OnLoad(JavaVM *vm, void *reserved) FIND_CLASS(stackOverflowErrorClass, "java/lang/StackOverflowError"); stackOverflowErrorClass = (jclass) env->NewGlobalRef(stackOverflowErrorClass); - if (stackOverflowErrorClass == NULL) { + if (stackOverflowErrorClass == nullptr) { printf("Can't create global ref for stack overflow class\n"); return 0; } @@ -58,7 +58,7 @@ JNI_OnUnload(JavaVM *vm, void *reserved) JNIEnv *env; if (vm->GetEnv((void **) &env, JNI_VERSION) != JNI_OK) { - if (stackOverflowErrorClass != NULL) { + if (stackOverflowErrorClass != nullptr) { env->DeleteGlobalRef(stackOverflowErrorClass); } } else { diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/share/IndyRedefineClass.cpp b/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/share/IndyRedefineClass.cpp index 2f4cefd19b5..04d4c6094cc 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/share/IndyRedefineClass.cpp +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/share/IndyRedefineClass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { -static jvmtiEnv* gJvmtiEnv = NULL; +static jvmtiEnv* gJvmtiEnv = nullptr; static jboolean gIsMethodEntryWorking = JNI_FALSE; static jboolean gIsSingleStepWorking = JNI_FALSE; @@ -88,13 +88,13 @@ static void popFrameLogic(jvmtiEnv * jvmti_env, jthread thread) { if (tls->countOfFramesToPop <= 0) { NSK_DISPLAY0("Disabling single step\n"); - if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, nullptr))) gIsErrorOccured = JNI_TRUE; } else { NSK_DISPLAY0("Enabling single step\n"); - if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, nullptr))) gIsErrorOccured = JNI_TRUE; if (tls->countOfFramesToPop == 1) { @@ -132,7 +132,7 @@ MethodEntry(jvmtiEnv *jvmti_env, } NSK_DISPLAY2("Entering redefine tigger method: %s.%s\n", mn->classSig, mn->methodName); - free(mn); mn = NULL; + free(mn); mn = nullptr; if (gIsClassRedefined) { NSK_DISPLAY0("Class is already redefined.\n"); @@ -168,7 +168,7 @@ SingleStep(jvmtiEnv *jvmti_env, gIsSingleStepWorking = JNI_TRUE; locStr = locationToString(jvmti_env, method, location); - if (locStr == NULL) { + if (locStr == nullptr) { NSK_DISPLAY0("Error in Single step event: locationToString failed\n"); gIsErrorOccured = JNI_TRUE; } else { @@ -186,7 +186,7 @@ jint Agent_Initialize(JavaVM * vm, char * options, void * reserved) { if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; - if (!NSK_VERIFY((gJvmtiEnv = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL)) + if (!NSK_VERIFY((gJvmtiEnv = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr)) return JNI_ERR; if (nsk_jvmti_findOptionValue("debuggerCompatible")) { @@ -210,10 +210,10 @@ jint Agent_Initialize(JavaVM * vm, char * options, void * reserved) { if (!NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventCallbacks(&callbacks, sizeof(callbacks)))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) + if (!NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL))) + if (!NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/stepBreakPopReturn/stepBreakPopReturn.cpp b/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/stepBreakPopReturn/stepBreakPopReturn.cpp index bcae1379e45..3221037484b 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/stepBreakPopReturn/stepBreakPopReturn.cpp +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/stepBreakPopReturn/stepBreakPopReturn.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ extern "C" { -static jvmtiEnv* gJvmtiEnv = NULL; +static jvmtiEnv* gJvmtiEnv = nullptr; static char * gszDebuggeeMethodName = (char*) "NONE"; static char * gszDebuggeeClassName = (char*) "NONE"; @@ -89,7 +89,7 @@ MethodEntry(jvmtiEnv *jvmti_env, gIsMethodEntryWorking = JNI_TRUE; if (!gIsBreakpointSet) - NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL)); + NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, nullptr)); } } @@ -108,7 +108,7 @@ SingleStep(jvmtiEnv *jvmti_env, locStr = locationToString(jvmti_env, method, location); - if (locStr == NULL) { + if (locStr == nullptr) { NSK_DISPLAY0("Error: Single step event has no location\n"); gErrorHappened = JNI_TRUE; } else { @@ -116,13 +116,13 @@ SingleStep(jvmtiEnv *jvmti_env, free(locStr); } - NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL)); + NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, nullptr)); if (!gIsDebuggerCompatible) { if (!NSK_JVMTI_VERIFY(jvmti_env->SetBreakpoint(method, location))) return; - NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL)); + NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr)); gIsBreakpointSet = JNI_TRUE; NSK_DISPLAY0("Pop a frame\n"); @@ -150,7 +150,7 @@ Breakpoint(jvmtiEnv *jvmti_env, gIsBreakpointWorking = JNI_TRUE; locStr = locationToString(jvmti_env, method, location); - if (locStr == NULL) { + if (locStr == nullptr) { NSK_DISPLAY0("Error: Breakpoint event has no location\n"); gErrorHappened = JNI_TRUE; } else { @@ -159,7 +159,7 @@ Breakpoint(jvmtiEnv *jvmti_env, } NSK_JVMTI_VERIFY(jvmti_env->ClearBreakpoint(method, location)); - NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_BREAKPOINT, NULL)); + NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_BREAKPOINT, nullptr)); gIsBreakpointSet = JNI_FALSE; NSK_DISPLAY0("Forcing early return.\n"); @@ -173,7 +173,7 @@ jint Agent_Initialize(JavaVM * vm, char * options, void * reserved) { if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; - if (!NSK_VERIFY((gJvmtiEnv = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL)) + if (!NSK_VERIFY((gJvmtiEnv = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr)) return JNI_ERR; if (nsk_jvmti_findOptionValue("debuggerCompatible")) { @@ -198,7 +198,7 @@ jint Agent_Initialize(JavaVM * vm, char * options, void * reserved) { if (!NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventCallbacks(&callbacks, sizeof(callbacks)))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) + if (!NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/nativeAndMH.cpp b/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/nativeAndMH.cpp index 4124b7fb8e7..27dfa84dead 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/nativeAndMH.cpp +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/nativeAndMH.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,16 +48,16 @@ Java_vm_mlvm_meth_stress_jni_nativeAndMH_Test_native01( jobjectArray arguments; jobject result; - if (!NSK_JNI_VERIFY(pEnv, (mhClass = pEnv->GetObjectClass(mhToCall)) != NULL)) - return NULL; + if (!NSK_JNI_VERIFY(pEnv, (mhClass = pEnv->GetObjectClass(mhToCall)) != nullptr)) + return nullptr; - if (!NSK_JNI_VERIFY(pEnv, NULL != (mid = pEnv->GetMethodID(mhClass, "invokeWithArguments", "([Ljava/lang/Object;)Ljava/lang/Object;")))) - return NULL; + if (!NSK_JNI_VERIFY(pEnv, nullptr != (mid = pEnv->GetMethodID(mhClass, "invokeWithArguments", "([Ljava/lang/Object;)Ljava/lang/Object;")))) + return nullptr; - NSK_JNI_VERIFY(pEnv, NULL != (objectClass = pEnv->FindClass("java/lang/Object"))); + NSK_JNI_VERIFY(pEnv, nullptr != (objectClass = pEnv->FindClass("java/lang/Object"))); - if (!NSK_JNI_VERIFY(pEnv, NULL != (arguments = pEnv->NewObjectArray(ARGS_COUNT, objectClass, NULL)))) - return NULL; + if (!NSK_JNI_VERIFY(pEnv, nullptr != (arguments = pEnv->NewObjectArray(ARGS_COUNT, objectClass, nullptr)))) + return nullptr; NSK_JNI_VERIFY_VOID(pEnv, pEnv->SetObjectArrayElement(arguments, 0, a1)); NSK_JNI_VERIFY_VOID(pEnv, pEnv->SetObjectArrayElement(arguments, 1, a2)); @@ -67,7 +67,7 @@ Java_vm_mlvm_meth_stress_jni_nativeAndMH_Test_native01( NSK_JNI_VERIFY_VOID(pEnv, pEnv->SetObjectArrayElement(arguments, 5, a6)); // Swap arguments - NSK_JNI_VERIFY(pEnv, NULL != (result = pEnv->CallObjectMethod(mhToCall, mid, arguments))); + NSK_JNI_VERIFY(pEnv, nullptr != (result = pEnv->CallObjectMethod(mhToCall, mid, arguments))); return result; } diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp index 1c0f79dd667..d44a5cedd73 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ void copyFromJString(JNIEnv * pEnv, jstring src, char ** dst) { const char * pStr; jsize len; - if (!NSK_VERIFY((pStr = pEnv->GetStringUTFChars(src, NULL)) != NULL)) { + if (!NSK_VERIFY((pStr = pEnv->GetStringUTFChars(src, nullptr)) != nullptr)) { return; } @@ -70,30 +70,30 @@ struct MethodName * getMethodName(jvmtiEnv * pJvmtiEnv, jmethodID method) { jclass clazz; struct MethodName * mn; - if (!NSK_JVMTI_VERIFY(pJvmtiEnv->GetMethodName(method, &szName, NULL, NULL))) { - return NULL; + if (!NSK_JVMTI_VERIFY(pJvmtiEnv->GetMethodName(method, &szName, nullptr, nullptr))) { + return nullptr; } JvmtiResource szNameResource(pJvmtiEnv, szName); if (!NSK_JVMTI_VERIFY(pJvmtiEnv->GetMethodDeclaringClass(method, &clazz))) { - return NULL; + return nullptr; } - if (!NSK_JVMTI_VERIFY(pJvmtiEnv->GetClassSignature(clazz, &szSignature, NULL))) { - return NULL; + if (!NSK_JVMTI_VERIFY(pJvmtiEnv->GetClassSignature(clazz, &szSignature, nullptr))) { + return nullptr; } JvmtiResource szSignatureResource(pJvmtiEnv, szSignature); if (strlen(szName) + 1 > sizeof(mn->methodName) || strlen(szSignature) + 1 > sizeof(mn->classSig)) { - return NULL; + return nullptr; } mn = (MethodName*) malloc(sizeof(MethodNameStruct)); - if (mn == NULL) { - return NULL; + if (mn == nullptr) { + return nullptr; } strncpy(mn->methodName, szName, sizeof(mn->methodName) - 1); @@ -115,17 +115,17 @@ char * locationToString(jvmtiEnv * pJvmtiEnv, jmethodID method, jlocation locati if (!pMN) return strdup("NONE"); - len = snprintf(NULL, 0, format, pMN->classSig, pMN->methodName, location) + 1; + len = snprintf(nullptr, 0, format, pMN->classSig, pMN->methodName, location) + 1; if (len <= 0) { free(pMN); - return NULL; + return nullptr; } result = (char*) malloc(len); - if (result == NULL) { + if (result == nullptr) { free(pMN); - return NULL; + return nullptr; } snprintf(result, len, format, pMN->classSig, pMN->methodName, location); @@ -137,16 +137,16 @@ char * locationToString(jvmtiEnv * pJvmtiEnv, jmethodID method, jlocation locati void * getTLS(jvmtiEnv * pJvmtiEnv, jthread thread, jsize sizeToAllocate) { void * tls; if (!NSK_JVMTI_VERIFY(pJvmtiEnv->GetThreadLocalStorage(thread, &tls))) - return NULL; + return nullptr; if (!tls) { - if (!NSK_VERIFY((tls = malloc(sizeToAllocate)) != NULL)) - return NULL; + if (!NSK_VERIFY((tls = malloc(sizeToAllocate)) != nullptr)) + return nullptr; memset(tls, 0, sizeToAllocate); if (!NSK_JVMTI_VERIFY(pJvmtiEnv->SetThreadLocalStorage(thread, tls))) - return NULL; + return nullptr; } return tls; diff --git a/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/redefineClasses.cpp b/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/redefineClasses.cpp index 4d5c8af7548..eac0d3fe601 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/redefineClasses.cpp +++ b/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/redefineClasses.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,7 @@ extern "C" { -static jvmtiEnv *test_jvmti = NULL; +static jvmtiEnv *test_jvmti = nullptr; static jvmtiCapabilities caps; /* @@ -50,7 +50,7 @@ Java_vm_runtime_defmeth_shared_Util_redefineClassIntl(JNIEnv *env, jclass clazz, jvmtiClassDefinition classDef; jboolean result = JNI_TRUE; - if (!NSK_VERIFY(env != NULL) || !NSK_VERIFY(clazzToRedefine != NULL) || !NSK_VERIFY(bytecodeArray != NULL)) { + if (!NSK_VERIFY(env != nullptr) || !NSK_VERIFY(clazzToRedefine != nullptr) || !NSK_VERIFY(bytecodeArray != nullptr)) { return JNI_FALSE; } @@ -61,7 +61,7 @@ Java_vm_runtime_defmeth_shared_Util_redefineClassIntl(JNIEnv *env, jclass clazz, } if (!NSK_JNI_VERIFY(env, - (classDef.class_bytes = (const unsigned char *) /* jbyte* */ env->GetByteArrayElements(bytecodeArray, NULL)) != NULL)) { + (classDef.class_bytes = (const unsigned char *) /* jbyte* */ env->GetByteArrayElements(bytecodeArray, nullptr)) != nullptr)) { return JNI_FALSE; } @@ -86,7 +86,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((test_jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp b/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp index 0388af34e74..c624db6ee98 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp +++ b/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,12 +49,12 @@ JNIEXPORT jboolean JNICALL Java_vm_share_ProcessUtils_sendSignal if (!GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, 0)) { dw = GetLastError(); FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, + nullptr, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, - NULL + nullptr ); printf("%s\n", (LPTSTR)lpMsgBuf); LocalFree(lpMsgBuf); @@ -82,12 +82,12 @@ JNIEXPORT jboolean JNICALL Java_vm_share_ProcessUtils_sendCtrlBreak if (!GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, 0)) { dw = GetLastError(); FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, + nullptr, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, - NULL + nullptr ); printf("%s\n", (LPTSTR)lpMsgBuf); LocalFree(lpMsgBuf); @@ -111,12 +111,12 @@ void reportLastError(const char *msg) { char *buf; size_t n = (size_t)FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_ALLOCATE_BUFFER, - NULL, + nullptr, errcode, 0, (LPSTR) &buf, (DWORD)len, - NULL); + nullptr); if (n > 3) { /* Drop final '.', CR, LF */ if (buf[n - 1] == '\n') n--; @@ -152,25 +152,25 @@ jboolean doDumpCore() { strcat(path, "\\"); strcat(path, name); dbghelp = LoadLibrary(path); - if (dbghelp == NULL) + if (dbghelp == nullptr) reportLastError("Load DBGHELP.DLL from system directory"); } else { printf("GetSystemDirectory returned 0\n"); } // try Windows directory - if (dbghelp == NULL) { + if (dbghelp == nullptr) { size = GetWindowsDirectory(path, pathLen); if (size > 6) { strcat(path, "\\"); strcat(path, name); dbghelp = LoadLibrary(path); - if (dbghelp == NULL) { + if (dbghelp == nullptr) { reportLastError("Load DBGHELP.DLL from Windows directory"); } } } - if (dbghelp == NULL) { + if (dbghelp == nullptr) { printf("Failed to load DBGHELP.DLL\n"); return JNI_FALSE; } @@ -180,7 +180,7 @@ jboolean doDumpCore() { PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION)) GetProcAddress(dbghelp, "MiniDumpWriteDump"); - if (_MiniDumpWriteDump == NULL) { + if (_MiniDumpWriteDump == nullptr) { printf("Failed to find MiniDumpWriteDump() in module dbghelp.dll"); return JNI_FALSE; } @@ -193,19 +193,19 @@ jboolean doDumpCore() { MiniDumpWithUnloadedModules); #endif - dumpFile = CreateFile("core.mdmp", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + dumpFile = CreateFile("core.mdmp", GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (dumpFile == INVALID_HANDLE_VALUE) { reportLastError("Failed to create file for dumping"); return JNI_FALSE; } - pmei = NULL; + pmei = nullptr; // Older versions of dbghelp.dll (the one shipped with Win2003 for example) may not support all // the dump types we really want. If first call fails, lets fall back to just use MiniDumpWithFullMemory then. - if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, pmei, NULL, NULL) == FALSE && - _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, pmei, NULL, NULL) == FALSE) { + if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, pmei, nullptr, nullptr) == FALSE && + _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, pmei, nullptr, nullptr) == FALSE) { reportLastError("Call to MiniDumpWriteDump() failed"); return JNI_FALSE; } diff --git a/test/jdk/java/awt/JAWT/myfile.cpp b/test/jdk/java/awt/JAWT/myfile.cpp index 6157e2934eb..80f51f951a9 100644 --- a/test/jdk/java/awt/JAWT/myfile.cpp +++ b/test/jdk/java/awt/JAWT/myfile.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,8 +52,8 @@ JNIEXPORT void JNICALL Java_MyCanvas_paint /* Get the drawing surface */ JAWT_DrawingSurface* ds = awt.GetDrawingSurface(env, canvas); - if (ds == NULL) { - printf("NULL drawing surface\n"); + if (ds == nullptr) { + printf("null drawing surface\n"); return; } @@ -67,7 +67,7 @@ JNIEXPORT void JNICALL Java_MyCanvas_paint /* Get the drawing surface info */ JAWT_DrawingSurfaceInfo* dsi = ds->GetDrawingSurfaceInfo(ds); - if (dsi == NULL) { + if (dsi == nullptr) { printf("Error getting surface info\n"); ds->Unlock(ds); return; diff --git a/test/jdk/java/foreign/enablenativeaccess/org/openjdk/foreigntest/unnamed/libLinkerInvokerUnnamed.cpp b/test/jdk/java/foreign/enablenativeaccess/org/openjdk/foreigntest/unnamed/libLinkerInvokerUnnamed.cpp index 271970817d7..cc8469cc68f 100644 --- a/test/jdk/java/foreign/enablenativeaccess/org/openjdk/foreigntest/unnamed/libLinkerInvokerUnnamed.cpp +++ b/test/jdk/java/foreign/enablenativeaccess/org/openjdk/foreigntest/unnamed/libLinkerInvokerUnnamed.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ void call(void* ctxt) { JavaVM* jvm = (JavaVM*) ctxt; JNIEnv* env; - jvm->AttachCurrentThread((void**)&env, NULL); + jvm->AttachCurrentThread((void**)&env, nullptr); jclass linkerClass = env->FindClass("java/lang/foreign/Linker"); jmethodID nativeLinkerMethod = env->GetStaticMethodID(linkerClass, "nativeLinker", "()Ljava/lang/foreign/Linker;"); env->CallStaticVoidMethod(linkerClass, nativeLinkerMethod); diff --git a/test/jdk/java/foreign/enablenativeaccess/panama_module/org/openjdk/foreigntest/libLinkerInvokerModule.cpp b/test/jdk/java/foreign/enablenativeaccess/panama_module/org/openjdk/foreigntest/libLinkerInvokerModule.cpp index 6c09f4900de..7056d702209 100644 --- a/test/jdk/java/foreign/enablenativeaccess/panama_module/org/openjdk/foreigntest/libLinkerInvokerModule.cpp +++ b/test/jdk/java/foreign/enablenativeaccess/panama_module/org/openjdk/foreigntest/libLinkerInvokerModule.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ typedef struct { void call(void* arg) { Context* context = (Context*)arg; JNIEnv* env; - context->jvm->AttachCurrentThread((void**)&env, NULL); + context->jvm->AttachCurrentThread((void**)&env, nullptr); jclass linkerClass = env->FindClass("java/lang/foreign/Linker"); jmethodID nativeLinkerMethod = env->GetMethodID(linkerClass, "downcallHandle", "(Ljava/lang/foreign/FunctionDescriptor;[Ljava/lang/foreign/Linker$Option;)Ljava/lang/invoke/MethodHandle;"); diff --git a/test/jdk/java/foreign/loaderLookup/libLoaderLookupInvoker.cpp b/test/jdk/java/foreign/loaderLookup/libLoaderLookupInvoker.cpp index b4305f2829e..607588cd56c 100644 --- a/test/jdk/java/foreign/loaderLookup/libLoaderLookupInvoker.cpp +++ b/test/jdk/java/foreign/loaderLookup/libLoaderLookupInvoker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ struct Context { void call(void* ctxt) { Context* context = (Context*) ctxt; JNIEnv* env; - context->jvm->AttachCurrentThread((void**)&env, NULL); + context->jvm->AttachCurrentThread((void**)&env, nullptr); jclass symbolLookupClass = env->FindClass("java/lang/foreign/SymbolLookup"); jmethodID loaderLookupMethod = env->GetStaticMethodID(symbolLookupClass, "loaderLookup", "()Ljava/lang/foreign/SymbolLookup;"); context->res = env->NewGlobalRef(env->CallStaticObjectMethod(symbolLookupClass, loaderLookupMethod)); diff --git a/test/jdk/jni/nullCaller/CallHelper.hpp b/test/jdk/jni/nullCaller/CallHelper.hpp index 1e8772bda09..40b3917966c 100644 --- a/test/jdk/jni/nullCaller/CallHelper.hpp +++ b/test/jdk/jni/nullCaller/CallHelper.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,9 +37,9 @@ class CallHelper { public: CallHelper(JNIEnv* e, const std::string& cname, const std::string& mname, const std::string& sig) : - classname(cname), method(mname), signature(sig), m(NULL), env(e) { + classname(cname), method(mname), signature(sig), m(nullptr), env(e) { c = env->FindClass(classname.c_str()); - assert (c != NULL); + assert (c != nullptr); } protected: @@ -53,7 +53,7 @@ protected: // check the given object which is expected to be null void checkReturnNull(jobject obj) { - if (obj != NULL) { + if (obj != nullptr) { emitErrorMessage("Null return expected"); ::exit(-1); } @@ -61,7 +61,7 @@ protected: // check the given object which is expected to NOT be null void checkReturnNotNull(jobject obj) { - if (obj == NULL) { + if (obj == nullptr) { emitErrorMessage("Non-Null return expected"); ::exit(-1); } @@ -69,7 +69,7 @@ protected: // check if any unexpected exceptions were thrown void checkException() { - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionOccurred() != nullptr) { emitErrorMessage("Exception was thrown"); env->ExceptionDescribe(); ::exit(-1); @@ -79,7 +79,7 @@ protected: // check if an expected exception was thrown void checkExpectedExceptionThrown(const std::string& exception) { jclass expected = env->FindClass(exception.c_str()); - assert(expected != NULL); + assert(expected != nullptr); jthrowable t = env->ExceptionOccurred(); if (env->IsInstanceOf(t, expected) == JNI_FALSE) { emitErrorMessage("Didn't get the expected " + exception); @@ -106,7 +106,7 @@ public: : CallHelper(e, cname, mname, sig) { m = env->GetMethodID(c, method.c_str(), signature.c_str()); - assert(m != NULL); + assert(m != nullptr); } // call on the given object, checking for exceptions and that the return is not null @@ -168,7 +168,7 @@ public: : CallHelper(e, cname, mname, sig) { m = env->GetStaticMethodID(c, method.c_str(), signature.c_str()); - assert(m != NULL); + assert(m != nullptr); } // call a method returning an object checking for exceptions and diff --git a/test/jdk/jni/nullCaller/exeNullCallerTest.cpp b/test/jdk/jni/nullCaller/exeNullCallerTest.cpp index 260a1edb9b4..db4e300eeb4 100644 --- a/test/jdk/jni/nullCaller/exeNullCallerTest.cpp +++ b/test/jdk/jni/nullCaller/exeNullCallerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -131,9 +131,9 @@ void getResourceAsStream(JNIEnv *env) { // fetch the open and closed classes jclass class_OpenResources = env->FindClass("open/OpenResources"); - assert(class_OpenResources != NULL); + assert(class_OpenResources != nullptr); jclass class_ClosedResources = env->FindClass("closed/ClosedResources"); - assert(class_ClosedResources != NULL); + assert(class_ClosedResources != nullptr); // Fetch the Module from one of the classes in the module jobject n = m_Class_getModule.callReturnNotNull(class_OpenResources); @@ -202,7 +202,7 @@ int main(int argc, char *argv[]) { fprintf(stderr, "Error: pthread_create failed with error code %d \n", result); return -1; } - pthread_join(id, NULL); + pthread_join(id, nullptr); #else run(&argv); #endif //AIX