Skip to content

Commit 13fcd60

Browse files
committed
8301504: Replace NULL with nullptr in os_cpu/linux_aarch64
Reviewed-by: kbarrett
1 parent b1e9698 commit 13fcd60

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

src/hotspot/os_cpu/linux_aarch64/javaThread_linux_aarch64.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -64,15 +64,15 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
6464
intptr_t* ret_fp;
6565
intptr_t* ret_sp;
6666
address addr = os::fetch_frame_from_context(uc, &ret_sp, &ret_fp);
67-
if (addr == NULL || ret_sp == NULL ) {
67+
if (addr == nullptr || ret_sp == nullptr ) {
6868
// ucontext wasn't useful
6969
return false;
7070
}
7171

7272
frame ret_frame(ret_sp, ret_fp, addr);
7373
if (!ret_frame.safe_for_sender(this)) {
7474
#ifdef COMPILER2
75-
frame ret_frame2(ret_sp, NULL, addr);
75+
frame ret_frame2(ret_sp, nullptr, addr);
7676
if (!ret_frame2.safe_for_sender(this)) {
7777
// nothing else to try if the frame isn't good
7878
return false;

src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -112,14 +112,14 @@ address os::fetch_frame_from_context(const void* ucVoid,
112112
address epc;
113113
const ucontext_t* uc = (const ucontext_t*)ucVoid;
114114

115-
if (uc != NULL) {
115+
if (uc != nullptr) {
116116
epc = os::Posix::ucontext_get_pc(uc);
117117
if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
118118
if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc);
119119
} else {
120-
epc = NULL;
121-
if (ret_sp) *ret_sp = (intptr_t *)NULL;
122-
if (ret_fp) *ret_fp = (intptr_t *)NULL;
120+
epc = nullptr;
121+
if (ret_sp) *ret_sp = (intptr_t *)nullptr;
122+
if (ret_fp) *ret_fp = (intptr_t *)nullptr;
123123
}
124124

125125
return epc;
@@ -174,20 +174,20 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
174174

175175
/*
176176
NOTE: does not seem to work on linux.
177-
if (info == NULL || info->si_code <= 0 || info->si_code == SI_NOINFO) {
177+
if (info == nullptr || info->si_code <= 0 || info->si_code == SI_NOINFO) {
178178
// can't decode this kind of signal
179-
info = NULL;
179+
info = nullptr;
180180
} else {
181181
assert(sig == info->si_signo, "bad siginfo");
182182
}
183183
*/
184184
// decide if this trap can be handled by a stub
185-
address stub = NULL;
185+
address stub = nullptr;
186186

187-
address pc = NULL;
187+
address pc = nullptr;
188188

189189
//%note os_trap_1
190-
if (info != NULL && uc != NULL && thread != NULL) {
190+
if (info != nullptr && uc != nullptr && thread != nullptr) {
191191
pc = (address) os::Posix::ucontext_get_pc(uc);
192192

193193
address addr = (address) info->si_addr;
@@ -225,9 +225,9 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
225225
// here if the underlying file has been truncated.
226226
// Do not crash the VM in such a case.
227227
CodeBlob* cb = CodeCache::find_blob(pc);
228-
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
228+
CompiledMethod* nm = (cb != nullptr) ? cb->as_compiled_method_or_null() : nullptr;
229229
bool is_unsafe_arraycopy = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
230-
if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
230+
if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
231231
address next_pc = pc + NativeCall::instruction_size;
232232
if (is_unsafe_arraycopy) {
233233
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
@@ -248,7 +248,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
248248
// End life with a fatal error, message and detail message and the context.
249249
// Note: no need to do any post-processing here (e.g. signal chaining)
250250
va_list va_dummy;
251-
VMError::report_and_die(thread, uc, NULL, 0, msg, detail_msg, va_dummy);
251+
VMError::report_and_die(thread, uc, nullptr, 0, msg, detail_msg, va_dummy);
252252
va_end(va_dummy);
253253

254254
ShouldNotReachHere();
@@ -290,9 +290,9 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
290290
}
291291
}
292292

293-
if (stub != NULL) {
293+
if (stub != nullptr) {
294294
// save all thread context in case we need to restore it
295-
if (thread != NULL) thread->set_saved_exception_pc(pc);
295+
if (thread != nullptr) thread->set_saved_exception_pc(pc);
296296

297297
os::Posix::ucontext_set_pc(uc, stub);
298298
return true;
@@ -331,7 +331,7 @@ size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
331331
// helper functions for fatal error handler
332332

333333
void os::print_context(outputStream *st, const void *context) {
334-
if (context == NULL) return;
334+
if (context == nullptr) return;
335335

336336
const ucontext_t *uc = (const ucontext_t*)context;
337337

@@ -343,7 +343,7 @@ void os::print_context(outputStream *st, const void *context) {
343343
}
344344

345345
void os::print_tos_pc(outputStream *st, const void *context) {
346-
if (context == NULL) return;
346+
if (context == nullptr) return;
347347

348348
const ucontext_t* uc = (const ucontext_t*)context;
349349

@@ -360,7 +360,7 @@ void os::print_tos_pc(outputStream *st, const void *context) {
360360
}
361361

362362
void os::print_register_info(outputStream *st, const void *context) {
363-
if (context == NULL) return;
363+
if (context == nullptr) return;
364364

365365
const ucontext_t *uc = (const ucontext_t*)context;
366366

src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -157,9 +157,9 @@ void VM_Version::get_os_cpu_info() {
157157
if (FILE *f = os::fopen("/proc/cpuinfo", "r")) {
158158
// need a large buffer as the flags line may include lots of text
159159
char buf[1024], *p;
160-
while (fgets(buf, sizeof (buf), f) != NULL) {
161-
if ((p = strchr(buf, ':')) != NULL) {
162-
long v = strtol(p+1, NULL, 0);
160+
while (fgets(buf, sizeof (buf), f) != nullptr) {
161+
if ((p = strchr(buf, ':')) != nullptr) {
162+
long v = strtol(p+1, nullptr, 0);
163163
if (strncmp(buf, "CPU implementer", sizeof "CPU implementer" - 1) == 0) {
164164
_cpu = v;
165165
} else if (strncmp(buf, "CPU variant", sizeof "CPU variant" - 1) == 0) {
@@ -181,7 +181,7 @@ void VM_Version::get_os_cpu_info() {
181181
}
182182

183183
static bool read_fully(const char *fname, char *buf, size_t buflen) {
184-
assert(buf != NULL, "invalid argument");
184+
assert(buf != nullptr, "invalid argument");
185185
assert(buflen >= 1, "invalid argument");
186186
int fd = os::open(fname, O_RDONLY, 0);
187187
if (fd != -1) {
@@ -211,10 +211,10 @@ void VM_Version::get_compatible_board(char *buf, int buflen) {
211211
"/proc/device-tree/compatible",
212212
"/sys/devices/virtual/dmi/id/board_name",
213213
"/sys/devices/virtual/dmi/id/product_name",
214-
NULL
214+
nullptr
215215
};
216216

217-
for (const char **fname = board_name_file_list; *fname != NULL; fname++) {
217+
for (const char **fname = board_name_file_list; *fname != nullptr; fname++) {
218218
if (read_fully(*fname, buf, buflen)) {
219219
return;
220220
}

0 commit comments

Comments
 (0)