Skip to content

Commit b1e9698

Browse files
committed
8301506: Replace NULL with nullptr in os_cpu/linux_ppc
Reviewed-by: kbarrett, rrich
1 parent af474ce commit b1e9698

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2012, 2022 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -60,17 +60,17 @@ bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext,
6060
ucontext_t* uc = (ucontext_t*) ucontext;
6161
address pc = (address)uc->uc_mcontext.regs->nip;
6262

63-
if (pc == NULL) {
63+
if (pc == nullptr) {
6464
// ucontext wasn't useful
6565
return false;
6666
}
6767

6868
frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/], pc);
6969

70-
if (ret_frame.fp() == NULL) {
70+
if (ret_frame.fp() == nullptr) {
7171
// The found frame does not have a valid frame pointer.
7272
// Bail out because this will create big trouble later on, either
73-
// - when using istate, calculated as (NULL - ijava_state_size) or
73+
// - when using istate, calculated as (nullptr - ijava_state_size) or
7474
// - when using fp() directly in safe_for_sender()
7575
//
7676
// There is no conclusive description (yet) how this could happen, but it does.

src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp

+24-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2012, 2021 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -105,15 +105,15 @@ address os::Posix::ucontext_get_pc(const ucontext_t * uc) {
105105
// - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
106106
// it because the volatile registers are not needed to make setcontext() work.
107107
// Hopefully it was zero'd out beforehand.
108-
guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
108+
guarantee(uc->uc_mcontext.regs != nullptr, "only use ucontext_get_pc in sigaction context");
109109
return (address)uc->uc_mcontext.regs->nip;
110110
}
111111

112112
// modify PC in ucontext.
113113
// Note: Only use this for an ucontext handed down to a signal handler. See comment
114114
// in ucontext_get_pc.
115115
void os::Posix::ucontext_set_pc(ucontext_t * uc, address pc) {
116-
guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
116+
guarantee(uc->uc_mcontext.regs != nullptr, "only use ucontext_set_pc in sigaction context");
117117
uc->uc_mcontext.regs->nip = (unsigned long)pc;
118118
}
119119

@@ -126,7 +126,7 @@ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
126126
}
127127

128128
intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
129-
return NULL;
129+
return nullptr;
130130
}
131131

