Skip to content

Commit

Permalink
8301509: Replace NULL with nullptr in os_cpu/linux_x86
Browse files Browse the repository at this point in the history
Reviewed-by: kbarrett
  • Loading branch information
jdksjolen committed Feb 2, 2023
1 parent 6daff6b commit 5d1f71d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
10 changes: 5 additions & 5 deletions 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
Expand Down Expand Up @@ -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());
}

Expand Down Expand Up @@ -62,16 +62,16 @@ 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;
}

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;
Expand Down
40 changes: 20 additions & 20 deletions 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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand Down

1 comment on commit 5d1f71d

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.