8301504: Replace NULL with nullptr in os_cpu/linux_aarch64
Reviewed-by: kbarrett
This commit is contained in:
parent
b1e96989b6
commit
13fcd602d3
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -64,7 +64,7 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
|
|||||||
intptr_t* ret_fp;
|
intptr_t* ret_fp;
|
||||||
intptr_t* ret_sp;
|
intptr_t* ret_sp;
|
||||||
address addr = os::fetch_frame_from_context(uc, &ret_sp, &ret_fp);
|
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
|
// ucontext wasn't useful
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
|
|||||||
frame ret_frame(ret_sp, ret_fp, addr);
|
frame ret_frame(ret_sp, ret_fp, addr);
|
||||||
if (!ret_frame.safe_for_sender(this)) {
|
if (!ret_frame.safe_for_sender(this)) {
|
||||||
#ifdef COMPILER2
|
#ifdef COMPILER2
|
||||||
frame ret_frame2(ret_sp, NULL, addr);
|
frame ret_frame2(ret_sp, nullptr, addr);
|
||||||
if (!ret_frame2.safe_for_sender(this)) {
|
if (!ret_frame2.safe_for_sender(this)) {
|
||||||
// nothing else to try if the frame isn't good
|
// nothing else to try if the frame isn't good
|
||||||
return false;
|
return false;
|
||||||
|
@ -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.
|
||||||
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -112,14 +112,14 @@ address os::fetch_frame_from_context(const void* ucVoid,
|
|||||||
address epc;
|
address epc;
|
||||||
const ucontext_t* uc = (const ucontext_t*)ucVoid;
|
const ucontext_t* uc = (const ucontext_t*)ucVoid;
|
||||||
|
|
||||||
if (uc != NULL) {
|
if (uc != nullptr) {
|
||||||
epc = os::Posix::ucontext_get_pc(uc);
|
epc = os::Posix::ucontext_get_pc(uc);
|
||||||
if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
|
if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
|
||||||
if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc);
|
if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc);
|
||||||
} else {
|
} else {
|
||||||
epc = NULL;
|
epc = nullptr;
|
||||||
if (ret_sp) *ret_sp = (intptr_t *)NULL;
|
if (ret_sp) *ret_sp = (intptr_t *)nullptr;
|
||||||
if (ret_fp) *ret_fp = (intptr_t *)NULL;
|
if (ret_fp) *ret_fp = (intptr_t *)nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return epc;
|
return epc;
|
||||||
@ -174,20 +174,20 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
NOTE: does not seem to work on linux.
|
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
|
// can't decode this kind of signal
|
||||||
info = NULL;
|
info = nullptr;
|
||||||
} else {
|
} else {
|
||||||
assert(sig == info->si_signo, "bad siginfo");
|
assert(sig == info->si_signo, "bad siginfo");
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// decide if this trap can be handled by a stub
|
// 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
|
//%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);
|
pc = (address) os::Posix::ucontext_get_pc(uc);
|
||||||
|
|
||||||
address addr = (address) info->si_addr;
|
address addr = (address) info->si_addr;
|
||||||
@ -225,9 +225,9 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
|
|||||||
// here if the underlying file has been truncated.
|
// here if the underlying file has been truncated.
|
||||||
// Do not crash the VM in such a case.
|
// Do not crash the VM in such a case.
|
||||||
CodeBlob* cb = CodeCache::find_blob(pc);
|
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));
|
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 + NativeCall::instruction_size;
|
address next_pc = pc + NativeCall::instruction_size;
|
||||||
if (is_unsafe_arraycopy) {
|
if (is_unsafe_arraycopy) {
|
||||||
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
|
||||||
@ -248,7 +248,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.
|
// 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)
|
// Note: no need to do any post-processing here (e.g. signal chaining)
|
||||||
va_list va_dummy;
|
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);
|
va_end(va_dummy);
|
||||||
|
|
||||||
ShouldNotReachHere();
|
ShouldNotReachHere();
|
||||||
@ -290,9 +290,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
|
// 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);
|
os::Posix::ucontext_set_pc(uc, stub);
|
||||||
return true;
|
return true;
|
||||||
@ -331,7 +331,7 @@ size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
|
|||||||
// helper functions for fatal error handler
|
// helper functions for fatal error handler
|
||||||
|
|
||||||
void os::print_context(outputStream *st, const void *context) {
|
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;
|
const ucontext_t *uc = (const ucontext_t*)context;
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ void os::print_context(outputStream *st, const void *context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void os::print_tos_pc(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;
|
const ucontext_t* uc = (const ucontext_t*)context;
|
||||||
|
|
||||||
@ -360,7 +360,7 @@ void os::print_tos_pc(outputStream *st, const void *context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void os::print_register_info(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;
|
const ucontext_t *uc = (const ucontext_t*)context;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
|
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
@ -157,9 +157,9 @@ void VM_Version::get_os_cpu_info() {
|
|||||||
if (FILE *f = os::fopen("/proc/cpuinfo", "r")) {
|
if (FILE *f = os::fopen("/proc/cpuinfo", "r")) {
|
||||||
// need a large buffer as the flags line may include lots of text
|
// need a large buffer as the flags line may include lots of text
|
||||||
char buf[1024], *p;
|
char buf[1024], *p;
|
||||||
while (fgets(buf, sizeof (buf), f) != NULL) {
|
while (fgets(buf, sizeof (buf), f) != nullptr) {
|
||||||
if ((p = strchr(buf, ':')) != NULL) {
|
if ((p = strchr(buf, ':')) != nullptr) {
|
||||||
long v = strtol(p+1, NULL, 0);
|
long v = strtol(p+1, nullptr, 0);
|
||||||
if (strncmp(buf, "CPU implementer", sizeof "CPU implementer" - 1) == 0) {
|
if (strncmp(buf, "CPU implementer", sizeof "CPU implementer" - 1) == 0) {
|
||||||
_cpu = v;
|
_cpu = v;
|
||||||
} else if (strncmp(buf, "CPU variant", sizeof "CPU variant" - 1) == 0) {
|
} else if (strncmp(buf, "CPU variant", sizeof "CPU variant" - 1) == 0) {
|
||||||
@ -181,7 +181,7 @@ void VM_Version::get_os_cpu_info() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool read_fully(const char *fname, char *buf, size_t buflen) {
|
static bool read_fully(const char *fname, char *buf, size_t buflen) {
|
||||||
assert(buf != NULL, "invalid argument");
|
assert(buf != nullptr, "invalid argument");
|
||||||
assert(buflen >= 1, "invalid argument");
|
assert(buflen >= 1, "invalid argument");
|
||||||
int fd = os::open(fname, O_RDONLY, 0);
|
int fd = os::open(fname, O_RDONLY, 0);
|
||||||
if (fd != -1) {
|
if (fd != -1) {
|
||||||
@ -211,10 +211,10 @@ void VM_Version::get_compatible_board(char *buf, int buflen) {
|
|||||||
"/proc/device-tree/compatible",
|
"/proc/device-tree/compatible",
|
||||||
"/sys/devices/virtual/dmi/id/board_name",
|
"/sys/devices/virtual/dmi/id/board_name",
|
||||||
"/sys/devices/virtual/dmi/id/product_name",
|
"/sys/devices/virtual/dmi/id/product_name",
|
||||||
NULL
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const char **fname = board_name_file_list; *fname != NULL; fname++) {
|
for (const char **fname = board_name_file_list; *fname != nullptr; fname++) {
|
||||||
if (read_fully(*fname, buf, buflen)) {
|
if (read_fully(*fname, buf, buflen)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user