1
1
/*
2
- * Copyright (c) 1997, 2022 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 1997, 2023 , Oracle and/or its affiliates. All rights reserved.
3
3
* Copyright (c) 2012, 2021 SAP SE. All rights reserved.
4
4
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
5
*
@@ -105,15 +105,15 @@ address os::Posix::ucontext_get_pc(const ucontext_t * uc) {
105
105
// - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
106
106
// it because the volatile registers are not needed to make setcontext() work.
107
107
// Hopefully it was zero'd out beforehand.
108
- guarantee (uc->uc_mcontext .regs != NULL , " only use ucontext_get_pc in sigaction context" );
108
+ guarantee (uc->uc_mcontext .regs != nullptr , " only use ucontext_get_pc in sigaction context" );
109
109
return (address)uc->uc_mcontext .regs ->nip ;
110
110
}
111
111
112
112
// modify PC in ucontext.
113
113
// Note: Only use this for an ucontext handed down to a signal handler. See comment
114
114
// in ucontext_get_pc.
115
115
void os::Posix::ucontext_set_pc (ucontext_t * uc, address pc) {
116
- guarantee (uc->uc_mcontext .regs != NULL , " only use ucontext_set_pc in sigaction context" );
116
+ guarantee (uc->uc_mcontext .regs != nullptr , " only use ucontext_set_pc in sigaction context" );
117
117
uc->uc_mcontext .regs ->nip = (unsigned long )pc;
118
118
}
119
119
@@ -126,7 +126,7 @@ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
126
126
}
127
127
128
128
intptr_t * os::Linux::ucontext_get_fp (const ucontext_t * uc) {
129
- return NULL ;
129
+ return nullptr ;
130
130
}
131
131
132
132
static unsigned long ucontext_get_trap (const ucontext_t * uc) {
@@ -139,14 +139,14 @@ address os::fetch_frame_from_context(const void* ucVoid,
139
139
address epc;
140
140
const ucontext_t * uc = (const ucontext_t *)ucVoid;
141
141
142
- if (uc != NULL ) {
142
+ if (uc != nullptr ) {
143
143
epc = os::Posix::ucontext_get_pc (uc);
144
144
if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp (uc);
145
145
if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp (uc);
146
146
} else {
147
- epc = NULL ;
148
- if (ret_sp) *ret_sp = (intptr_t *)NULL ;
149
- if (ret_fp) *ret_fp = (intptr_t *)NULL ;
147
+ epc = nullptr ;
148
+ if (ret_sp) *ret_sp = (intptr_t *)nullptr ;
149
+ if (ret_fp) *ret_fp = (intptr_t *)nullptr ;
150
150
}
151
151
152
152
return epc;
@@ -169,7 +169,7 @@ frame os::fetch_compiled_frame_from_context(const void* ucVoid) {
169
169
frame os::get_sender_for_C_frame (frame* fr) {
170
170
if (*fr->sp () == 0 ) {
171
171
// fr is the last C frame
172
- return frame (NULL , NULL );
172
+ return frame (nullptr , nullptr );
173
173
}
174
174
return frame (fr->sender_sp (), fr->sender_pc ());
175
175
}
@@ -207,10 +207,10 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
207
207
}
208
208
209
209
// decide if this trap can be handled by a stub
210
- address stub = NULL ;
211
- address pc = NULL ;
210
+ address stub = nullptr ;
211
+ address pc = nullptr ;
212
212
213
- if (info != NULL && uc != NULL && thread != NULL ) {
213
+ if (info != nullptr && uc != nullptr && thread != nullptr ) {
214
214
pc = (address) os::Posix::ucontext_get_pc (uc);
215
215
216
216
// Handle ALL stack overflow variations here
@@ -245,7 +245,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
245
245
// Java thread running in Java code => find exception handler if any
246
246
// a fault inside compiled code, the interpreter, or a stub
247
247
248
- CodeBlob *cb = NULL ;
248
+ CodeBlob *cb = nullptr ;
249
249
int stop_type = -1 ;
250
250
// Handle signal from NativeJump::patch_verified_entry().
251
251
if (sig == SIGILL && nativeInstruction_at (pc)->is_sigill_not_entrant ()) {
@@ -263,7 +263,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
263
263
// doesn't work for us. We use:
264
264
((NativeInstruction*)pc)->is_safepoint_poll () &&
265
265
CodeCache::contains ((void *) pc) &&
266
- ((cb = CodeCache::find_blob (pc)) != NULL ) &&
266
+ ((cb = CodeCache::find_blob (pc)) != nullptr ) &&
267
267
cb->is_compiled ()) {
268
268
if (TraceTraps) {
269
269
tty->print_cr (" trap: safepoint_poll at " INTPTR_FORMAT " (%s)" , p2i (pc),
@@ -275,7 +275,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
275
275
else if (UseSIGTRAP && sig == SIGTRAP &&
276
276
((NativeInstruction*)pc)->is_safepoint_poll_return () &&
277
277
CodeCache::contains ((void *) pc) &&
278
- ((cb = CodeCache::find_blob (pc)) != NULL ) &&
278
+ ((cb = CodeCache::find_blob (pc)) != nullptr ) &&
279
279
cb->is_compiled ()) {
280
280
if (TraceTraps) {
281
281
tty->print_cr (" trap: safepoint_poll at return at " INTPTR_FORMAT " (nmethod)" , p2i (pc));
@@ -327,7 +327,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
327
327
bool msg_present = (stop_type & MacroAssembler::stop_msg_present);
328
328
stop_type = (stop_type &~ MacroAssembler::stop_msg_present);
329
329
330
- const char *msg = NULL ;
330
+ const char *msg = nullptr ;
331
331
switch (stop_type) {
332
332
case MacroAssembler::stop_stop : msg = " stop" ; break ;
333
333
case MacroAssembler::stop_untested : msg = " untested" ; break ;
@@ -346,7 +346,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
346
346
// End life with a fatal error, message and detail message and the context.
347
347
// Note: no need to do any post-processing here (e.g. signal chaining)
348
348
va_list va_dummy;
349
- VMError::report_and_die (thread, uc, NULL , 0 , msg, detail_msg, va_dummy);
349
+ VMError::report_and_die (thread, uc, nullptr , 0 , msg, detail_msg, va_dummy);
350
350
va_end (va_dummy);
351
351
352
352
ShouldNotReachHere ();
@@ -357,9 +357,9 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
357
357
// BugId 4454115: A read from a MappedByteBuffer can fault here if the
358
358
// underlying file has been truncated. Do not crash the VM in such a case.
359
359
CodeBlob* cb = CodeCache::find_blob (pc);
360
- CompiledMethod* nm = (cb != NULL ) ? cb->as_compiled_method_or_null () : NULL ;
360
+ CompiledMethod* nm = (cb != nullptr ) ? cb->as_compiled_method_or_null () : nullptr ;
361
361
bool is_unsafe_arraycopy = (thread->doing_unsafe_access () && UnsafeCopyMemory::contains_pc (pc));
362
- if ((nm != NULL && nm->has_unsafe_access ()) || is_unsafe_arraycopy) {
362
+ if ((nm != nullptr && nm->has_unsafe_access ()) || is_unsafe_arraycopy) {
363
363
address next_pc = pc + 4 ;
364
364
if (is_unsafe_arraycopy) {
365
365
next_pc = UnsafeCopyMemory::page_error_continue_pc (pc);
@@ -401,9 +401,9 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
401
401
}
402
402
}
403
403
404
- if (stub != NULL ) {
404
+ if (stub != nullptr ) {
405
405
// Save all thread context in case we need to restore it.
406
- if (thread != NULL ) thread->set_saved_exception_pc (pc);
406
+ if (thread != nullptr ) thread->set_saved_exception_pc (pc);
407
407
os::Posix::ucontext_set_pc (uc, stub);
408
408
return true ;
409
409
}
@@ -447,7 +447,7 @@ size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
447
447
// helper functions for fatal error handler
448
448
449
449
void os::print_context (outputStream *st, const void *context) {
450
- if (context == NULL ) return ;
450
+ if (context == nullptr ) return ;
451
451
452
452
const ucontext_t * uc = (const ucontext_t *)context;
453
453
@@ -465,7 +465,7 @@ void os::print_context(outputStream *st, const void *context) {
465
465
}
466
466
467
467
void os::print_tos_pc (outputStream *st, const void *context) {
468
- if (context == NULL ) return ;
468
+ if (context == nullptr ) return ;
469
469
470
470
const ucontext_t * uc = (const ucontext_t *)context;
471
471
@@ -482,7 +482,7 @@ void os::print_tos_pc(outputStream *st, const void *context) {
482
482
}
483
483
484
484
void os::print_register_info (outputStream *st, const void *context) {
485
- if (context == NULL ) return ;
485
+ if (context == nullptr ) return ;
486
486
487
487
const ucontext_t *uc = (const ucontext_t *)context;
488
488
0 commit comments