diff --git a/src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp b/src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp index c15bac50a6266..d16788222a142 100644 --- a/src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp +++ b/src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2022 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -60,17 +60,17 @@ bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, ucontext_t* uc = (ucontext_t*) ucontext; address pc = (address)uc->uc_mcontext.regs->nip; - if (pc == NULL) { + if (pc == nullptr) { // ucontext wasn't useful return false; } frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/], pc); - if (ret_frame.fp() == NULL) { + if (ret_frame.fp() == nullptr) { // The found frame does not have a valid frame pointer. // Bail out because this will create big trouble later on, either - // - when using istate, calculated as (NULL - ijava_state_size) or + // - when using istate, calculated as (nullptr - ijava_state_size) or // - when using fp() directly in safe_for_sender() // // There is no conclusive description (yet) how this could happen, but it does. diff --git a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp index e0c6c1f3146ae..61fddaf241085 100644 --- a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp +++ b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2021 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -105,7 +105,7 @@ address os::Posix::ucontext_get_pc(const ucontext_t * uc) { // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill // it because the volatile registers are not needed to make setcontext() work. // Hopefully it was zero'd out beforehand. - guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context"); + guarantee(uc->uc_mcontext.regs != nullptr, "only use ucontext_get_pc in sigaction context"); return (address)uc->uc_mcontext.regs->nip; } @@ -113,7 +113,7 @@ address os::Posix::ucontext_get_pc(const ucontext_t * uc) { // Note: Only use this for an ucontext handed down to a signal handler. See comment // in ucontext_get_pc. void os::Posix::ucontext_set_pc(ucontext_t * uc, address pc) { - guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context"); + guarantee(uc->uc_mcontext.regs != nullptr, "only use ucontext_set_pc in sigaction context"); uc->uc_mcontext.regs->nip = (unsigned long)pc; } @@ -126,7 +126,7 @@ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) { } intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) { - return NULL; + return nullptr; } static unsigned long ucontext_get_trap(const ucontext_t * uc) { @@ -139,14 +139,14 @@ address os::fetch_frame_from_context(const void* ucVoid, address epc; const ucontext_t* uc = (const ucontext_t*)ucVoid; - if (uc != NULL) { + if (uc != nullptr) { epc = os::Posix::ucontext_get_pc(uc); if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc); if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc); } else { - epc = NULL; - if (ret_sp) *ret_sp = (intptr_t *)NULL; - if (ret_fp) *ret_fp = (intptr_t *)NULL; + epc = nullptr; + if (ret_sp) *ret_sp = (intptr_t *)nullptr; + if (ret_fp) *ret_fp = (intptr_t *)nullptr; } return epc; @@ -169,7 +169,7 @@ frame os::fetch_compiled_frame_from_context(const void* ucVoid) { frame os::get_sender_for_C_frame(frame* fr) { if (*fr->sp() == 0) { // fr is the last C frame - return frame(NULL, NULL); + return frame(nullptr, nullptr); } return frame(fr->sender_sp(), fr->sender_pc()); } @@ -207,10 +207,10 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, } // decide if this trap can be handled by a stub - address stub = NULL; - address pc = NULL; + address stub = nullptr; + address pc = nullptr; - if (info != NULL && uc != NULL && thread != NULL) { + if (info != nullptr && uc != nullptr && thread != nullptr) { pc = (address) os::Posix::ucontext_get_pc(uc); // Handle ALL stack overflow variations here @@ -245,7 +245,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, // Java thread running in Java code => find exception handler if any // a fault inside compiled code, the interpreter, or a stub - CodeBlob *cb = NULL; + CodeBlob *cb = nullptr; int stop_type = -1; // Handle signal from NativeJump::patch_verified_entry(). 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, // doesn't work for us. We use: ((NativeInstruction*)pc)->is_safepoint_poll() && CodeCache::contains((void*) pc) && - ((cb = CodeCache::find_blob(pc)) != NULL) && + ((cb = CodeCache::find_blob(pc)) != nullptr) && cb->is_compiled()) { if (TraceTraps) { 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, else if (UseSIGTRAP && sig == SIGTRAP && ((NativeInstruction*)pc)->is_safepoint_poll_return() && CodeCache::contains((void*) pc) && - ((cb = CodeCache::find_blob(pc)) != NULL) && + ((cb = CodeCache::find_blob(pc)) != nullptr) && cb->is_compiled()) { if (TraceTraps) { 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, bool msg_present = (stop_type & MacroAssembler::stop_msg_present); stop_type = (stop_type &~ MacroAssembler::stop_msg_present); - const char *msg = NULL; + const char *msg = nullptr; switch (stop_type) { case MacroAssembler::stop_stop : msg = "stop"; break; case MacroAssembler::stop_untested : msg = "untested"; break; @@ -346,7 +346,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, // End life with a fatal error, message and detail message and the context. // Note: no need to do any post-processing here (e.g. signal chaining) va_list va_dummy; - VMError::report_and_die(thread, uc, NULL, 0, msg, detail_msg, va_dummy); + VMError::report_and_die(thread, uc, nullptr, 0, msg, detail_msg, va_dummy); va_end(va_dummy); ShouldNotReachHere(); @@ -357,9 +357,9 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, // BugId 4454115: A read from a MappedByteBuffer can fault here if the // underlying file has been truncated. Do not crash the VM in such a case. CodeBlob* cb = CodeCache::find_blob(pc); - CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL; + CompiledMethod* nm = (cb != nullptr) ? cb->as_compiled_method_or_null() : nullptr; bool is_unsafe_arraycopy = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc)); - if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) { + if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_arraycopy) { address next_pc = pc + 4; if (is_unsafe_arraycopy) { next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); @@ -401,9 +401,9 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, } } - if (stub != NULL) { + if (stub != nullptr) { // Save all thread context in case we need to restore it. - if (thread != NULL) thread->set_saved_exception_pc(pc); + if (thread != nullptr) thread->set_saved_exception_pc(pc); os::Posix::ucontext_set_pc(uc, stub); return true; } @@ -447,7 +447,7 @@ size_t os::Posix::default_stack_size(os::ThreadType thr_type) { // helper functions for fatal error handler void os::print_context(outputStream *st, const void *context) { - if (context == NULL) return; + if (context == nullptr) return; const ucontext_t* uc = (const ucontext_t*)context; @@ -465,7 +465,7 @@ void os::print_context(outputStream *st, const void *context) { } void os::print_tos_pc(outputStream *st, const void *context) { - if (context == NULL) return; + if (context == nullptr) return; const ucontext_t* uc = (const ucontext_t*)context; @@ -482,7 +482,7 @@ void os::print_tos_pc(outputStream *st, const void *context) { } void os::print_register_info(outputStream *st, const void *context) { - if (context == NULL) return; + if (context == nullptr) return; const ucontext_t *uc = (const ucontext_t*)context;