8300241: Replace NULL with nullptr in share/classfile/

Reviewed-by: coleenp, iklam
This commit is contained in:
Johan Sjölen 2023-01-27 16:15:29 +00:00
parent f52d35c84b
commit 49ff52087b
63 changed files with 1834 additions and 1834 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -99,7 +99,7 @@ static SharedStringTable _shared_table;
// --------------------------------------------------------------------------
typedef ConcurrentHashTable<StringTableConfig, mtSymbol> StringTableHash;
static StringTableHash* _local_table = NULL;
static StringTableHash* _local_table = nullptr;
volatile bool StringTable::_has_work = false;
volatile bool StringTable::_needs_rehashing = false;
@ -124,7 +124,7 @@ class StringTableConfig : public StackObj {
static uintx get_hash(Value const& value, bool* is_dead) {
oop val_oop = value.peek();
if (val_oop == NULL) {
if (val_oop == nullptr) {
*is_dead = true;
return 0;
}
@ -133,7 +133,7 @@ class StringTableConfig : public StackObj {
// All String oops are hashed as unicode
int length;
jchar* chars = java_lang_String::as_unicode_string_or_null(val_oop, length);
if (chars != NULL) {
if (chars != nullptr) {
return hash_string(chars, length, _alt_hash);
}
vm_exit_out_of_memory(length, OOM_MALLOC_ERROR, "get hash from oop");
@ -168,7 +168,7 @@ class StringTableLookupJchar : StackObj {
}
bool equals(WeakHandle* value, bool* is_dead) {
oop val_oop = value->peek();
if (val_oop == NULL) {
if (val_oop == nullptr) {
// dead oop, mark this hash dead for cleaning
*is_dead = true;
return false;
@ -200,7 +200,7 @@ class StringTableLookupOop : public StackObj {
bool equals(WeakHandle* value, bool* is_dead) {
oop val_oop = value->peek();
if (val_oop == NULL) {
if (val_oop == nullptr) {
// dead oop, mark this hash dead for cleaning
*is_dead = true;
return false;
@ -262,7 +262,7 @@ oop StringTable::lookup(Symbol* symbol) {
oop StringTable::lookup(const jchar* name, int len) {
unsigned int hash = java_lang_String::hash_code(name, len);
oop string = lookup_shared(name, len, hash);
if (string != NULL) {
if (string != nullptr) {
return string;
}
if (_alt_hash) {
@ -278,7 +278,7 @@ class StringTableGet : public StackObj {
StringTableGet(Thread* thread) : _thread(thread) {}
void operator()(WeakHandle* val) {
oop result = val->resolve();
assert(result != NULL, "Result should be reachable");
assert(result != nullptr, "Result should be reachable");
_return = Handle(_thread, result);
}
oop get_res_oop() {
@ -298,7 +298,7 @@ oop StringTable::do_lookup(const jchar* name, int len, uintx hash) {
// Interning
oop StringTable::intern(Symbol* symbol, TRAPS) {
if (symbol == NULL) return NULL;
if (symbol == nullptr) return nullptr;
ResourceMark rm(THREAD);
int length;
jchar* chars = symbol->as_unicode(length);
@ -308,7 +308,7 @@ oop StringTable::intern(Symbol* symbol, TRAPS) {
}
oop StringTable::intern(oop string, TRAPS) {
if (string == NULL) return NULL;
if (string == nullptr) return nullptr;
ResourceMark rm(THREAD);
int length;
Handle h_string (THREAD, string);
@ -319,7 +319,7 @@ oop StringTable::intern(oop string, TRAPS) {
}
oop StringTable::intern(const char* utf8_string, TRAPS) {
if (utf8_string == NULL) return NULL;
if (utf8_string == nullptr) return nullptr;
ResourceMark rm(THREAD);
int length = UTF8::unicode_length(utf8_string);
jchar* chars = NEW_RESOURCE_ARRAY(jchar, length);
@ -333,14 +333,14 @@ oop StringTable::intern(Handle string_or_null_h, const jchar* name, int len, TRA
// shared table always uses java_lang_String::hash_code
unsigned int hash = java_lang_String::hash_code(name, len);
oop found_string = lookup_shared(name, len, hash);
if (found_string != NULL) {
if (found_string != nullptr) {
return found_string;
}
if (_alt_hash) {
hash = hash_string(name, len, true);
}
found_string = do_lookup(name, len, hash);
if (found_string != NULL) {
if (found_string != nullptr) {
return found_string;
}
return do_intern(string_or_null_h, name, len, hash, THREAD);
@ -424,7 +424,7 @@ struct StringTableDeleteCheck : StackObj {
bool operator()(WeakHandle* val) {
++_item;
oop tmp = val->peek();
if (tmp == NULL) {
if (tmp == nullptr) {
++_count;
return true;
} else {
@ -549,7 +549,7 @@ void StringTable::rehash_table() {
// Statistics
static size_t literal_size(oop obj) {
if (obj == NULL) {
if (obj == nullptr) {
return 0;
}
@ -566,7 +566,7 @@ static size_t literal_size(oop obj) {
struct SizeFunc : StackObj {
size_t operator()(WeakHandle* val) {
oop s = val->peek();
if (s == NULL) {
if (s == nullptr) {
// Dead
return 0;
}
@ -596,7 +596,7 @@ class VerifyStrings : StackObj {
public:
bool operator()(WeakHandle* val) {
oop s = val->peek();
if (s != NULL) {
if (s != nullptr) {
assert(java_lang_String::length(s) >= 0, "Length on string must work.");
}
return true;
@ -626,7 +626,7 @@ class VerifyCompStrings : StackObj {
VerifyCompStrings() : _table(unsigned(_items_count / 8) + 1), _errors(0) {}
bool operator()(WeakHandle* val) {
oop s = val->resolve();
if (s == NULL) {
if (s == nullptr) {
return true;
}
bool created;
@ -680,7 +680,7 @@ class PrintString : StackObj {
PrintString(Thread* thr, outputStream* st) : _thr(thr), _st(st) {}
bool operator()(WeakHandle* val) {
oop s = val->peek();
if (s == NULL) {
if (s == nullptr) {
return true;
}
print_string(_thr, _st, s);
@ -694,7 +694,7 @@ class PrintSharedString : StackObj {
public:
PrintSharedString(Thread* thr, outputStream* st) : _thr(thr), _st(st) {}
void do_value(oop s) {
if (s == NULL) {
if (s == nullptr) {
return;
}
print_string(_thr, _st, s);
@ -759,15 +759,15 @@ oop StringTable::create_archived_string(oop s) {
assert(java_lang_String::is_instance(s), "sanity");
assert(!HeapShared::is_archived_object_during_dumptime(s), "sanity");
oop new_s = NULL;
oop new_s = nullptr;
typeArrayOop v = java_lang_String::value_no_keepalive(s);
typeArrayOop new_v = (typeArrayOop)HeapShared::archive_object(v);
if (new_v == NULL) {
return NULL;
if (new_v == nullptr) {
return nullptr;
}
new_s = HeapShared::archive_object(s);
if (new_s == NULL) {
return NULL;
if (new_s == nullptr) {
return nullptr;
}
// adjust the pointer to the 'value' field in the new String oop
@ -794,10 +794,10 @@ private:
public:
CopyToArchive(CompactHashtableWriter* writer) : _writer(writer) {}
bool do_entry(oop s, bool value_ignored) {
assert(s != NULL, "sanity");
assert(s != nullptr, "sanity");
unsigned int hash = java_lang_String::hash_code(s);
oop new_s = StringTable::create_archived_string(s);
if (new_s == NULL) {
if (new_s == nullptr) {
return true;
}