Skip to content

Commit b81f0ff

Browse files
committed
8301505: Replace NULL with nullptr in os_cpu/linux_arm
Reviewed-by: kbarrett
1 parent 42a286a commit b81f0ff

File tree

3 files changed

+39
-39
lines changed

3 files changed

+39
-39
lines changed

src/hotspot/os_cpu/linux_arm/javaThread_linux_arm.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 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
@@ -32,7 +32,7 @@
3232

3333
frame JavaThread::pd_last_frame() {
3434
assert(has_last_Java_frame(), "must have last_Java_sp() when suspended");
35-
if (_anchor.last_Java_pc() != NULL) {
35+
if (_anchor.last_Java_pc() != nullptr) {
3636
return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc());
3737
} else {
3838
// This will pick up pc from sp
@@ -46,7 +46,7 @@ void JavaThread::cache_global_variables() {
4646
if (bs->is_a(BarrierSet::CardTableBarrierSet)) {
4747
_card_table_base = (address) (barrier_set_cast<CardTableBarrierSet>(bs)->card_table()->byte_map_base());
4848
} else {
49-
_card_table_base = NULL;
49+
_card_table_base = nullptr;
5050
}
5151

5252
}
@@ -86,16 +86,16 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
8686
intptr_t* ret_fp;
8787
intptr_t* ret_sp;
8888
address addr = os::fetch_frame_from_context(uc, &ret_sp, &ret_fp);
89-
if (addr == NULL || ret_sp == NULL ) {
89+
if (addr == nullptr || ret_sp == nullptr ) {
9090
// ucontext wasn't useful
9191
return false;
9292
}
9393

9494
frame ret_frame(ret_sp, ret_fp, addr);
9595
if (!ret_frame.safe_for_sender(this)) {
9696
#ifdef COMPILER2
97-
// C2 uses ebp as a general register see if NULL fp helps
98-
frame ret_frame2(ret_sp, NULL, addr);
97+
// C2 uses ebp as a general register see if null fp helps
98+
frame ret_frame2(ret_sp, nullptr, addr);
9999
if (!ret_frame2.safe_for_sender(this)) {
100100
// nothing else to try if the frame isn't good
101101
return false;

src/hotspot/os_cpu/linux_arm/javaThread_linux_arm.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 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
@@ -33,7 +33,7 @@
3333

3434
void pd_initialize() {
3535
_anchor.clear();
36-
_in_top_frame_unsafe_section = NULL;
36+
_in_top_frame_unsafe_section = nullptr;
3737
}
3838

3939
frame pd_last_frame();

src/hotspot/os_cpu/linux_arm/os_linux_arm.cpp

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 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
@@ -133,7 +133,7 @@ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t* uc) {
133133

134134
bool is_safe_for_fp(address pc) {
135135
#ifdef __thumb__
136-
if (CodeCache::find_blob(pc) != NULL) {
136+
if (CodeCache::find_blob(pc) != nullptr) {
137137
return true;
138138
}
139139
// For thumb C frames, given an fp we have no idea how to access the frame contents.
@@ -155,13 +155,13 @@ address os::fetch_frame_from_context(const void* ucVoid,
155155
address epc;
156156
const ucontext_t* uc = (const ucontext_t*)ucVoid;
157157

158-
if (uc != NULL) {
158+
if (uc != nullptr) {
159159
epc = os::Posix::ucontext_get_pc(uc);
160160
if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
161161
if (ret_fp) {
162162
intptr_t* fp = os::Linux::ucontext_get_fp(uc);
163163
#ifndef __thumb__
164-
if (CodeCache::find_blob(epc) == NULL) {
164+
if (CodeCache::find_blob(epc) == nullptr) {
165165
// It's a C frame. We need to adjust the fp.
166166
fp += C_frame_offset;
167167
}
@@ -172,14 +172,14 @@ address os::fetch_frame_from_context(const void* ucVoid,
172172
// potentially necessary.
173173
if (!is_safe_for_fp(epc)) {
174174
// FP unreliable
175-
fp = (intptr_t *)NULL;
175+
fp = (intptr_t *)nullptr;
176176
}
177177
*ret_fp = fp;
178178
}
179179
} else {
180-
epc = NULL;
181-
if (ret_sp) *ret_sp = (intptr_t *)NULL;
182-
if (ret_fp) *ret_fp = (intptr_t *)NULL;
180+
epc = nullptr;
181+
if (ret_sp) *ret_sp = (intptr_t *)nullptr;
182+
if (ret_fp) *ret_fp = (intptr_t *)nullptr;
183183
}
184184

185185
return epc;
@@ -199,7 +199,7 @@ frame os::get_sender_for_C_frame(frame* fr) {
199199
#else
200200
address pc = fr->sender_pc();
201201
if (! is_safe_for_fp(pc)) {
202-
return frame(fr->sender_sp(), (intptr_t *)NULL, pc);
202+
return frame(fr->sender_sp(), (intptr_t *)nullptr, pc);
203203
} else {
204204
return frame(fr->sender_sp(), fr->link() + C_frame_offset, pc);
205205
}
@@ -243,10 +243,10 @@ extern "C" address check_vfp3_32_fault_instr;
243243
extern "C" address check_simd_fault_instr;
244244
extern "C" address check_mp_ext_fault_instr;
245245

246-
address check_vfp_fault_instr = NULL;
247-
address check_vfp3_32_fault_instr = NULL;
248-
address check_simd_fault_instr = NULL;
249-
address check_mp_ext_fault_instr = NULL;
246+
address check_vfp_fault_instr = nullptr;
247+
address check_vfp3_32_fault_instr = nullptr;
248+
address check_simd_fault_instr = nullptr;
249+
address check_mp_ext_fault_instr = nullptr;
250250

251251

252252
bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
@@ -264,11 +264,11 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
264264
return true;
265265
}
266266

267-
address stub = NULL;
268-
address pc = NULL;
267+
address stub = nullptr;
268+
address pc = nullptr;
269269
bool unsafe_access = false;
270270

271-
if (info != NULL && uc != NULL && thread != NULL) {
271+
if (info != nullptr && uc != nullptr && thread != nullptr) {
272272
pc = (address) os::Posix::ucontext_get_pc(uc);
273273

274274
// Handle ALL stack overflow variations here
@@ -324,15 +324,15 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
324324
// here if the underlying file has been truncated.
325325
// Do not crash the VM in such a case.
326326
CodeBlob* cb = CodeCache::find_blob(pc);
327-
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
328-
if ((nm != NULL && nm->has_unsafe_access()) || (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc))) {
327+
CompiledMethod* nm = (cb != nullptr) ? cb->as_compiled_method_or_null() : nullptr;
328+
if ((nm != nullptr && nm->has_unsafe_access()) || (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc))) {
329329
unsafe_access = true;
330330
}
331331
} else if (sig == SIGSEGV &&
332332
MacroAssembler::uses_implicit_null_check(info->si_addr)) {
333333
// Determination of interpreter/vtable stub/compiled code null exception
334334
CodeBlob* cb = CodeCache::find_blob(pc);
335-
if (cb != NULL) {
335+
if (cb != nullptr) {
336336
stub = SharedRuntime::continuation_for_implicit_exception(thread, pc, SharedRuntime::IMPLICIT_NULL);
337337
}
338338
} else if (sig == SIGILL && *(int *)pc == NativeInstruction::not_entrant_illegal_instruction) {
@@ -355,7 +355,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
355355
}
356356
}
357357

358-
if (unsafe_access && stub == NULL) {
358+
if (unsafe_access && stub == nullptr) {
359359
// it can be an unsafe access and we haven't found
360360
// any other suitable exception reason,
361361
// so assume it is an unsafe access.
@@ -372,7 +372,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
372372
stub = SharedRuntime::handle_unsafe_access(thread, next_pc);
373373
}
374374

375-
if (stub != NULL) {
375+
if (stub != nullptr) {
376376
#ifdef __thumb__
377377
if (uc->uc_mcontext.arm_cpsr & PSR_T_BIT) {
378378
intptr_t p = (intptr_t)pc | 0x1;
@@ -390,7 +390,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
390390
#endif
391391

392392
// save all thread context in case we need to restore it
393-
if (thread != NULL) thread->set_saved_exception_pc(pc);
393+
if (thread != nullptr) thread->set_saved_exception_pc(pc);
394394

395395
os::Posix::ucontext_set_pc(uc, stub);
396396
return true;
@@ -442,7 +442,7 @@ size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
442442
// helper functions for fatal error handler
443443

444444
void os::print_context(outputStream *st, const void *context) {
445-
if (context == NULL) return;
445+
if (context == nullptr) return;
446446

447447
const ucontext_t *uc = (const ucontext_t*)context;
448448

@@ -471,7 +471,7 @@ void os::print_context(outputStream *st, const void *context) {
471471
}
472472

473473
void os::print_tos_pc(outputStream *st, const void *context) {
474-
if (context == NULL) return;
474+
if (context == nullptr) return;
475475

476476
const ucontext_t* uc = (const ucontext_t*)context;
477477

@@ -488,7 +488,7 @@ void os::print_tos_pc(outputStream *st, const void *context) {
488488
}
489489

490490
void os::print_register_info(outputStream *st, const void *context) {
491-
if (context == NULL) return;
491+
if (context == nullptr) return;
492492

493493
const ucontext_t *uc = (const ucontext_t*)context;
494494

@@ -514,7 +514,7 @@ int64_t ARMAtomicFuncs::cmpxchg_long_bootstrap(int64_t compare_value, int64_t ex
514514
// try to use the stub:
515515
cmpxchg_long_func_t func = CAST_TO_FN_PTR(cmpxchg_long_func_t, StubRoutines::atomic_cmpxchg_long_entry());
516516

517-
if (func != NULL) {
517+
if (func != nullptr) {
518518
_cmpxchg_long_func = func;
519519
return (*func)(compare_value, exchange_value, dest);
520520
}
@@ -530,7 +530,7 @@ int64_t ARMAtomicFuncs::load_long_bootstrap(const volatile int64_t* src) {
530530
// try to use the stub:
531531
load_long_func_t func = CAST_TO_FN_PTR(load_long_func_t, StubRoutines::atomic_load_long_entry());
532532

533-
if (func != NULL) {
533+
if (func != nullptr) {
534534
_load_long_func = func;
535535
return (*func)(src);
536536
}
@@ -544,7 +544,7 @@ void ARMAtomicFuncs::store_long_bootstrap(int64_t val, volatile int64_t* dest) {
544544
// try to use the stub:
545545
store_long_func_t func = CAST_TO_FN_PTR(store_long_func_t, StubRoutines::atomic_store_long_entry());
546546

547-
if (func != NULL) {
547+
if (func != nullptr) {
548548
_store_long_func = func;
549549
return (*func)(val, dest);
550550
}
@@ -556,7 +556,7 @@ void ARMAtomicFuncs::store_long_bootstrap(int64_t val, volatile int64_t* dest) {
556556
int32_t ARMAtomicFuncs::add_bootstrap(int32_t add_value, volatile int32_t *dest) {
557557
atomic_add_func_t func = CAST_TO_FN_PTR(atomic_add_func_t,
558558
StubRoutines::atomic_add_entry());
559-
if (func != NULL) {
559+
if (func != nullptr) {
560560
_add_func = func;
561561
return (*func)(add_value, dest);
562562
}
@@ -569,7 +569,7 @@ int32_t ARMAtomicFuncs::add_bootstrap(int32_t add_value, volatile int32_t *dest)
569569
int32_t ARMAtomicFuncs::xchg_bootstrap(int32_t exchange_value, volatile int32_t *dest) {
570570
atomic_xchg_func_t func = CAST_TO_FN_PTR(atomic_xchg_func_t,
571571
StubRoutines::atomic_xchg_entry());
572-
if (func != NULL) {
572+
if (func != nullptr) {
573573
_xchg_func = func;
574574
return (*func)(exchange_value, dest);
575575
}
@@ -583,7 +583,7 @@ int32_t ARMAtomicFuncs::cmpxchg_bootstrap(int32_t compare_value, int32_t exchang
583583
// try to use the stub:
584584
cmpxchg_func_t func = CAST_TO_FN_PTR(cmpxchg_func_t, StubRoutines::atomic_cmpxchg_entry());
585585

586-
if (func != NULL) {
586+
if (func != nullptr) {
587587
_cmpxchg_func = func;
588588
return (*func)(compare_value, exchange_value, dest);
589589
}

0 commit comments

Comments
 (0)