Skip to content

Commit

Permalink
8301076: Replace NULL with nullptr in share/prims/
Browse files Browse the repository at this point in the history
Reviewed-by: kbarrett, dholmes
  • Loading branch information
jdksjolen committed Jan 31, 2023
1 parent 90ec19e commit b76a52f
Show file tree
Hide file tree
Showing 47 changed files with 2,037 additions and 2,037 deletions.
4 changes: 2 additions & 2 deletions src/hotspot/share/prims/foreignGlobals.inline.hpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -43,7 +43,7 @@ void ForeignGlobals::parse_register_array(objArrayOop jarray, StorageType type_i
}

inline const char* null_safe_string(const char* str) {
return str == nullptr ? "NULL" : str;
return str == nullptr ? "null" : str;
}

#endif // SHARE_PRIMS_FOREIGN_GLOBALS_INLINE_HPP
46 changes: 23 additions & 23 deletions src/hotspot/share/prims/forte.cpp
@@ -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.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -158,7 +158,7 @@ static bool is_decipherable_compiled_frame(JavaThread* thread, frame* fr, Compil
PcDesc* pc_desc = nm->pc_desc_at(fr->pc());

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

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

// Determine if 'fr' is a walkable interpreted frame. Returns false
// if it is not. *method_p, and *bci_p are not set when false is
// returned. *method_p is non-NULL if frame was executing a Java
// returned. *method_p is non-null if frame was executing a Java
// method. *bci_p is != -1 if a valid BCI in the Java method could
// be found.
// Note: this method returns true when a valid Java method is found
Expand Down Expand Up @@ -273,13 +273,13 @@ static bool is_decipherable_interpreted_frame(JavaThread* thread,
// Check the return value of find_initial_Java_frame and the value of
// 'method_p' to decide on how use the results returned by this method.
//
// If 'method_p' is not NULL, an initial Java frame has been found and
// If 'method_p' is not null, an initial Java frame has been found and
// the stack can be walked starting from that initial frame. In this case,
// 'method_p' points to the Method that the initial frame belongs to and
// the initial Java frame is returned in initial_frame_p.
//
// find_initial_Java_frame() returns true if a Method has been found (i.e.,
// 'method_p' is not NULL) and the initial frame that belongs to that Method
// 'method_p' is not null) and the initial frame that belongs to that Method
// is decipherable.
//
// A frame is considered to be decipherable:
Expand All @@ -292,7 +292,7 @@ static bool is_decipherable_interpreted_frame(JavaThread* thread,
// Note that find_initial_Java_frame() can return false even if an initial
// Java method was found (e.g., there is no PCDesc available for the method).
//
// If 'method_p' is NULL, it was not possible to find a Java frame when
// If 'method_p' is null, it was not possible to find a Java frame when
// walking the stack starting from 'fr'. In this case find_initial_Java_frame
// returns false.

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

*method_p = NULL;
*method_p = nullptr;

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

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

if (fr->cb() == NULL) {
if (fr->cb() == nullptr) {

// See if we can find a useful frame
int loop_count;
Expand All @@ -376,9 +376,9 @@ static bool find_initial_Java_frame(JavaThread* thread,
for (loop_count = 0; loop_max == 0 || loop_count < loop_max; loop_count++) {
if (!candidate.safe_for_sender(thread)) return false;
candidate = candidate.sender(&map);
if (candidate.cb() != NULL) break;
if (candidate.cb() != nullptr) break;
}
if (candidate.cb() == NULL) return false;
if (candidate.cb() == nullptr) return false;
}

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

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

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

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

if (candidate.cb() == NULL) return false;
if (candidate.cb() == nullptr) return false;

}

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

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

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

// Check if a Java Method has been found.
if (method == NULL) return;
if (method == nullptr) return;

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

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

collector_func_load((char*)name, NULL, NULL, start,
pointer_delta(end, start, sizeof(jbyte)), 0, NULL);
collector_func_load((char*)name, nullptr, nullptr, start,
pointer_delta(end, start, sizeof(jbyte)), 0, nullptr);
#endif // !_WINDOWS
}

Expand Down

1 comment on commit b76a52f

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.