8300245: Replace NULL with nullptr in share/jfr/

Reviewed-by: mgronlun, coleenp
This commit is contained in:
Johan Sjölen 2023-05-10 12:35:21 +00:00
parent 4251b56214
commit cc396895e5
125 changed files with 2065 additions and 2069 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 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
@ -53,62 +53,62 @@ static int valid_offset = invalid_offset;
static bool setup_event_writer_offsets(TRAPS) {
const char class_name[] = "jdk/jfr/internal/event/EventWriter";
Symbol* const k_sym = SymbolTable::new_symbol(class_name);
assert(k_sym != NULL, "invariant");
assert(k_sym != nullptr, "invariant");
Klass* klass = SystemDictionary::resolve_or_fail(k_sym, true, CHECK_false);
assert(klass != NULL, "invariant");
assert(klass != nullptr, "invariant");
const char start_pos_name[] = "startPosition";
Symbol* const start_pos_sym = SymbolTable::new_symbol(start_pos_name);
assert(start_pos_sym != NULL, "invariant");
assert(start_pos_sym != nullptr, "invariant");
assert(invalid_offset == start_pos_offset, "invariant");
JfrJavaSupport::compute_field_offset(start_pos_offset, klass, start_pos_sym, vmSymbols::long_signature());
assert(start_pos_offset != invalid_offset, "invariant");
const char start_pos_address_name[] = "startPositionAddress";
Symbol* const start_pos_address_sym = SymbolTable::new_symbol(start_pos_address_name);
assert(start_pos_address_sym != NULL, "invariant");
assert(start_pos_address_sym != nullptr, "invariant");
assert(invalid_offset == start_pos_address_offset, "invariant");
JfrJavaSupport::compute_field_offset(start_pos_address_offset, klass, start_pos_address_sym, vmSymbols::long_signature());
assert(start_pos_address_offset != invalid_offset, "invariant");
const char event_pos_name[] = "currentPosition";
Symbol* const event_pos_sym = SymbolTable::new_symbol(event_pos_name);
assert(event_pos_sym != NULL, "invariant");
assert(event_pos_sym != nullptr, "invariant");
assert(invalid_offset == current_pos_offset, "invariant");
JfrJavaSupport::compute_field_offset(current_pos_offset, klass, event_pos_sym,vmSymbols::long_signature());
assert(current_pos_offset != invalid_offset, "invariant");
const char max_pos_name[] = "maxPosition";
Symbol* const max_pos_sym = SymbolTable::new_symbol(max_pos_name);
assert(max_pos_sym != NULL, "invariant");
assert(max_pos_sym != nullptr, "invariant");
assert(invalid_offset == max_pos_offset, "invariant");
JfrJavaSupport::compute_field_offset(max_pos_offset, klass, max_pos_sym, vmSymbols::long_signature());
assert(max_pos_offset != invalid_offset, "invariant");
const char notified_name[] = "notified";
Symbol* const notified_sym = SymbolTable::new_symbol(notified_name);
assert (notified_sym != NULL, "invariant");
assert (notified_sym != nullptr, "invariant");
assert(invalid_offset == notified_offset, "invariant");
JfrJavaSupport::compute_field_offset(notified_offset, klass, notified_sym, vmSymbols::bool_signature());
assert(notified_offset != invalid_offset, "invariant");
const char excluded_name[] = "excluded";
Symbol* const excluded_sym = SymbolTable::new_symbol(excluded_name);
assert(excluded_sym != NULL, "invariant");
assert(excluded_sym != nullptr, "invariant");
assert(invalid_offset == excluded_offset, "invariant");
JfrJavaSupport::compute_field_offset(excluded_offset, klass, excluded_sym, vmSymbols::bool_signature());
assert(excluded_offset != invalid_offset, "invariant");
const char threadID_name[] = "threadID";
Symbol * const threadID_sym = SymbolTable::new_symbol(threadID_name);
assert(threadID_sym != NULL, "invariant");
assert(threadID_sym != nullptr, "invariant");
assert(invalid_offset == thread_id_offset, "invariant");
JfrJavaSupport::compute_field_offset(thread_id_offset, klass, threadID_sym, vmSymbols::long_signature());
assert(thread_id_offset != invalid_offset, "invariant");
const char valid_name[] = "valid";
Symbol* const valid_sym = SymbolTable::new_symbol(valid_name);
assert (valid_sym != NULL, "invariant");
assert (valid_sym != nullptr, "invariant");
assert(invalid_offset == valid_offset, "invariant");
JfrJavaSupport::compute_field_offset(valid_offset, klass, valid_sym, vmSymbols::bool_signature());
assert(valid_offset != invalid_offset, "invariant");
@ -125,13 +125,13 @@ bool JfrJavaEventWriter::initialize() {
jboolean JfrJavaEventWriter::flush(jobject writer, jint used, jint requested, JavaThread* jt) {
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(jt));
assert(writer != NULL, "invariant");
assert(writer != nullptr, "invariant");
oop const w = JNIHandles::resolve_non_null(writer);
assert(w != NULL, "invariant");
assert(w != nullptr, "invariant");
JfrBuffer* const current = jt->jfr_thread_local()->java_buffer();
assert(current != NULL, "invariant");
assert(current != nullptr, "invariant");
JfrBuffer* const buffer = JfrStorage::flush(current, used, requested, false, jt);
assert(buffer != NULL, "invariant");
assert(buffer != nullptr, "invariant");
// "validity" is contextually defined here to mean
// that some memory location was provided that is
// large enough to accommodate the "requested size".
@ -195,17 +195,17 @@ void JfrJavaEventWriter::include(traceid tid, const JavaThread* jt) {
}
void JfrJavaEventWriter::notify(JavaThread* jt) {
assert(jt != NULL, "invariant");
assert(jt != nullptr, "invariant");
assert(SafepointSynchronize::is_at_safepoint(), "invariant");
if (jt->jfr_thread_local()->has_java_event_writer()) {
oop buffer_writer = JNIHandles::resolve_non_null(jt->jfr_thread_local()->java_event_writer());
assert(buffer_writer != NULL, "invariant");
assert(buffer_writer != nullptr, "invariant");
buffer_writer->release_bool_field_put(notified_offset, JNI_TRUE);
}
}
static jobject create_new_event_writer(JfrBuffer* buffer, JfrThreadLocal* tl, TRAPS) {
assert(buffer != NULL, "invariant");
assert(buffer != nullptr, "invariant");
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(THREAD));
HandleMark hm(THREAD);
static const char klass[] = "jdk/jfr/internal/event/EventWriter";
@ -228,11 +228,11 @@ static jobject create_new_event_writer(JfrBuffer* buffer, JfrThreadLocal* tl, TR
jobject JfrJavaEventWriter::event_writer(JavaThread* jt) {
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(jt));
JfrThreadLocal* const tl = jt->jfr_thread_local();
assert(tl->shelved_buffer() == NULL, "invariant");
assert(tl->shelved_buffer() == nullptr, "invariant");
jobject h_writer = tl->java_event_writer();
if (h_writer != NULL) {
if (h_writer != nullptr) {
oop writer = JNIHandles::resolve_non_null(h_writer);
assert(writer != NULL, "invariant");
assert(writer != nullptr, "invariant");
const jlong event_writer_tid = writer->long_field(thread_id_offset);
const jlong current_tid = static_cast<jlong>(JfrThreadLocal::thread_id(jt));
if (event_writer_tid != current_tid) {
@ -246,13 +246,13 @@ jobject JfrJavaEventWriter::event_writer(JavaThread* jt) {
jobject JfrJavaEventWriter::new_event_writer(TRAPS) {
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(THREAD));
assert(event_writer(THREAD) == NULL, "invariant");
assert(event_writer(THREAD) == nullptr, "invariant");
JfrThreadLocal* const tl = THREAD->jfr_thread_local();
assert(!tl->has_java_buffer(), "invariant");
JfrBuffer* const buffer = tl->java_buffer();
if (buffer == NULL) {
if (buffer == nullptr) {
JfrJavaSupport::throw_out_of_memory_error("OOME for thread local buffer", THREAD);
return NULL;
return nullptr;
}
jobject h_writer = create_new_event_writer(buffer, tl, CHECK_NULL);
tl->set_java_event_writer(h_writer);