Skip to content

Commit b76a52f

Browse files
committed
8301076: Replace NULL with nullptr in share/prims/
Reviewed-by: kbarrett, dholmes
1 parent 90ec19e commit b76a52f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2037
-2037
lines changed

src/hotspot/share/prims/foreignGlobals.inline.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2020, 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
@@ -43,7 +43,7 @@ void ForeignGlobals::parse_register_array(objArrayOop jarray, StorageType type_i
4343
}
4444

4545
inline const char* null_safe_string(const char* str) {
46-
return str == nullptr ? "NULL" : str;
46+
return str == nullptr ? "null" : str;
4747
}
4848

4949
#endif // SHARE_PRIMS_FOREIGN_GLOBALS_INLINE_HPP

src/hotspot/share/prims/forte.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2022, 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
@@ -158,7 +158,7 @@ static bool is_decipherable_compiled_frame(JavaThread* thread, frame* fr, Compil
158158
PcDesc* pc_desc = nm->pc_desc_at(fr->pc());
159159

160160
// Did we find a useful PcDesc?
161-
if (pc_desc != NULL &&
161+
if (pc_desc != nullptr &&
162162
pc_desc->scope_decode_offset() != DebugInformationRecorder::serialized_null) {
163163
return true;
164164
}
@@ -172,7 +172,7 @@ static bool is_decipherable_compiled_frame(JavaThread* thread, frame* fr, Compil
172172
PcDesc* pc_desc = nm->pc_desc_near(fr->pc() + 1);
173173

174174
// Now do we have a useful PcDesc?
175-
if (pc_desc == NULL ||
175+
if (pc_desc == nullptr ||
176176
pc_desc->scope_decode_offset() == DebugInformationRecorder::serialized_null) {
177177
// No debug information is available for this PC.
178178
//
@@ -207,7 +207,7 @@ static bool is_decipherable_compiled_frame(JavaThread* thread, frame* fr, Compil
207207

208208
// Determine if 'fr' is a walkable interpreted frame. Returns false
209209
// if it is not. *method_p, and *bci_p are not set when false is
210-
// returned. *method_p is non-NULL if frame was executing a Java
210+
// returned. *method_p is non-null if frame was executing a Java
211211
// method. *bci_p is != -1 if a valid BCI in the Java method could
212212
// be found.
213213
// Note: this method returns true when a valid Java method is found
@@ -273,13 +273,13 @@ static bool is_decipherable_interpreted_frame(JavaThread* thread,
273273
// Check the return value of find_initial_Java_frame and the value of
274274
// 'method_p' to decide on how use the results returned by this method.
275275
//
276-
// If 'method_p' is not NULL, an initial Java frame has been found and
276+
// If 'method_p' is not null, an initial Java frame has been found and
277277
// the stack can be walked starting from that initial frame. In this case,
278278
// 'method_p' points to the Method that the initial frame belongs to and
279279
// the initial Java frame is returned in initial_frame_p.
280280
//
281281
// find_initial_Java_frame() returns true if a Method has been found (i.e.,
282-
// 'method_p' is not NULL) and the initial frame that belongs to that Method
282+
// 'method_p' is not null) and the initial frame that belongs to that Method
283283
// is decipherable.
284284
//
285285
// A frame is considered to be decipherable:
@@ -292,7 +292,7 @@ static bool is_decipherable_interpreted_frame(JavaThread* thread,
292292
// Note that find_initial_Java_frame() can return false even if an initial
293293
// Java method was found (e.g., there is no PCDesc available for the method).
294294
//
295-
// If 'method_p' is NULL, it was not possible to find a Java frame when
295+
// If 'method_p' is null, it was not possible to find a Java frame when
296296
// walking the stack starting from 'fr'. In this case find_initial_Java_frame
297297
// returns false.
298298

@@ -305,10 +305,10 @@ static bool find_initial_Java_frame(JavaThread* thread,
305305
// It is possible that for a frame containing a compiled method
306306
// we can capture the method but no bci. If we get no
307307
// bci the frame isn't walkable but the method is usable.
308-
// Therefore we init the returned Method* to NULL so the
308+
// Therefore we init the returned Method* to null so the
309309
// caller can make the distinction.
310310

311-
*method_p = NULL;
311+
*method_p = nullptr;
312312

313313
// On the initial call to this method the frame we get may not be
314314
// recognizable to us. This should only happen if we are in a JRT_LEAF
@@ -333,11 +333,11 @@ static bool find_initial_Java_frame(JavaThread* thread,
333333
}
334334

335335
if (candidate.is_entry_frame()) {
336-
// jcw is NULL if the java call wrapper could not be found
336+
// jcw is null if the java call wrapper could not be found
337337
JavaCallWrapper* jcw = candidate.entry_frame_call_wrapper_if_safe(thread);
338338
// If initial frame is frame from StubGenerator and there is no
339339
// previous anchor, there are no java frames associated with a method
340-
if (jcw == NULL || jcw->is_first_frame()) {
340+
if (jcw == nullptr || jcw->is_first_frame()) {
341341
return false;
342342
}
343343
}
@@ -363,7 +363,7 @@ static bool find_initial_Java_frame(JavaThread* thread,
363363
// it see if we can find such a frame because only frames with codeBlobs
364364
// are possible Java frames.
365365

366-
if (fr->cb() == NULL) {
366+
if (fr->cb() == nullptr) {
367367

368368
// See if we can find a useful frame
369369
int loop_count;
@@ -376,9 +376,9 @@ static bool find_initial_Java_frame(JavaThread* thread,
376376
for (loop_count = 0; loop_max == 0 || loop_count < loop_max; loop_count++) {
377377
if (!candidate.safe_for_sender(thread)) return false;
378378
candidate = candidate.sender(&map);
379-
if (candidate.cb() != NULL) break;
379+
if (candidate.cb() != nullptr) break;
380380
}
381-
if (candidate.cb() == NULL) return false;
381+
if (candidate.cb() == nullptr) return false;
382382
}
383383

384384
// We have a frame known to be in the codeCache
@@ -393,11 +393,11 @@ static bool find_initial_Java_frame(JavaThread* thread,
393393
for (loop_count = 0; loop_max == 0 || loop_count < loop_max; loop_count++) {
394394

395395
if (candidate.is_entry_frame()) {
396-
// jcw is NULL if the java call wrapper couldn't be found
396+
// jcw is null if the java call wrapper couldn't be found
397397
JavaCallWrapper *jcw = candidate.entry_frame_call_wrapper_if_safe(thread);
398398
// If initial frame is frame from StubGenerator and there is no
399399
// previous anchor, there are no java frames associated with a method
400-
if (jcw == NULL || jcw->is_first_frame()) {
400+
if (jcw == nullptr || jcw->is_first_frame()) {
401401
return false;
402402
}
403403
}
@@ -443,7 +443,7 @@ static bool find_initial_Java_frame(JavaThread* thread,
443443
// is_decipherable_compiled_frame may modify candidate's pc
444444
*initial_frame_p = candidate;
445445

446-
assert(nm->pc_desc_at(candidate.pc()) != NULL, "debug information must be available if the frame is decipherable");
446+
assert(nm->pc_desc_at(candidate.pc()) != nullptr, "debug information must be available if the frame is decipherable");
447447

448448
return true;
449449
}
@@ -457,7 +457,7 @@ static bool find_initial_Java_frame(JavaThread* thread,
457457
// since once we find a frame in the code cache they
458458
// all should be there.
459459

460-
if (candidate.cb() == NULL) return false;
460+
if (candidate.cb() == nullptr) return false;
461461

462462
}
463463

@@ -478,13 +478,13 @@ static void forte_fill_call_trace_given_top(JavaThread* thd,
478478
int count;
479479

480480
count = 0;
481-
assert(trace->frames != NULL, "trace->frames must be non-NULL");
481+
assert(trace->frames != nullptr, "trace->frames must be non-null");
482482

483483
// Walk the stack starting from 'top_frame' and search for an initial Java frame.
484484
find_initial_Java_frame(thd, &top_frame, &initial_Java_frame, &method, &bci);
485485

486486
// Check if a Java Method has been found.
487-
if (method == NULL) return;
487+
if (method == nullptr) return;
488488

489489
if (!Method::is_valid_method(method)) {
490490
trace->num_frames = ticks_GC_active; // -2
@@ -579,7 +579,7 @@ void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) {
579579
Thread* raw_thread = Thread::current_or_null_safe();
580580
JavaThread* thread;
581581

582-
if (trace->env_id == NULL || raw_thread == NULL || !raw_thread->is_Java_thread() ||
582+
if (trace->env_id == nullptr || raw_thread == nullptr || !raw_thread->is_Java_thread() ||
583583
(thread = JavaThread::cast(raw_thread))->is_exiting()) {
584584
// bad env_id, thread has exited or thread is exiting
585585
trace->num_frames = ticks_thread_exit; // -8
@@ -710,8 +710,8 @@ void Forte::register_stub(const char* name, address start, address end) {
710710
assert(pointer_delta(end, start, sizeof(jbyte)) < INT_MAX,
711711
"Code size exceeds maximum range");
712712

713-
collector_func_load((char*)name, NULL, NULL, start,
714-
pointer_delta(end, start, sizeof(jbyte)), 0, NULL);
713+
collector_func_load((char*)name, nullptr, nullptr, start,
714+
pointer_delta(end, start, sizeof(jbyte)), 0, nullptr);
715715
#endif // !_WINDOWS
716716
}
717717

0 commit comments

Comments
 (0)