132132
static unsigned long ucontext_get_trap(const ucontext_t * uc) {
@@ -139,14 +139,14 @@ address os::fetch_frame_from_context(const void* ucVoid,
139139
address epc;
140140
const ucontext_t* uc = (const ucontext_t*)ucVoid;
141141

142-
if (uc != NULL) {
142+
if (uc != nullptr) {
143143
epc = os::Posix::ucontext_get_pc(uc);
144144
if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
145145
if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc);
146146
} else {
147-
epc = NULL;
148-
if (ret_sp) *ret_sp = (intptr_t *)NULL;
149-
if (ret_fp) *ret_fp = (intptr_t *)NULL;
147+
epc = nullptr;
148+
if (ret_sp) *ret_sp = (intptr_t *)nullptr;
149+
if (ret_fp) *ret_fp = (intptr_t *)nullptr;
150150
}
151151

152152
return epc;
@@ -169,7 +169,7 @@ frame os::fetch_compiled_frame_from_context(const void* ucVoid) {
169169
frame os::get_sender_for_C_frame(frame* fr) {
170170
if (*fr->sp() == 0) {
171171
// fr is the last C frame
172-
return frame(NULL, NULL);
172+
return frame(nullptr, nullptr);
173173
}
174174
return frame(fr->sender_sp(), fr->sender_pc());
175175
}
@@ -207,10 +207,10 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
207207
}
208208

209209
// decide if this trap can be handled by a stub
210-
address stub = NULL;
211-
address pc = NULL;
210+
address stub = nullptr;
211+
address pc = nullptr;
212212

213-
if (info != NULL && uc != NULL && thread != NULL) {
213+
if (info != nullptr && uc != nullptr && thread != nullptr) {
214214
pc = (address) os::Posix::ucontext_get_pc(uc);
215215

216216
// Handle ALL stack overflow variations here
@@ -245,7 +245,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
245245
// Java thread running in Java code => find exception handler if any
246246
// a fault inside compiled code, the interpreter, or a stub
247247

248-
CodeBlob *cb = NULL;
248+
CodeBlob *cb = nullptr;
249249
int stop_type = -1;
250250
// Handle signal from NativeJump::patch_verified_entry().
251251
if (sig == SIGILL && nativeInstruction_at(pc)->is_sigill_not_entrant()) {
@@ -263,7 +263,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
263263
// doesn't work for us. We use:
264264
((NativeInstruction*)pc)->is_safepoint_poll() &&
265265
CodeCache::contains((void*) pc) &&
266-
((cb = CodeCache::find_blob(pc)) != NULL) &&
266+
((cb = CodeCache::find_blob(pc)) != nullptr) &&
267267
cb->is_compiled()) {
268268
if (TraceTraps) {
269269
tty->print_cr("trap: safepoint_poll at " INTPTR_FORMAT " (%s)", p2i(pc),
@@ -275,7 +275,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
275275
else if (UseSIGTRAP && sig == SIGTRAP &&
276276
((NativeInstruction*)pc)->is_safepoint_poll_return() &&
277277
CodeCache::contains((void*) pc) &&
278-
((cb = CodeCache::find_blob(pc)) != NULL) &&
278+
((cb = CodeCache::find_blob(pc)) != nullptr) &&
279279
cb->is_compiled()) {
280280
if (TraceTraps) {
281281
tty->print_cr("trap: safepoint_poll at return at " INTPTR_FORMAT " (nmethod)", p2i(pc));
@@ -327,7 +327,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
327327
bool msg_present = (stop_type & MacroAssembler::stop_msg_present);
328328
stop_type = (stop_type &~ MacroAssembler::stop_msg_present);
329329

330-
const char *msg = NULL;
330+
const char *msg = nullptr;
331331
switch (stop_type) {
332332
case MacroAssembler::stop_stop : msg = "stop"; break;
333333
case MacroAssembler::stop_untested : msg = "untested"; break;
@@ -346,7 +346,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
346346
// End life with a fatal error, message and detail message and the context.
347347
// Note: no need to do any post-processing here (e.g. signal chaining)
348348
va_list va_dummy;
349-
VMError::report_and_die(thread, uc, NULL, 0, msg, detail_msg, va_dummy);
349+
VMError::report_and_die(thread, uc, nullptr, 0, msg, detail_msg, va_dummy);
350350
va_end(va_dummy);
351351

352352
ShouldNotReachHere();
@@ -357,9 +357,9 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
357357
// BugId 4454115: A read from a MappedByteBuffer can fault here if the
358358
// underlying file has been truncated. Do not crash the VM in such a case.
359359
CodeBlob* cb = CodeCache::find_blob(pc);
360-
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
360+
CompiledMethod* nm = (cb != nullptr) ? cb->as_compiled_method_or_null() : nullptr;
361361
bool is_unsafe_arraycopy = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
362-
if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
362+
if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
363363
address next_pc = pc + 4;
364364
if (is_unsafe_arraycopy) {
365365
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
@@ -401,9 +401,9 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
401401
}
402402
}
403403

404-
if (stub != NULL) {
404+
if (stub != nullptr) {
405405
// Save all thread context in case we need to restore it.
406-
if (thread != NULL) thread->set_saved_exception_pc(pc);
406+
if (thread != nullptr) thread->set_saved_exception_pc(pc);
407407
os::Posix::ucontext_set_pc(uc, stub);
408408
return true;
409409
}
@@ -447,7 +447,7 @@ size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
447447
// helper functions for fatal error handler
448448

449449
void os::print_context(outputStream *st, const void *context) {
450-
if (context == NULL) return;
450+
if (context == nullptr) return;
451451

452452
const ucontext_t* uc = (const ucontext_t*)context;
453453

@@ -465,7 +465,7 @@ void os::print_context(outputStream *st, const void *context) {
465465
}
466466

467467
void os::print_tos_pc(outputStream *st, const void *context) {
468-
if (context == NULL) return;
468+
if (context == nullptr) return;
469469

470470
const ucontext_t* uc = (const ucontext_t*)context;
471471

@@ -482,7 +482,7 @@ void os::print_tos_pc(outputStream *st, const void *context) {
482482
}
483483

484484
void os::print_register_info(outputStream *st, const void *context) {
485-
if (context == NULL) return;
485+
if (context == nullptr) return;
486486

487487
const ucontext_t *uc = (const ucontext_t*)context;
488488

0 commit comments

Comments
 (0)