Skip to content

Commit 3758487

Browse files
committed
8301180: Replace NULL with nullptr in share/gc/parallel/
Reviewed-by: stefank, ayang
1 parent d7aa87f commit 3758487

30 files changed

+224
-224
lines changed

src/hotspot/share/gc/parallel/gcAdaptivePolicyCounters.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -194,7 +194,7 @@ GCAdaptivePolicyCounters::GCAdaptivePolicyCounters(const char* name,
194194
}
195195

196196
void GCAdaptivePolicyCounters::update_counters_from_policy() {
197-
if (UsePerfData && (size_policy() != NULL)) {
197+
if (UsePerfData && (size_policy() != nullptr)) {
198198
update_avg_minor_pause_counter();
199199
update_avg_minor_interval_counter();
200200
#ifdef NOT_PRODUCT

src/hotspot/share/gc/parallel/mutableNUMASpace.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ size_t MutableNUMASpace::free_in_words() const {
168168

169169

170170
size_t MutableNUMASpace::tlab_capacity(Thread *thr) const {
171-
guarantee(thr != NULL, "No thread");
171+
guarantee(thr != nullptr, "No thread");
172172
int lgrp_id = thr->lgrp_id();
173173
if (lgrp_id == -1) {
174174
// This case can occur after the topology of the system has
@@ -193,7 +193,7 @@ size_t MutableNUMASpace::tlab_capacity(Thread *thr) const {
193193

194194
size_t MutableNUMASpace::tlab_used(Thread *thr) const {
195195
// Please see the comments for tlab_capacity().
196-
guarantee(thr != NULL, "No thread");
196+
guarantee(thr != nullptr, "No thread");
197197
int lgrp_id = thr->lgrp_id();
198198
if (lgrp_id == -1) {
199199
if (lgrp_spaces()->length() > 0) {
@@ -213,7 +213,7 @@ size_t MutableNUMASpace::tlab_used(Thread *thr) const {
213213

214214
size_t MutableNUMASpace::unsafe_max_tlab_alloc(Thread *thr) const {
215215
// Please see the comments for tlab_capacity().
216-
guarantee(thr != NULL, "No thread");
216+
guarantee(thr != nullptr, "No thread");
217217
int lgrp_id = thr->lgrp_id();
218218
if (lgrp_id == -1) {
219219
if (lgrp_spaces()->length() > 0) {
@@ -587,8 +587,8 @@ void MutableNUMASpace::initialize(MemRegion mr,
587587
if (!old_region.equals(region())) {
588588
new_region = MemRegion(rounded_bottom, rounded_end);
589589
MemRegion intersection = new_region.intersection(old_region);
590-
if (intersection.start() == NULL ||
591-
intersection.end() == NULL ||
590+
if (intersection.start() == nullptr ||
591+
intersection.end() == nullptr ||
592592
prev_page_size > page_size()) { // If the page size got smaller we have to change
593593
// the page size preference for the whole space.
594594
intersection = MemRegion(new_region.start(), new_region.start());
@@ -663,7 +663,7 @@ void MutableNUMASpace::initialize(MemRegion mr,
663663

664664
MemRegion intersection = old_region.intersection(new_region);
665665

666-
if (intersection.start() == NULL || intersection.end() == NULL) {
666+
if (intersection.start() == nullptr || intersection.end() == nullptr) {
667667
intersection = MemRegion(new_region.start(), new_region.start());
668668
}
669669

@@ -783,19 +783,19 @@ HeapWord* MutableNUMASpace::cas_allocate(size_t size) {
783783
LGRPSpace *ls = lgrp_spaces()->at(i);
784784
MutableSpace *s = ls->space();
785785
HeapWord *p = s->cas_allocate(size);
786-
if (p != NULL) {
786+
if (p != nullptr) {
787787
size_t remainder = pointer_delta(s->end(), p + size);
788788
if (remainder < CollectedHeap::min_fill_size() && remainder > 0) {
789789
if (s->cas_deallocate(p, size)) {
790790
// We were the last to allocate and created a fragment less than
791791
// a minimal object.
792-
p = NULL;
792+
p = nullptr;
793793
} else {
794794
guarantee(false, "Deallocation should always succeed");
795795
}
796796
}
797797
}
798-
if (p != NULL) {
798+
if (p != nullptr) {
799799
HeapWord* cur_top, *cur_chunk_top = p + size;
800800
while ((cur_top = top()) < cur_chunk_top) { // Keep _top updated.
801801
if (Atomic::cmpxchg(top_addr(), cur_top, cur_chunk_top) == cur_top) {
@@ -805,12 +805,12 @@ HeapWord* MutableNUMASpace::cas_allocate(size_t size) {
805805
}
806806

807807
// Make the page allocation happen here if there is no static binding.
808-
if (p != NULL && !os::numa_has_static_binding() ) {
808+
if (p != nullptr && !os::numa_has_static_binding() ) {
809809
for (HeapWord *i = p; i < p + size; i += os::vm_page_size() >> LogHeapWordSize) {
810810
*(int*)i = 0;
811811
}
812812
}
813-
if (p == NULL) {
813+
if (p == nullptr) {
814814
ls->set_allocation_failed();
815815
}
816816
return p;
@@ -911,7 +911,7 @@ void MutableNUMASpace::LGRPSpace::scan_pages(size_t page_size, size_t page_count
911911
char *s = scan_start;
912912
while (s < scan_end) {
913913
char *e = os::scan_pages(s, (char*)scan_end, &page_expected, &page_found);
914-
if (e == NULL) {
914+
if (e == nullptr) {
915915
break;
916916
}
917917
if (e != scan_end) {

src/hotspot/share/gc/parallel/mutableNUMASpace.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class MutableNUMASpace : public MutableSpace {
8888
char* last_page_scanned() { return _last_page_scanned; }
8989
void set_last_page_scanned(char* p) { _last_page_scanned = p; }
9090
public:
91-
LGRPSpace(int l, size_t alignment) : _lgrp_id(l), _allocation_failed(false), _last_page_scanned(NULL) {
91+
LGRPSpace(int l, size_t alignment) : _lgrp_id(l), _allocation_failed(false), _last_page_scanned(nullptr) {
9292
_space = new MutableSpace(alignment);
9393
_alloc_rate = new AdaptiveWeightedAverage(NUMAChunkResizeWeight);
9494
}
@@ -198,7 +198,7 @@ class MutableNUMASpace : public MutableSpace {
198198
bool clear_space,
199199
bool mangle_space,
200200
bool setup_pages = SetupPages,
201-
WorkerThreads* pretouch_workers = NULL);
201+
WorkerThreads* pretouch_workers = nullptr);
202202
// Update space layout if necessary. Do all adaptive resizing job.
203203
virtual void update();
204204
// Update allocation rate averages.
@@ -223,7 +223,7 @@ class MutableNUMASpace : public MutableSpace {
223223
virtual size_t tlab_used(Thread* thr) const;
224224
virtual size_t unsafe_max_tlab_alloc(Thread* thr) const;
225225

226-
// Allocation (return NULL if full)
226+
// Allocation (return null if full)
227227
virtual HeapWord* cas_allocate(size_t word_size);
228228

229229
// Debugging

src/hotspot/share/gc/parallel/mutableSpace.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -36,12 +36,12 @@
3636
#include "utilities/macros.hpp"
3737

3838
MutableSpace::MutableSpace(size_t alignment) :
39-
_mangler(NULL),
39+
_mangler(nullptr),
4040
_last_setup_region(),
4141
_alignment(alignment),
42-
_bottom(NULL),
43-
_top(NULL),
44-
_end(NULL)
42+
_bottom(nullptr),
43+
_top(nullptr),
44+
_end(nullptr)
4545
{
4646
assert(MutableSpace::alignment() % os::vm_page_size() == 0,
4747
"Space should be aligned");
@@ -203,7 +203,7 @@ HeapWord* MutableSpace::cas_allocate(size_t size) {
203203
"checking alignment");
204204
return obj;
205205
} else {
206-
return NULL;
206+
return nullptr;
207207
}
208208
} while (true);
209209
}
@@ -256,7 +256,7 @@ void MutableSpace::print_on(outputStream* st) const {
256256
void MutableSpace::verify() {
257257
HeapWord* p = bottom();
258258
HeapWord* t = top();
259-
HeapWord* prev_p = NULL;
259+
HeapWord* prev_p = nullptr;
260260
while (p < t) {
261261
oopDesc::verify(cast_to_oop(p));
262262
prev_p = p;

src/hotspot/share/gc/parallel/mutableSpace.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -101,7 +101,7 @@ class MutableSpace: public CHeapObj<mtGC> {
101101
bool clear_space,
102102
bool mangle_space,
103103
bool setup_pages = SetupPages,
104-
WorkerThreads* pretouch_workers = NULL);
104+
WorkerThreads* pretouch_workers = nullptr);
105105

106106
virtual void clear(bool mangle_space);
107107
virtual void update() { }
@@ -137,7 +137,7 @@ class MutableSpace: public CHeapObj<mtGC> {
137137
virtual size_t tlab_used(Thread* thr) const { return used_in_bytes(); }
138138
virtual size_t unsafe_max_tlab_alloc(Thread* thr) const { return free_in_bytes(); }
139139

140-
// Allocation (return NULL if full)
140+
// Allocation (return null if full)
141141
virtual HeapWord* cas_allocate(size_t word_size);
142142
// Optional deallocation. Used in NUMA-allocator.
143143
bool cas_deallocate(HeapWord *obj, size_t size);

src/hotspot/share/gc/parallel/parMarkBitMap.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@ ParMarkBitMap::initialize(MemRegion covered_region)
5757
MemTracker::record_virtual_memory_type((address)rs.base(), mtGC);
5858

5959
_virtual_space = new PSVirtualSpace(rs, page_sz);
60-
if (_virtual_space != NULL && _virtual_space->expand_by(_reserved_byte_size)) {
60+
if (_virtual_space != nullptr && _virtual_space->expand_by(_reserved_byte_size)) {
6161
_region_start = covered_region.start();
6262
_region_size = covered_region.word_size();
6363
BitMap::bm_word_t* map = (BitMap::bm_word_t*)_virtual_space->reserved_low_addr();
@@ -68,9 +68,9 @@ ParMarkBitMap::initialize(MemRegion covered_region)
6868

6969
_region_start = 0;
7070
_region_size = 0;
71-
if (_virtual_space != NULL) {
71+
if (_virtual_space != nullptr) {
7272
delete _virtual_space;
73-
_virtual_space = NULL;
73+
_virtual_space = nullptr;
7474
// Release memory reserved in the space.
7575
rs.release();
7676
}

src/hotspot/share/gc/parallel/parMarkBitMap.inline.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
3131
#include "utilities/bitMap.inline.hpp"
3232

3333
inline ParMarkBitMap::ParMarkBitMap():
34-
_region_start(NULL), _region_size(0), _beg_bits(), _end_bits(), _virtual_space(NULL), _reserved_byte_size(0)
34+
_region_start(nullptr), _region_size(0), _beg_bits(), _end_bits(), _virtual_space(nullptr), _reserved_byte_size(0)
3535
{ }
3636

3737
inline void ParMarkBitMap::clear_range(idx_t beg, idx_t end) {

0 commit comments

Comments
 (0)