diff --git a/src/hotspot/os/linux/gc/x/xPhysicalMemoryBacking_linux.cpp b/src/hotspot/os/linux/gc/x/xPhysicalMemoryBacking_linux.cpp index 5db59741a5864..35625f613d349 100644 --- a/src/hotspot/os/linux/gc/x/xPhysicalMemoryBacking_linux.cpp +++ b/src/hotspot/os/linux/gc/x/xPhysicalMemoryBacking_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -389,7 +389,7 @@ XErrno XPhysicalMemoryBacking::fallocate_compat_mmap_hugetlbfs(size_t offset, si // On hugetlbfs, mapping a file segment will fail immediately, without // the need to touch the mapped pages first, if there aren't enough huge // pages available to back the mapping. - void* const addr = mmap(0, length, PROT_READ|PROT_WRITE, MAP_SHARED, _fd, offset); + void* const addr = mmap(nullptr, length, PROT_READ|PROT_WRITE, MAP_SHARED, _fd, offset); if (addr == MAP_FAILED) { // Failed return errno; @@ -439,7 +439,7 @@ static bool safe_touch_mapping(void* addr, size_t length, size_t page_size) { XErrno XPhysicalMemoryBacking::fallocate_compat_mmap_tmpfs(size_t offset, size_t length) const { // On tmpfs, we need to touch the mapped pages to figure out // if there are enough pages available to back the mapping. - void* const addr = mmap(0, length, PROT_READ|PROT_WRITE, MAP_SHARED, _fd, offset); + void* const addr = mmap(nullptr, length, PROT_READ|PROT_WRITE, MAP_SHARED, _fd, offset); if (addr == MAP_FAILED) { // Failed return errno; diff --git a/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp b/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp index 76f9d90cd7198..b80124cc34e43 100644 --- a/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp +++ b/src/hotspot/os/linux/gc/z/zPhysicalMemoryBacking_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -391,7 +391,7 @@ ZErrno ZPhysicalMemoryBacking::fallocate_compat_mmap_hugetlbfs(zoffset offset, s // On hugetlbfs, mapping a file segment will fail immediately, without // the need to touch the mapped pages first, if there aren't enough huge // pages available to back the mapping. - void* const addr = mmap(0, length, PROT_READ|PROT_WRITE, MAP_SHARED, _fd, untype(offset)); + void* const addr = mmap(nullptr, length, PROT_READ|PROT_WRITE, MAP_SHARED, _fd, untype(offset)); if (addr == MAP_FAILED) { // Failed return errno; @@ -441,7 +441,7 @@ static bool safe_touch_mapping(void* addr, size_t length, size_t page_size) { ZErrno ZPhysicalMemoryBacking::fallocate_compat_mmap_tmpfs(zoffset offset, size_t length) const { // On tmpfs, we need to touch the mapped pages to figure out // if there are enough pages available to back the mapping. - void* const addr = mmap(0, length, PROT_READ|PROT_WRITE, MAP_SHARED, _fd, untype(offset)); + void* const addr = mmap(nullptr, length, PROT_READ|PROT_WRITE, MAP_SHARED, _fd, untype(offset)); if (addr == MAP_FAILED) { // Failed return errno; diff --git a/src/hotspot/share/gc/parallel/parMarkBitMap.cpp b/src/hotspot/share/gc/parallel/parMarkBitMap.cpp index 434b719aa13ee..658c3ef106fa0 100644 --- a/src/hotspot/share/gc/parallel/parMarkBitMap.cpp +++ b/src/hotspot/share/gc/parallel/parMarkBitMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, 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 @@ -62,7 +62,7 @@ ParMarkBitMap::initialize(MemRegion covered_region) return true; } - _heap_start = 0; + _heap_start = nullptr; _heap_size = 0; if (_virtual_space != nullptr) { delete _virtual_space; diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp index 2984cedafe196..665b14bb1eabf 100644 --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp @@ -661,7 +661,7 @@ HeapWord* ParallelScavengeHeap::block_start(const void* addr) const { "addr should be in allocated part of old gen"); return old_gen()->start_array()->object_start((HeapWord*)addr); } - return 0; + return nullptr; } bool ParallelScavengeHeap::block_is_obj(const HeapWord* addr) const { diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp index 6c08503438423..b4fe706d1e410 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp @@ -237,7 +237,7 @@ ParallelCompactData::create_vspace(size_t count, size_t element_size) MemTracker::record_virtual_memory_type((address)rs.base(), mtGC); PSVirtualSpace* vspace = new PSVirtualSpace(rs, page_sz); - if (vspace != 0) { + if (vspace != nullptr) { if (vspace->expand_by(_reserved_byte_size)) { return vspace; } @@ -246,7 +246,7 @@ ParallelCompactData::create_vspace(size_t count, size_t element_size) rs.release(); } - return 0; + return nullptr; } bool ParallelCompactData::initialize_region_data(size_t heap_size) @@ -255,7 +255,7 @@ bool ParallelCompactData::initialize_region_data(size_t heap_size) const size_t count = heap_size >> Log2RegionSize; _region_vspace = create_vspace(count, sizeof(RegionData)); - if (_region_vspace != 0) { + if (_region_vspace != nullptr) { _region_data = (RegionData*)_region_vspace->reserved_low_addr(); _region_count = count; return true; diff --git a/src/hotspot/share/gc/z/zPage.inline.hpp b/src/hotspot/share/gc/z/zPage.inline.hpp index ff5fe0bbd6c87..0b4ee28ba7d0a 100644 --- a/src/hotspot/share/gc/z/zPage.inline.hpp +++ b/src/hotspot/share/gc/z/zPage.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ inline const char* ZPage::type_to_string() const { default: fatal("Unexpected page type"); - return 0; } } diff --git a/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC01/libnativeGC01.cpp b/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC01/libnativeGC01.cpp index 63aed51a89764..efd1fd3fa3ab4 100644 --- a/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC01/libnativeGC01.cpp +++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC01/libnativeGC01.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 @@ -43,7 +43,7 @@ Java_gc_gctests_nativeGC01_nativeGC01_nativeMethod01 */ cls = env->GetObjectClass(obj); mid = env->GetMethodID(cls, "callbackGC", "()V"); - if (mid == 0) { + if (mid == nullptr) { printf("couldnt locate method callbackGC()"); return -1; } @@ -56,7 +56,7 @@ Java_gc_gctests_nativeGC01_nativeGC01_nativeMethod01 clss = env->GetObjectClass(linked_list); mid2 = env->GetMethodID(clss, "getLength", "()I"); - if (mid2 == 0) { + if (mid2 == nullptr) { printf("couldnt locate method getLength()"); return -1; } diff --git a/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC02/libnativeGC02.cpp b/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC02/libnativeGC02.cpp index e6db8cf618460..eec3fa3e8e865 100644 --- a/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC02/libnativeGC02.cpp +++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC02/libnativeGC02.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 @@ -41,7 +41,7 @@ Java_gc_gctests_nativeGC02_nativeGC02_nativeMethod02 clss = env->GetObjectClass(obj); fid = env->GetFieldID(clss, "cl", "Lnsk/share/gc/CircularLinkedList;"); - if (fid == 0) { + if (fid == nullptr) { printf("could not locate field - cl\n"); return -1; } @@ -53,7 +53,7 @@ Java_gc_gctests_nativeGC02_nativeGC02_nativeMethod02 cls = env->GetObjectClass(obj); mid = env->GetMethodID(cls, "callbackGC", "()V"); - if (mid == 0) { + if (mid == nullptr) { printf("couldnt locate method callbackGC()\n"); return -1; } @@ -66,7 +66,7 @@ Java_gc_gctests_nativeGC02_nativeGC02_nativeMethod02 clss = env->GetObjectClass(linked_list); mid2 = env->GetMethodID(clss, "getLength", "(Lnsk/share/gc/CircularLinkedList;)I"); - if (mid2 == 0) { + if (mid2 == nullptr) { printf("couldnt locate method getLength(CircularLinkedList)\n"); return -1; } diff --git a/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC03/libnativeGC03.cpp b/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC03/libnativeGC03.cpp index 2c97863db5a9f..e3f54ec86ec50 100644 --- a/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC03/libnativeGC03.cpp +++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC03/libnativeGC03.cpp @@ -46,7 +46,7 @@ Java_gc_gctests_nativeGC03_nativeGC03_nativeMethod03 clss = env->GetObjectClass(obj); mid = env->GetMethodID(clss, "fillArray", "()V"); - if (mid == 0) { + if (mid == nullptr) { return; } env->CallVoidMethod(obj, mid); diff --git a/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC05/libnativeGC05.cpp b/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC05/libnativeGC05.cpp index 4bfaeda1f0606..a796cf938bbe6 100644 --- a/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC05/libnativeGC05.cpp +++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC05/libnativeGC05.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 @@ -28,8 +28,8 @@ extern "C" { JNIEXPORT void JNICALL Java_gc_gctests_nativeGC05_nativeGC05_kickOffRefillers (JNIEnv *env, jobject obj, jobject matrix, jobject stack) { - jclass matrixClass, stackClass, pairClass = 0; - jmethodID stack_pop_mid, stack_empty_mid, matrix_repopulate_mid, pair_geti_mid = 0, pair_getj_mid = 0; + jclass matrixClass, stackClass, pairClass = nullptr; + jmethodID stack_pop_mid, stack_empty_mid, matrix_repopulate_mid, pair_geti_mid = nullptr, pair_getj_mid = nullptr; jobject pair; jint i, j; jboolean b; @@ -40,18 +40,18 @@ Java_gc_gctests_nativeGC05_nativeGC05_kickOffRefillers /* GetMethodID's for the pop() and Repopulate() methods */ stack_pop_mid = env->GetMethodID(stackClass, "pop", "()Ljava/lang/Object;"); - if (stack_pop_mid == 0) { + if (stack_pop_mid == nullptr) { printf("could not get a methodID for Stack::pop()\n"); return; } stack_empty_mid = env->GetMethodID(stackClass, "empty", "()Z"); - if (stack_empty_mid == 0) { + if (stack_empty_mid == nullptr) { printf("could not get a methodID for Stack::empty()\n"); return; } matrix_repopulate_mid = env->GetMethodID(matrixClass, "repopulate", "(II)V"); - if (matrix_repopulate_mid == 0) { + if (matrix_repopulate_mid == nullptr) { printf("could not get a methodID for Matrix::repopulate(int, int)\n"); return; } @@ -62,15 +62,15 @@ Java_gc_gctests_nativeGC05_nativeGC05_kickOffRefillers /** pair = stack.pop() */ pair = env->CallObjectMethod(stack, stack_pop_mid); - if (pairClass == 0) { + if (pairClass == nullptr) { pairClass = env->GetObjectClass(pair); pair_geti_mid = env->GetMethodID(pairClass, "getI", "()I"); - if (pair_geti_mid == 0) { + if (pair_geti_mid == nullptr) { printf("could not get a methodID for IndexPair::getI()\n"); return; } pair_getj_mid = env->GetMethodID(pairClass, "getJ", "()I"); - if (pair_getj_mid == 0) { + if (pair_getj_mid == nullptr) { printf("could not get a methodID for IndexPair::getJ()\n"); return; }