diff --git a/src/hotspot/os_cpu/linux_x86/javaThread_linux_x86.cpp b/src/hotspot/os_cpu/linux_x86/javaThread_linux_x86.cpp index 9e129487edf9d..145b9a3f0220a 100644 --- a/src/hotspot/os_cpu/linux_x86/javaThread_linux_x86.cpp +++ b/src/hotspot/os_cpu/linux_x86/javaThread_linux_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2023, 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,7 +28,7 @@ frame JavaThread::pd_last_frame() { assert(has_last_Java_frame(), "must have last_Java_sp() when suspended"); - vmassert(_anchor.last_Java_pc() != NULL, "not walkable"); + vmassert(_anchor.last_Java_pc() != nullptr, "not walkable"); return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc()); } @@ -62,7 +62,7 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) intptr_t* ret_fp; intptr_t* ret_sp; address addr = os::fetch_frame_from_context(uc, &ret_sp, &ret_fp); - if (addr == NULL || ret_sp == NULL ) { + if (addr == nullptr || ret_sp == nullptr ) { // ucontext wasn't useful return false; } @@ -70,8 +70,8 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava) frame ret_frame(ret_sp, ret_fp, addr); if (!ret_frame.safe_for_sender(this)) { #if COMPILER2_OR_JVMCI - // C2 and JVMCI use ebp as a general register see if NULL fp helps - frame ret_frame2(ret_sp, NULL, addr); + // C2 and JVMCI use ebp as a general register see if null fp helps + frame ret_frame2(ret_sp, nullptr, addr); if (!ret_frame2.safe_for_sender(this)) { // nothing else to try if the frame isn't good return false; diff --git a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp index dfa6e6fa853d1..b67e6b9a0647b 100644 --- a/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp +++ b/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2023, 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 @@ -126,14 +126,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; @@ -209,20 +209,20 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, /* NOTE: does not seem to work on linux. - if (info == NULL || info->si_code <= 0 || info->si_code == SI_NOINFO) { + if (info == nullptr || info->si_code <= 0 || info->si_code == SI_NOINFO) { // can't decode this kind of signal - info = NULL; + info = nullptr; } else { assert(sig == info->si_signo, "bad siginfo"); } */ // decide if this trap can be handled by a stub - address stub = NULL; + address stub = nullptr; - address pc = NULL; + address pc = nullptr; //%note os_trap_1 - if (info != NULL && uc != NULL && thread != NULL) { + if (info != nullptr && uc != nullptr && thread != nullptr) { pc = (address) os::Posix::ucontext_get_pc(uc); if (sig == SIGSEGV && info->si_addr == 0 && info->si_code == SI_KERNEL) { @@ -260,9 +260,9 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, // 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 = Assembler::locate_next_instruction(pc); if (is_unsafe_arraycopy) { next_pc = UnsafeCopyMemory::page_error_continue_pc(pc); @@ -346,7 +346,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, // the si_code for this condition may change in the future. // Furthermore, a false-positive should be harmless. if (UnguardOnExecutionViolation > 0 && - stub == NULL && + stub == nullptr && (sig == SIGSEGV || sig == SIGBUS) && uc->uc_mcontext.gregs[REG_TRAPNO] == trap_page_fault) { int page_size = os::vm_page_size(); @@ -409,9 +409,9 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info, } #endif // !AMD64 - 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; @@ -466,9 +466,9 @@ juint os::cpu_microcode_revision() { size_t len = sizeof(data); while (!feof(fp)) { if (fgets(data, len, fp)) { - if (strstr(data, "microcode") != NULL) { + if (strstr(data, "microcode") != nullptr) { char* rev = strchr(data, ':'); - if (rev != NULL) sscanf(rev + 1, "%x", &result); + if (rev != nullptr) sscanf(rev + 1, "%x", &result); break; } } @@ -507,7 +507,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; @@ -559,7 +559,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; @@ -576,7 +576,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;