Skip to content

Commit 5d1f71d

Browse files
committedFeb 2, 2023
8301509: Replace NULL with nullptr in os_cpu/linux_x86
Reviewed-by: kbarrett
1 parent 6daff6b commit 5d1f71d

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed
 

‎src/hotspot/os_cpu/linux_x86/javaThread_linux_x86.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
2828

2929
frame JavaThread::pd_last_frame() {
3030
assert(has_last_Java_frame(), "must have last_Java_sp() when suspended");
31-
vmassert(_anchor.last_Java_pc() != NULL, "not walkable");
31+
vmassert(_anchor.last_Java_pc() != nullptr, "not walkable");
3232
return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc());
3333
}
3434

@@ -62,16 +62,16 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
6262
intptr_t* ret_fp;
6363
intptr_t* ret_sp;
6464
address addr = os::fetch_frame_from_context(uc, &ret_sp, &ret_fp);
65-
if (addr == NULL || ret_sp == NULL ) {
65+
if (addr == nullptr || ret_sp == nullptr ) {
6666
// ucontext wasn't useful
6767
return false;
6868
}
6969

7070
frame ret_frame(ret_sp, ret_fp, addr);
7171
if (!ret_frame.safe_for_sender(this)) {
7272
#if COMPILER2_OR_JVMCI
73-
// C2 and JVMCI use ebp as a general register see if NULL fp helps
74-
frame ret_frame2(ret_sp, NULL, addr);
73+
// C2 and JVMCI use ebp as a general register see if null fp helps
74+
frame ret_frame2(ret_sp, nullptr, addr);
7575
if (!ret_frame2.safe_for_sender(this)) {
7676
// nothing else to try if the frame isn't good
7777
return false;

‎src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* 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,
126126
address epc;
127127
const ucontext_t* uc = (const ucontext_t*)ucVoid;
128128

129-
if (uc != NULL) {
129+
if (uc != nullptr) {
130130
epc = os::Posix::ucontext_get_pc(uc);
131131
if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
132132
if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc);
133133
} else {
134-
epc = NULL;
135-
if (ret_sp) *ret_sp = (intptr_t *)NULL;
136-
if (ret_fp) *ret_fp = (intptr_t *)NULL;
134+
epc = nullptr;
135+
if (ret_sp) *ret_sp = (intptr_t *)nullptr;
136+
if (ret_fp) *ret_fp = (intptr_t *)nullptr;
137137
}
138138

139139
return epc;
@@ -209,20 +209,20 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
209209

210210
/*
211211
NOTE: does not seem to work on linux.
212-
if (info == NULL || info->si_code <= 0 || info->si_code == SI_NOINFO) {
212+
if (info == nullptr || info->si_code <= 0 || info->si_code == SI_NOINFO) {
213213
// can't decode this kind of signal
214-
info = NULL;
214+
info = nullptr;
215215
} else {
216216
assert(sig == info->si_signo, "bad siginfo");
217217
}
218218
*/
219219
// decide if this trap can be handled by a stub
220-
address stub = NULL;
220+
address stub = nullptr;
221221

222-
address pc = NULL;
222+
address pc = nullptr;
223223

224224
//%note os_trap_1
225-
if (info != NULL && uc != NULL && thread != NULL) {
225+
if (info != nullptr && uc != nullptr && thread != nullptr) {
226226
pc = (address) os::Posix::ucontext_get_pc(uc);
227227

228228
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,
260260
// here if the underlying file has been truncated.
261261
// Do not crash the VM in such a case.
262262
CodeBlob* cb = CodeCache::find_blob(pc);
263-
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
263+
CompiledMethod* nm = (cb != nullptr) ? cb->as_compiled_method_or_null() : nullptr;
264264
bool is_unsafe_arraycopy = thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc);
265-
if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
265+
if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
266266
address next_pc = Assembler::locate_next_instruction(pc);
267267
if (is_unsafe_arraycopy) {
268268
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
@@ -346,7 +346,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
346346
// the si_code for this condition may change in the future.
347347
// Furthermore, a false-positive should be harmless.
348348
if (UnguardOnExecutionViolation > 0 &&
349-
stub == NULL &&
349+
stub == nullptr &&
350350
(sig == SIGSEGV || sig == SIGBUS) &&
351351
uc->uc_mcontext.gregs[REG_TRAPNO] == trap_page_fault) {
352352
int page_size = os::vm_page_size();
@@ -409,9 +409,9 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
409409
}
410410
#endif // !AMD64
411411

412-
if (stub != NULL) {
412+
if (stub != nullptr) {
413413
// save all thread context in case we need to restore it
414-
if (thread != NULL) thread->set_saved_exception_pc(pc);
414+
if (thread != nullptr) thread->set_saved_exception_pc(pc);
415415

416416
os::Posix::ucontext_set_pc(uc, stub);
417417
return true;
@@ -466,9 +466,9 @@ juint os::cpu_microcode_revision() {
466466
size_t len = sizeof(data);
467467
while (!feof(fp)) {
468468
if (fgets(data, len, fp)) {
469-
if (strstr(data, "microcode") != NULL) {
469+
if (strstr(data, "microcode") != nullptr) {
470470
char* rev = strchr(data, ':');
471-
if (rev != NULL) sscanf(rev + 1, "%x", &result);
471+
if (rev != nullptr) sscanf(rev + 1, "%x", &result);
472472
break;
473473
}
474474
}
@@ -507,7 +507,7 @@ size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
507507
// helper functions for fatal error handler
508508

509509
void os::print_context(outputStream *st, const void *context) {
510-
if (context == NULL) return;
510+
if (context == nullptr) return;
511511

512512
const ucontext_t *uc = (const ucontext_t*)context;
513513

@@ -559,7 +559,7 @@ void os::print_context(outputStream *st, const void *context) {
559559
}
560560

561561
void os::print_tos_pc(outputStream *st, const void *context) {
562-
if (context == NULL) return;
562+
if (context == nullptr) return;
563563

564564
const ucontext_t* uc = (const ucontext_t*)context;
565565

@@ -576,7 +576,7 @@ void os::print_tos_pc(outputStream *st, const void *context) {
576576
}
577577

578578
void os::print_register_info(outputStream *st, const void *context) {
579-
if (context == NULL) return;
579+
if (context == nullptr) return;
580580

581581
const ucontext_t *uc = (const ucontext_t*)context;
582582

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Feb 2, 2023

@openjdk-notifier[bot]
Please sign in to comment.