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) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -35,7 +35,7 @@ PRAGMA_DIAG_PUSH
PRAGMA_FORMAT_NONLITERAL_IGNORED
void ClassFileParser::classfile_parse_error(const char* msg, TRAPS) const {
assert(_class_name != NULL, "invariant");
assert(_class_name != nullptr, "invariant");
ResourceMark rm(THREAD);
Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(),
msg, _class_name->as_C_string());
@ -44,7 +44,7 @@ void ClassFileParser::classfile_parse_error(const char* msg, TRAPS) const {
void ClassFileParser::classfile_parse_error(const char* msg,
int index,
TRAPS) const {
assert(_class_name != NULL, "invariant");
assert(_class_name != nullptr, "invariant");
ResourceMark rm(THREAD);
Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(),
msg, index, _class_name->as_C_string());
@ -53,7 +53,7 @@ void ClassFileParser::classfile_parse_error(const char* msg,
void ClassFileParser::classfile_parse_error(const char* msg,
const char* name,
TRAPS) const {
assert(_class_name != NULL, "invariant");
assert(_class_name != nullptr, "invariant");
ResourceMark rm(THREAD);
Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(),
msg, name, _class_name->as_C_string());
@ -63,7 +63,7 @@ void ClassFileParser::classfile_parse_error(const char* msg,
int index,
const char* name,
TRAPS) const {
assert(_class_name != NULL, "invariant");
assert(_class_name != nullptr, "invariant");
ResourceMark rm(THREAD);
Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(),
msg, index, name, _class_name->as_C_string());
@ -73,7 +73,7 @@ void ClassFileParser::classfile_parse_error(const char* msg,
const char* name,
const char* signature,
TRAPS) const {
assert(_class_name != NULL, "invariant");
assert(_class_name != nullptr, "invariant");
ResourceMark rm(THREAD);
Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(),
msg, name, signature, _class_name->as_C_string());
@ -82,7 +82,7 @@ void ClassFileParser::classfile_parse_error(const char* msg,
void ClassFileParser::classfile_icce_error(const char* msg,
const Klass* k,
TRAPS) const {
assert(_class_name != NULL, "invariant");
assert(_class_name != nullptr, "invariant");
ResourceMark rm(THREAD);
Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_IncompatibleClassChangeError(),
msg, _class_name->as_klass_external_name(), k->external_name());

File diff suppressed because it is too large Load Diff

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
@ -118,7 +118,7 @@ class ClassFileParser {
// Metadata created before the instance klass is created. Must be deallocated
// if not transferred to the InstanceKlass upon successful class loading
// in which case these pointers have been set to NULL.
// in which case these pointers have been set to null.
const InstanceKlass* _super_klass;
ConstantPool* _cp;
Array<u2>* _fields;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, 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
@ -45,7 +45,7 @@ ClassFileStream::ClassFileStream(const u1* buffer,
_source(source),
_need_verify(verify_stream),
_from_boot_loader_modules_image(from_boot_loader_modules_image) {
assert(buffer != NULL, "caller should throw NPE");
assert(buffer != nullptr, "caller should throw NPE");
}
const u1* ClassFileStream::clone_buffer() const {
@ -56,8 +56,8 @@ const u1* ClassFileStream::clone_buffer() const {
const char* const ClassFileStream::clone_source() const {
const char* const src = source();
char* source_copy = NULL;
if (src != NULL) {
char* source_copy = nullptr;
if (src != nullptr) {
size_t source_len = strlen(src);
source_copy = NEW_RESOURCE_ARRAY(char, source_len + 1);
strncpy(source_copy, src, source_len + 1);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021, 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
@ -38,7 +38,7 @@ class ClassInstanceInfo : public StackObj {
public:
ClassInstanceInfo() {
_dynamic_nest_host = NULL;
_dynamic_nest_host = nullptr;
_class_data = Handle();
}
ClassInstanceInfo(InstanceKlass* dynamic_nest_host, Handle class_data) {
@ -62,7 +62,7 @@ class ClassLoadInfo : public StackObj {
public:
ClassLoadInfo(Handle protection_domain) {
_protection_domain = protection_domain;
_class_hidden_info._dynamic_nest_host = NULL;
_class_hidden_info._dynamic_nest_host = nullptr;
_class_hidden_info._class_data = Handle();
_is_hidden = false;
_is_strong_hidden = false;

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
@ -82,7 +82,7 @@
typedef int (*canonicalize_fn_t)(const char *orig, char *out, int len);
static canonicalize_fn_t CanonicalizeEntry = NULL;
static canonicalize_fn_t CanonicalizeEntry = nullptr;
// Entry points in zip.dll for loading zip/jar file entries
@ -92,60 +92,60 @@ typedef jzentry* (*FindEntry_t)(jzfile *zip, const char *name, jint *sizeP, jint
typedef jboolean (*ReadEntry_t)(jzfile *zip, jzentry *entry, unsigned char *buf, char *namebuf);
typedef jint (*Crc32_t)(jint crc, const jbyte *buf, jint len);
static ZipOpen_t ZipOpen = NULL;
static ZipClose_t ZipClose = NULL;
static FindEntry_t FindEntry = NULL;
static ReadEntry_t ReadEntry = NULL;
static Crc32_t Crc32 = NULL;
static ZipOpen_t ZipOpen = nullptr;
static ZipClose_t ZipClose = nullptr;
static FindEntry_t FindEntry = nullptr;
static ReadEntry_t ReadEntry = nullptr;
static Crc32_t Crc32 = nullptr;
int ClassLoader::_libzip_loaded = 0;
void* ClassLoader::_zip_handle = NULL;
void* ClassLoader::_zip_handle = nullptr;
// Entry points for jimage.dll for loading jimage file entries
static JImageOpen_t JImageOpen = NULL;
static JImageClose_t JImageClose = NULL;
static JImageFindResource_t JImageFindResource = NULL;
static JImageGetResource_t JImageGetResource = NULL;
static JImageOpen_t JImageOpen = nullptr;
static JImageClose_t JImageClose = nullptr;
static JImageFindResource_t JImageFindResource = nullptr;
static JImageGetResource_t JImageGetResource = nullptr;
// JimageFile pointer, or null if exploded JDK build.
static JImageFile* JImage_file = NULL;
static JImageFile* JImage_file = nullptr;
// Globals
PerfCounter* ClassLoader::_perf_accumulated_time = NULL;
PerfCounter* ClassLoader::_perf_classes_inited = NULL;
PerfCounter* ClassLoader::_perf_class_init_time = NULL;
PerfCounter* ClassLoader::_perf_class_init_selftime = NULL;
PerfCounter* ClassLoader::_perf_classes_verified = NULL;
PerfCounter* ClassLoader::_perf_class_verify_time = NULL;
PerfCounter* ClassLoader::_perf_class_verify_selftime = NULL;
PerfCounter* ClassLoader::_perf_classes_linked = NULL;
PerfCounter* ClassLoader::_perf_class_link_time = NULL;
PerfCounter* ClassLoader::_perf_class_link_selftime = NULL;
PerfCounter* ClassLoader::_perf_sys_class_lookup_time = NULL;
PerfCounter* ClassLoader::_perf_shared_classload_time = NULL;
PerfCounter* ClassLoader::_perf_sys_classload_time = NULL;
PerfCounter* ClassLoader::_perf_app_classload_time = NULL;
PerfCounter* ClassLoader::_perf_app_classload_selftime = NULL;
PerfCounter* ClassLoader::_perf_app_classload_count = NULL;
PerfCounter* ClassLoader::_perf_define_appclasses = NULL;
PerfCounter* ClassLoader::_perf_define_appclass_time = NULL;
PerfCounter* ClassLoader::_perf_define_appclass_selftime = NULL;
PerfCounter* ClassLoader::_perf_app_classfile_bytes_read = NULL;
PerfCounter* ClassLoader::_perf_sys_classfile_bytes_read = NULL;
PerfCounter* ClassLoader::_unsafe_defineClassCallCounter = NULL;
PerfCounter* ClassLoader::_perf_accumulated_time = nullptr;
PerfCounter* ClassLoader::_perf_classes_inited = nullptr;
PerfCounter* ClassLoader::_perf_class_init_time = nullptr;
PerfCounter* ClassLoader::_perf_class_init_selftime = nullptr;
PerfCounter* ClassLoader::_perf_classes_verified = nullptr;
PerfCounter* ClassLoader::_perf_class_verify_time = nullptr;
PerfCounter* ClassLoader::_perf_class_verify_selftime = nullptr;
PerfCounter* ClassLoader::_perf_classes_linked = nullptr;
PerfCounter* ClassLoader::_perf_class_link_time = nullptr;
PerfCounter* ClassLoader::_perf_class_link_selftime = nullptr;
PerfCounter* ClassLoader::_perf_sys_class_lookup_time = nullptr;
PerfCounter* ClassLoader::_perf_shared_classload_time = nullptr;
PerfCounter* ClassLoader::_perf_sys_classload_time = nullptr;
PerfCounter* ClassLoader::_perf_app_classload_time = nullptr;
PerfCounter* ClassLoader::_perf_app_classload_selftime = nullptr;
PerfCounter* ClassLoader::_perf_app_classload_count = nullptr;
PerfCounter* ClassLoader::_perf_define_appclasses = nullptr;
PerfCounter* ClassLoader::_perf_define_appclass_time = nullptr;
PerfCounter* ClassLoader::_perf_define_appclass_selftime = nullptr;
PerfCounter* ClassLoader::_perf_app_classfile_bytes_read = nullptr;
PerfCounter* ClassLoader::_perf_sys_classfile_bytes_read = nullptr;
PerfCounter* ClassLoader::_unsafe_defineClassCallCounter = nullptr;
GrowableArray<ModuleClassPathList*>* ClassLoader::_patch_mod_entries = NULL;
GrowableArray<ModuleClassPathList*>* ClassLoader::_exploded_entries = NULL;
ClassPathEntry* ClassLoader::_jrt_entry = NULL;
GrowableArray<ModuleClassPathList*>* ClassLoader::_patch_mod_entries = nullptr;
GrowableArray<ModuleClassPathList*>* ClassLoader::_exploded_entries = nullptr;
ClassPathEntry* ClassLoader::_jrt_entry = nullptr;
ClassPathEntry* volatile ClassLoader::_first_append_entry_list = NULL;
ClassPathEntry* volatile ClassLoader::_last_append_entry = NULL;
ClassPathEntry* volatile ClassLoader::_first_append_entry_list = nullptr;
ClassPathEntry* volatile ClassLoader::_last_append_entry = nullptr;
#if INCLUDE_CDS
ClassPathEntry* ClassLoader::_app_classpath_entries = NULL;
ClassPathEntry* ClassLoader::_last_app_classpath_entry = NULL;
ClassPathEntry* ClassLoader::_module_path_entries = NULL;
ClassPathEntry* ClassLoader::_last_module_path_entry = NULL;
ClassPathEntry* ClassLoader::_app_classpath_entries = nullptr;
ClassPathEntry* ClassLoader::_last_app_classpath_entry = nullptr;
ClassPathEntry* ClassLoader::_module_path_entries = nullptr;
ClassPathEntry* ClassLoader::_last_module_path_entry = nullptr;
#endif
// helper routines
@ -178,19 +178,19 @@ bool ClassLoader::string_ends_with(const char* str, const char* str_to_find) {
// Used to obtain the package name from a fully qualified class name.
Symbol* ClassLoader::package_from_class_name(const Symbol* name, bool* bad_class_name) {
if (name == NULL) {
if (bad_class_name != NULL) {
if (name == nullptr) {
if (bad_class_name != nullptr) {
*bad_class_name = true;
}
return NULL;
return nullptr;
}
int utf_len = name->utf8_length();
const jbyte* base = (const jbyte*)name->base();
const jbyte* start = base;
const jbyte* end = UTF8::strrchr(start, utf_len, JVM_SIGNATURE_SLASH);
if (end == NULL) {
return NULL;
if (end == nullptr) {
return nullptr;
}
// Skip over '['s
if (*start == JVM_SIGNATURE_ARRAY) {
@ -203,20 +203,20 @@ Symbol* ClassLoader::package_from_class_name(const Symbol* name, bool* bad_class
// could not be obtained due to an error condition.
// In this situation, is_same_class_package returns false.
if (*start == JVM_SIGNATURE_CLASS) {
if (bad_class_name != NULL) {
if (bad_class_name != nullptr) {
*bad_class_name = true;
}
return NULL;
return nullptr;
}
}
// A class name could have just the slash character in the name,
// in which case start > end
if (start >= end) {
// No package name
if (bad_class_name != NULL) {
if (bad_class_name != nullptr) {
*bad_class_name = true;
}
return NULL;
return nullptr;
}
return SymbolTable::new_symbol(name, start - base, end - base);
}
@ -224,8 +224,8 @@ Symbol* ClassLoader::package_from_class_name(const Symbol* name, bool* bad_class
// Given a fully qualified package name, find its defining package in the class loader's
// package entry table.
PackageEntry* ClassLoader::get_package_entry(Symbol* pkg_name, ClassLoaderData* loader_data) {
if (pkg_name == NULL) {
return NULL;
if (pkg_name == nullptr) {
return nullptr;
}
PackageEntryTable* pkgEntryTable = loader_data->packages();
return pkgEntryTable->lookup_only(pkg_name);
@ -243,7 +243,7 @@ ClassPathDirEntry::~ClassPathDirEntry() {
ClassFileStream* ClassPathDirEntry::open_stream(JavaThread* current, const char* name) {
// construct full path name
assert((_dir != NULL) && (name != NULL), "sanity");
assert((_dir != nullptr) && (name != nullptr), "sanity");
size_t path_len = strlen(_dir) + strlen(name) + strlen(os::file_separator()) + 1;
char* path = NEW_RESOURCE_ARRAY_IN_THREAD(current, char, path_len);
int len = jio_snprintf(path, path_len, "%s%s%s", _dir, os::file_separator(), name);
@ -278,7 +278,7 @@ ClassFileStream* ClassPathDirEntry::open_stream(JavaThread* current, const char*
}
}
FREE_RESOURCE_ARRAY_IN_THREAD(current, char, path, path_len);
return NULL;
return nullptr;
}
ClassPathZipEntry::ClassPathZipEntry(jzfile* zip, const char* zip_name,
@ -299,7 +299,7 @@ u1* ClassPathZipEntry::open_entry(JavaThread* current, const char* name, jint* f
// check whether zip archive contains name
jint name_len;
jzentry* entry = (*FindEntry)(_zip, name, filesize, &name_len);
if (entry == NULL) return NULL;
if (entry == nullptr) return nullptr;
u1* buffer;
char name_buf[128];
char* filename;
@ -313,12 +313,12 @@ u1* ClassPathZipEntry::open_entry(JavaThread* current, const char* name, jint* f
size_t size = (uint32_t)(*filesize);
if (nul_terminate) {
if (sizeof(size) == sizeof(uint32_t) && size == UINT_MAX) {
return NULL; // 32-bit integer overflow will occur.
return nullptr; // 32-bit integer overflow will occur.
}
size++;
}
buffer = NEW_RESOURCE_ARRAY(u1, size);
if (!(*ReadEntry)(_zip, entry, buffer, filename)) return NULL;
if (!(*ReadEntry)(_zip, entry, buffer, filename)) return nullptr;
// return result
if (nul_terminate) {
@ -330,8 +330,8 @@ u1* ClassPathZipEntry::open_entry(JavaThread* current, const char* name, jint* f
ClassFileStream* ClassPathZipEntry::open_stream(JavaThread* current, const char* name) {
jint filesize;
u1* buffer = open_entry(current, name, &filesize, false);
if (buffer == NULL) {
return NULL;
if (buffer == nullptr) {
return nullptr;
}
if (UsePerfData) {
ClassLoader::perf_sys_classfile_bytes_read()->inc(filesize);
@ -343,7 +343,7 @@ ClassFileStream* ClassPathZipEntry::open_stream(JavaThread* current, const char*
ClassFileStream::verify);
}
DEBUG_ONLY(ClassPathImageEntry* ClassPathImageEntry::_singleton = NULL;)
DEBUG_ONLY(ClassPathImageEntry* ClassPathImageEntry::_singleton = nullptr;)
JImageFile* ClassPathImageEntry::jimage() const {
return JImage_file;
@ -351,23 +351,23 @@ JImageFile* ClassPathImageEntry::jimage() const {
JImageFile* ClassPathImageEntry::jimage_non_null() const {
assert(ClassLoader::has_jrt_entry(), "must be");
assert(jimage() != NULL, "should have been opened by ClassLoader::lookup_vm_options "
assert(jimage() != nullptr, "should have been opened by ClassLoader::lookup_vm_options "
"and remained throughout normal JVM lifetime");
return jimage();
}
void ClassPathImageEntry::close_jimage() {
if (jimage() != NULL) {
if (jimage() != nullptr) {
(*JImageClose)(jimage());
JImage_file = NULL;
JImage_file = nullptr;
}
}
ClassPathImageEntry::ClassPathImageEntry(JImageFile* jimage, const char* name) :
ClassPathEntry() {
guarantee(jimage != NULL, "jimage file is null");
guarantee(name != NULL, "jimage file name is null");
assert(_singleton == NULL, "VM supports only one jimage");
guarantee(jimage != nullptr, "jimage file is null");
guarantee(name != nullptr, "jimage file name is null");
assert(_singleton == nullptr, "VM supports only one jimage");
DEBUG_ONLY(_singleton = this);
size_t len = strlen(name) + 1;
_name = copy_path(name);
@ -392,19 +392,19 @@ ClassFileStream* ClassPathImageEntry::open_stream_for_loader(JavaThread* current
TempNewSymbol class_name = SymbolTable::new_symbol(name);
TempNewSymbol pkg_name = ClassLoader::package_from_class_name(class_name);
if (pkg_name != NULL) {
if (pkg_name != nullptr) {
if (!Universe::is_module_initialized()) {
location = (*JImageFindResource)(jimage_non_null(), JAVA_BASE_NAME, get_jimage_version_string(), name, &size);
} else {
PackageEntry* package_entry = ClassLoader::get_package_entry(pkg_name, loader_data);
if (package_entry != NULL) {
if (package_entry != nullptr) {
ResourceMark rm(current);
// Get the module name
ModuleEntry* module = package_entry->module();
assert(module != NULL, "Boot classLoader package missing module");
assert(module != nullptr, "Boot classLoader package missing module");
assert(module->is_named(), "Boot classLoader package is in unnamed module");
const char* module_name = module->name()->as_C_string();
if (module_name != NULL) {
if (module_name != nullptr) {
location = (*JImageFindResource)(jimage_non_null(), module_name, get_jimage_version_string(), name, &size);
}
}
@ -426,7 +426,7 @@ ClassFileStream* ClassPathImageEntry::open_stream_for_loader(JavaThread* current
true); // from_boot_loader_modules_image
}
return NULL;
return nullptr;
}
JImageLocationRef ClassLoader::jimage_find_resource(JImageFile* jf,
@ -452,14 +452,14 @@ void ClassLoader::exit_with_path_failure(const char* error, const char* message)
ModuleClassPathList::ModuleClassPathList(Symbol* module_name) {
_module_name = module_name;
_module_first_entry = NULL;
_module_last_entry = NULL;
_module_first_entry = nullptr;
_module_last_entry = nullptr;
}
ModuleClassPathList::~ModuleClassPathList() {
// Clean out each ClassPathEntry on list
ClassPathEntry* e = _module_first_entry;
while (e != NULL) {
while (e != nullptr) {
ClassPathEntry* next_entry = e->next();
delete e;
e = next_entry;
@ -467,8 +467,8 @@ ModuleClassPathList::~ModuleClassPathList() {
}
void ModuleClassPathList::add_to_list(ClassPathEntry* new_entry) {
if (new_entry != NULL) {
if (_module_last_entry == NULL) {
if (new_entry != nullptr) {
if (_module_last_entry == nullptr) {
_module_first_entry = _module_last_entry = new_entry;
} else {
_module_last_entry->set_next(new_entry);
@ -502,7 +502,7 @@ void ClassLoader::trace_class_path(const char* msg, const char* name) {
void ClassLoader::setup_bootstrap_search_path(JavaThread* current) {
const char* bootcp = Arguments::get_boot_class_path();
assert(bootcp != NULL, "Boot class path must not be NULL");
assert(bootcp != nullptr, "Boot class path must not be nullptr");
if (PrintSharedArchiveAndExit) {
// Don't print bootcp - this is the bootcp of this current VM process, not necessarily
// the same as the boot classpath of the shared archive.
@ -527,12 +527,12 @@ void ClassLoader::setup_app_search_path(JavaThread* current, const char *class_p
void ClassLoader::add_to_module_path_entries(const char* path,
ClassPathEntry* entry) {
assert(entry != NULL, "ClassPathEntry should not be NULL");
assert(entry != nullptr, "ClassPathEntry should not be nullptr");
Arguments::assert_is_dumping_archive();
// The entry does not exist, add to the list
if (_module_path_entries == NULL) {
assert(_last_module_path_entry == NULL, "Sanity");
if (_module_path_entries == nullptr) {
assert(_last_module_path_entry == nullptr, "Sanity");
_module_path_entries = _last_module_path_entry = entry;
} else {
_last_module_path_entry->set_next(entry);
@ -550,10 +550,10 @@ void ClassLoader::setup_module_search_path(JavaThread* current, const char* path
vm_exit_during_initialization();
}
// File or directory found
ClassPathEntry* new_entry = NULL;
ClassPathEntry* new_entry = nullptr;
new_entry = create_class_path_entry(current, path, &st,
false /*is_boot_append */, false /* from_class_path_attr */);
if (new_entry != NULL) {
if (new_entry != nullptr) {
add_to_module_path_entries(path, new_entry);
}
}
@ -580,7 +580,7 @@ void ClassLoader::setup_patch_mod_entries() {
for (int i = 0; i < num_of_entries; i++) {
const char* module_name = (patch_mod_args->at(i))->module_name();
Symbol* const module_sym = SymbolTable::new_symbol(module_name);
assert(module_sym != NULL, "Failed to obtain Symbol for module name");
assert(module_sym != nullptr, "Failed to obtain Symbol for module name");
ModuleClassPathList* module_cpl = new ModuleClassPathList(module_sym);
char* class_path = (patch_mod_args->at(i))->path_string();
@ -594,7 +594,7 @@ void ClassLoader::setup_patch_mod_entries() {
// File or directory found
ClassPathEntry* new_entry = create_class_path_entry(current, path, &st, false, false);
// If the path specification is valid, enter it into this module's list
if (new_entry != NULL) {
if (new_entry != nullptr) {
module_cpl->add_to_list(new_entry);
}
}
@ -602,7 +602,7 @@ void ClassLoader::setup_patch_mod_entries() {
// Record the module into the list of --patch-module entries only if
// valid ClassPathEntrys have been created
if (module_cpl->module_first_entry() != NULL) {
if (module_cpl->module_first_entry() != nullptr) {
_patch_mod_entries->push(module_cpl);
}
}
@ -611,7 +611,7 @@ void ClassLoader::setup_patch_mod_entries() {
// Determine whether the module has been patched via the command-line
// option --patch-module
bool ClassLoader::is_in_patch_mod_entries(Symbol* module_name) {
if (_patch_mod_entries != NULL && _patch_mod_entries->is_nonempty()) {
if (_patch_mod_entries != nullptr && _patch_mod_entries->is_nonempty()) {
int table_len = _patch_mod_entries->length();
for (int i = 0; i < table_len; i++) {
ModuleClassPathList* patch_mod = _patch_mod_entries->at(i);
@ -632,7 +632,7 @@ void ClassLoader::setup_bootstrap_search_path_impl(JavaThread* current, const ch
#if INCLUDE_CDS
if (Arguments::is_dumping_archive()) {
if (!Arguments::has_jimage()) {
vm_exit_during_initialization("CDS is not supported in exploded JDK build", NULL);
vm_exit_during_initialization("CDS is not supported in exploded JDK build", nullptr);
}
}
#endif
@ -649,14 +649,14 @@ void ClassLoader::setup_bootstrap_search_path_impl(JavaThread* current, const ch
struct stat st;
if (os::stat(path, &st) == 0) {
// Directory found
if (JImage_file != NULL) {
if (JImage_file != nullptr) {
assert(Arguments::has_jimage(), "sanity check");
const char* canonical_path = get_canonical_path(path, current);
assert(canonical_path != NULL, "canonical_path issue");
assert(canonical_path != nullptr, "canonical_path issue");
_jrt_entry = new ClassPathImageEntry(JImage_file, canonical_path);
assert(_jrt_entry != NULL && _jrt_entry->is_modules_image(), "No java runtime image present");
assert(_jrt_entry->jimage() != NULL, "No java runtime image");
assert(_jrt_entry != nullptr && _jrt_entry->is_modules_image(), "No java runtime image present");
assert(_jrt_entry->jimage() != nullptr, "No java runtime image");
} // else it's an exploded build.
} else {
// If path does not exist, exit
@ -687,7 +687,7 @@ static const char* get_exploded_module_path(const char* module_name, bool c_heap
// will be added to the ClassLoader::_exploded_entries array.
void ClassLoader::add_to_exploded_build_list(JavaThread* current, Symbol* module_sym) {
assert(!ClassLoader::has_jrt_entry(), "Exploded build not applicable");
assert(_exploded_entries != NULL, "_exploded_entries was not initialized");
assert(_exploded_entries != nullptr, "_exploded_entries was not initialized");
// Find the module's symbol
ResourceMark rm(current);
@ -703,7 +703,7 @@ void ClassLoader::add_to_exploded_build_list(JavaThread* current, Symbol* module
// There is no need to check for duplicate modules in the exploded entry list,
// since no two modules with the same name can be defined to the boot loader.
// This is checked at module definition time in Modules::define_module.
if (new_entry != NULL) {
if (new_entry != nullptr) {
ModuleClassPathList* module_cpl = new ModuleClassPathList(module_sym);
module_cpl->add_to_list(new_entry);
{
@ -727,24 +727,24 @@ ClassPathEntry* ClassLoader::create_class_path_entry(JavaThread* current,
const char *path, const struct stat* st,
bool is_boot_append,
bool from_class_path_attr) {
ClassPathEntry* new_entry = NULL;
ClassPathEntry* new_entry = nullptr;
if ((st->st_mode & S_IFMT) == S_IFREG) {
ResourceMark rm(current);
// Regular file, should be a zip file
// Canonicalized filename
const char* canonical_path = get_canonical_path(path, current);
if (canonical_path == NULL) {
return NULL;
if (canonical_path == nullptr) {
return nullptr;
}
char* error_msg = NULL;
char* error_msg = nullptr;
jzfile* zip = open_zip_file(canonical_path, &error_msg, current);
if (zip != NULL && error_msg == NULL) {
if (zip != nullptr && error_msg == nullptr) {
new_entry = new ClassPathZipEntry(zip, path, is_boot_append, from_class_path_attr);
} else {
#if INCLUDE_CDS
ClassLoaderExt::set_has_non_jar_in_classpath();
#endif
return NULL;
return nullptr;
}
log_info(class, path)("opened: %s", path);
log_info(class, load)("opened: %s", path);
@ -757,7 +757,7 @@ ClassPathEntry* ClassLoader::create_class_path_entry(JavaThread* current,
}
// Create a class path zip entry for a given path (return NULL if not found
// Create a class path zip entry for a given path (return null if not found
// or zip/JAR file cannot be opened)
ClassPathZipEntry* ClassLoader::create_class_path_zip_entry(const char *path, bool is_boot_append) {
// check for a regular file
@ -767,26 +767,26 @@ ClassPathZipEntry* ClassLoader::create_class_path_zip_entry(const char *path, bo
JavaThread* thread = JavaThread::current();
ResourceMark rm(thread);
const char* canonical_path = get_canonical_path(path, thread);
if (canonical_path != NULL) {
char* error_msg = NULL;
if (canonical_path != nullptr) {
char* error_msg = nullptr;
jzfile* zip = open_zip_file(canonical_path, &error_msg, thread);
if (zip != NULL && error_msg == NULL) {
if (zip != nullptr && error_msg == nullptr) {
// create using canonical path
return new ClassPathZipEntry(zip, canonical_path, is_boot_append, false);
}
}
}
}
return NULL;
return nullptr;
}
// The boot append entries are added with a lock, and read lock free.
void ClassLoader::add_to_boot_append_entries(ClassPathEntry *new_entry) {
if (new_entry != NULL) {
if (new_entry != nullptr) {
MutexLocker ml(Bootclasspath_lock, Mutex::_no_safepoint_check_flag);
if (_last_append_entry == NULL) {
if (_last_append_entry == nullptr) {
_last_append_entry = new_entry;
assert(first_append_entry() == NULL, "boot loader's append class path entry list not empty");
assert(first_append_entry() == nullptr, "boot loader's append class path entry list not empty");
Atomic::release_store(&_first_append_entry_list, new_entry);
} else {
_last_append_entry->set_next(new_entry);
@ -806,10 +806,10 @@ void ClassLoader::add_to_app_classpath_entries(JavaThread* current,
ClassPathEntry* entry,
bool check_for_duplicates) {
#if INCLUDE_CDS
assert(entry != NULL, "ClassPathEntry should not be NULL");
assert(entry != nullptr, "ClassPathEntry should not be nullptr");
ClassPathEntry* e = _app_classpath_entries;
if (check_for_duplicates) {
while (e != NULL) {
while (e != nullptr) {
if (strcmp(e->name(), entry->name()) == 0) {
// entry already exists
return;
@ -819,8 +819,8 @@ void ClassLoader::add_to_app_classpath_entries(JavaThread* current,
}
// The entry does not exist, add to the list
if (_app_classpath_entries == NULL) {
assert(_last_app_classpath_entry == NULL, "Sanity");
if (_app_classpath_entries == nullptr) {
assert(_last_app_classpath_entry == nullptr, "Sanity");
_app_classpath_entries = _last_app_classpath_entry = entry;
} else {
_last_app_classpath_entry->set_next(entry);
@ -842,9 +842,9 @@ bool ClassLoader::update_class_path_entry_list(JavaThread* current,
struct stat st;
if (os::stat(path, &st) == 0) {
// File or directory found
ClassPathEntry* new_entry = NULL;
ClassPathEntry* new_entry = nullptr;
new_entry = create_class_path_entry(current, path, &st, is_boot_append, from_class_path_attr);
if (new_entry == NULL) {
if (new_entry == nullptr) {
return false;
}
@ -869,10 +869,10 @@ static void print_module_entry_table(const GrowableArray<ModuleClassPathList*>*
ModuleClassPathList* mpl = module_list->at(i);
tty->print("%s=", mpl->module_name()->as_C_string());
e = mpl->module_first_entry();
while (e != NULL) {
while (e != nullptr) {
tty->print("%s", e->name());
e = e->next();
if (e != NULL) {
if (e != nullptr) {
tty->print("%s", os::path_separator());
}
}
@ -885,7 +885,7 @@ void ClassLoader::print_bootclasspath() {
tty->print("[bootclasspath= ");
// Print --patch-module module/path specifications first
if (_patch_mod_entries != NULL) {
if (_patch_mod_entries != nullptr) {
print_module_entry_table(_patch_mod_entries);
}
@ -895,14 +895,14 @@ void ClassLoader::print_bootclasspath() {
tty->print("%s ;", _jrt_entry->name());
} else {
// Print exploded module build path specifications
if (_exploded_entries != NULL) {
if (_exploded_entries != nullptr) {
print_module_entry_table(_exploded_entries);
}
}
// appended entries
e = first_append_entry();
while (e != NULL) {
while (e != nullptr) {
tty->print("%s ;", e->name());
e = e->next();
}
@ -911,7 +911,7 @@ void ClassLoader::print_bootclasspath() {
void* ClassLoader::dll_lookup(void* lib, const char* name, const char* path) {
void* func = os::dll_lookup(lib, name);
if (func == NULL) {
if (func == nullptr) {
char msg[256] = "";
jio_snprintf(msg, sizeof(msg), "Could not resolve \"%s\"", name);
vm_exit_during_initialization(msg, path);
@ -920,13 +920,13 @@ void* ClassLoader::dll_lookup(void* lib, const char* name, const char* path) {
}
void ClassLoader::load_java_library() {
assert(CanonicalizeEntry == NULL, "should not load java library twice");
assert(CanonicalizeEntry == nullptr, "should not load java library twice");
void *javalib_handle = os::native_java_library();
if (javalib_handle == NULL) {
vm_exit_during_initialization("Unable to load java library", NULL);
if (javalib_handle == nullptr) {
vm_exit_during_initialization("Unable to load java library", nullptr);
}
CanonicalizeEntry = CAST_TO_FN_PTR(canonicalize_fn_t, dll_lookup(javalib_handle, "JDK_Canonicalize", NULL));
CanonicalizeEntry = CAST_TO_FN_PTR(canonicalize_fn_t, dll_lookup(javalib_handle, "JDK_Canonicalize", nullptr));
}
void ClassLoader::release_load_zip_library() {
@ -938,13 +938,13 @@ void ClassLoader::release_load_zip_library() {
}
void ClassLoader::load_zip_library() {
assert(ZipOpen == NULL, "should not load zip library twice");
assert(ZipOpen == nullptr, "should not load zip library twice");
char path[JVM_MAXPATHLEN];
char ebuf[1024];
if (os::dll_locate_lib(path, sizeof(path), Arguments::get_dll_dir(), "zip")) {
_zip_handle = os::dll_load(path, ebuf, sizeof ebuf);
}
if (_zip_handle == NULL) {
if (_zip_handle == nullptr) {
vm_exit_during_initialization("Unable to load zip library", path);
}
@ -956,14 +956,14 @@ void ClassLoader::load_zip_library() {
}
void ClassLoader::load_jimage_library() {
assert(JImageOpen == NULL, "should not load jimage library twice");
assert(JImageOpen == nullptr, "should not load jimage library twice");
char path[JVM_MAXPATHLEN];
char ebuf[1024];
void* handle = NULL;
void* handle = nullptr;
if (os::dll_locate_lib(path, sizeof(path), Arguments::get_dll_dir(), "jimage")) {
handle = os::dll_load(path, ebuf, sizeof ebuf);
}
if (handle == NULL) {
if (handle == nullptr) {
vm_exit_during_initialization("Unable to load jimage library", path);
}
@ -980,17 +980,17 @@ int ClassLoader::crc32(int crc, const char* buf, int len) {
oop ClassLoader::get_system_package(const char* name, TRAPS) {
// Look up the name in the boot loader's package entry table.
if (name != NULL) {
if (name != nullptr) {
TempNewSymbol package_sym = SymbolTable::new_symbol(name);
// Look for the package entry in the boot loader's package entry table.
PackageEntry* package =
ClassLoaderData::the_null_class_loader_data()->packages()->lookup_only(package_sym);
// Return NULL if package does not exist or if no classes in that package
// Return null if package does not exist or if no classes in that package
// have been loaded.
if (package != NULL && package->has_loaded_class()) {
if (package != nullptr && package->has_loaded_class()) {
ModuleEntry* module = package->module();
if (module->location() != NULL) {
if (module->location() != nullptr) {
ResourceMark rm(THREAD);
Handle ml = java_lang_String::create_from_str(
module->location()->as_C_string(), THREAD);
@ -1002,7 +1002,7 @@ oop ClassLoader::get_system_package(const char* name, TRAPS) {
return cph();
}
}
return NULL;
return nullptr;
}
objArrayOop ClassLoader::get_system_packages(TRAPS) {
@ -1027,7 +1027,7 @@ objArrayOop ClassLoader::get_system_packages(TRAPS) {
// caller needs ResourceMark
const char* ClassLoader::file_name_for_class_name(const char* class_name,
int class_name_len) {
assert(class_name != NULL, "invariant");
assert(class_name != nullptr, "invariant");
assert((int)strlen(class_name) == class_name_len, "invariant");
static const char class_suffix[] = ".class";
@ -1035,7 +1035,7 @@ const char* ClassLoader::file_name_for_class_name(const char* class_name,
char* const file_name = NEW_RESOURCE_ARRAY(char,
class_name_len +
class_suffix_len); // includes term NULL
class_suffix_len); // includes term null
strncpy(file_name, class_name, class_name_len);
strncpy(&file_name[class_name_len], class_suffix, class_suffix_len);
@ -1058,7 +1058,7 @@ ClassPathEntry* find_first_module_cpe(ModuleEntry* mod_entry,
return module_cpl->module_first_entry();
}
}
return NULL;
return nullptr;
}
@ -1067,13 +1067,13 @@ ClassFileStream* ClassLoader::search_module_entries(JavaThread* current,
const GrowableArray<ModuleClassPathList*>* const module_list,
const char* const class_name,
const char* const file_name) {
ClassFileStream* stream = NULL;
ClassFileStream* stream = nullptr;
// Find the class' defining module in the boot loader's module entry table
TempNewSymbol class_name_symbol = SymbolTable::new_symbol(class_name);
TempNewSymbol pkg_name = package_from_class_name(class_name_symbol);
PackageEntry* pkg_entry = get_package_entry(pkg_name, ClassLoaderData::the_null_class_loader_data());
ModuleEntry* mod_entry = (pkg_entry != NULL) ? pkg_entry->module() : NULL;
ModuleEntry* mod_entry = (pkg_entry != nullptr) ? pkg_entry->module() : nullptr;
// If the module system has not defined java.base yet, then
// classes loaded are assumed to be defined to java.base.
@ -1082,13 +1082,13 @@ ClassFileStream* ClassLoader::search_module_entries(JavaThread* current,
// are verified in ModuleEntryTable::verify_javabase_packages().
if (!Universe::is_module_initialized() &&
!ModuleEntryTable::javabase_defined() &&
mod_entry == NULL) {
mod_entry == nullptr) {
mod_entry = ModuleEntryTable::javabase_moduleEntry();
}
// The module must be a named module
ClassPathEntry* e = NULL;
if (mod_entry != NULL && mod_entry->is_named()) {
ClassPathEntry* e = nullptr;
if (mod_entry != nullptr && mod_entry->is_named()) {
if (module_list == _exploded_entries) {
// The exploded build entries can be added to at any time so a lock is
// needed when searching them.
@ -1101,11 +1101,11 @@ ClassFileStream* ClassLoader::search_module_entries(JavaThread* current,
}
// Try to load the class from the module's ClassPathEntry list.
while (e != NULL) {
while (e != nullptr) {
stream = e->open_stream(current, file_name);
// No context.check is required since CDS is not supported
// for an exploded modules build or if --patch-module is specified.
if (NULL != stream) {
if (nullptr != stream) {
return stream;
}
e = e->next();
@ -1113,12 +1113,12 @@ ClassFileStream* ClassLoader::search_module_entries(JavaThread* current,
// If the module was located, break out even if the class was not
// located successfully from that module's ClassPathEntry list.
// There will not be another valid entry for that module.
return NULL;
return nullptr;
}
// Called by the boot classloader to load classes
InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TRAPS) {
assert(name != NULL, "invariant");
assert(name != nullptr, "invariant");
ResourceMark rm(THREAD);
HandleMark hm(THREAD);
@ -1129,12 +1129,12 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TR
const char* const file_name = file_name_for_class_name(class_name,
name->utf8_length());
assert(file_name != NULL, "invariant");
assert(file_name != nullptr, "invariant");
// Lookup stream for parsing .class file
ClassFileStream* stream = NULL;
ClassFileStream* stream = nullptr;
s2 classpath_index = 0;
ClassPathEntry* e = NULL;
ClassPathEntry* e = nullptr;
// If search_append_only is true, boot loader visibility boundaries are
// set to be _first_append_entry to the end. This includes:
@ -1153,7 +1153,7 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TR
// found within its module specification, the search should continue to Load Attempt #2.
// Note: The --patch-module entries are never searched if the boot loader's
// visibility boundary is limited to only searching the append entries.
if (_patch_mod_entries != NULL && !search_append_only) {
if (_patch_mod_entries != nullptr && !search_append_only) {
// At CDS dump time, the --patch-module entries are ignored. That means a
// class is still loaded from the runtime image even if it might
// appear in the _patch_mod_entries. The runtime shared class visibility
@ -1169,19 +1169,19 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TR
}
// Load Attempt #2: [jimage | exploded build]
if (!search_append_only && (NULL == stream)) {
if (!search_append_only && (nullptr == stream)) {
if (has_jrt_entry()) {
e = _jrt_entry;
stream = _jrt_entry->open_stream(THREAD, file_name);
} else {
// Exploded build - attempt to locate class in its defining module's location.
assert(_exploded_entries != NULL, "No exploded build entries present");
assert(_exploded_entries != nullptr, "No exploded build entries present");
stream = search_module_entries(THREAD, _exploded_entries, class_name, file_name);
}
}
// Load Attempt #3: [-Xbootclasspath/a]; [jvmti appended entries]
if (search_append_only && (NULL == stream)) {
if (search_append_only && (nullptr == stream)) {
// For the boot loader append path search, the starting classpath_index
// for the appended piece is always 1 to account for either the
// _jrt_entry or the _exploded_entries.
@ -1189,9 +1189,9 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TR
classpath_index = 1;
e = first_append_entry();
while (e != NULL) {
while (e != nullptr) {
stream = e->open_stream(THREAD, file_name);
if (NULL != stream) {
if (nullptr != stream) {
break;
}
e = e->next();
@ -1199,8 +1199,8 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TR
}
}
if (NULL == stream) {
return NULL;
if (nullptr == stream) {
return nullptr;
}
stream->set_verify(ClassLoaderExt::should_verify(classpath_index));
@ -1243,7 +1243,7 @@ char* ClassLoader::skip_uri_protocol(char* source) {
void ClassLoader::record_result(JavaThread* current, InstanceKlass* ik,
const ClassFileStream* stream, bool redefined) {
Arguments::assert_is_dumping_archive();
assert(stream != NULL, "sanity");
assert(stream != nullptr, "sanity");
if (ik->is_hidden()) {
// We do not archive hidden classes.
@ -1252,8 +1252,8 @@ void ClassLoader::record_result(JavaThread* current, InstanceKlass* ik,
oop loader = ik->class_loader();
char* src = (char*)stream->source();
if (src == NULL) {
if (loader == NULL) {
if (src == nullptr) {
if (loader == nullptr) {
// JFR classes
ik->set_shared_classpath_index(0);
ik->set_shared_class_loader_type(ClassLoader::BOOT_LOADER);
@ -1272,22 +1272,22 @@ void ClassLoader::record_result(JavaThread* current, InstanceKlass* ik,
// if no protocol prefix is found, path is the same as stream->source(). This path
// must be valid since the class has been successfully parsed.
char* path = skip_uri_protocol(src);
assert(path != NULL, "sanity");
assert(path != nullptr, "sanity");
for (int i = 0; i < FileMapInfo::get_number_of_shared_paths(); i++) {
SharedClassPathEntry* ent = FileMapInfo::shared_path(i);
// A shared path has been validated during its creation in ClassLoader::create_class_path_entry(),
// it must be valid here.
assert(ent->name() != NULL, "sanity");
assert(ent->name() != nullptr, "sanity");
// If the path (from the class stream source) is the same as the shared
// class or module path, then we have a match.
// src may come from the App/Platform class loaders, which would canonicalize
// the file name. We cannot use strcmp to check for equality against ent->name().
// We must use os::same_files (which is faster than canonicalizing ent->name()).
if (os::same_files(ent->name(), path)) {
// NULL pkg_entry and pkg_entry in an unnamed module implies the class
// null pkg_entry and pkg_entry in an unnamed module implies the class
// is from the -cp or boot loader append path which consists of -Xbootclasspath/a
// and jvmti appended entries.
if ((pkg_entry == NULL) || (pkg_entry->in_unnamed_module())) {
if ((pkg_entry == nullptr) || (pkg_entry->in_unnamed_module())) {
// Ensure the index is within the -cp range before assigning
// to the classpath_index.
if (SystemDictionary::is_system_class_loader(loader) &&
@ -1300,7 +1300,7 @@ void ClassLoader::record_result(JavaThread* current, InstanceKlass* ik,
(i < ClassLoaderExt::app_class_paths_start_index())) {
// The class must be from boot loader append path which consists of
// -Xbootclasspath/a and jvmti appended entries.
assert(loader == NULL, "sanity");
assert(loader == nullptr, "sanity");
classpath_index = i;
break;
}
@ -1308,7 +1308,7 @@ void ClassLoader::record_result(JavaThread* current, InstanceKlass* ik,
} else {
// A class from a named module from the --module-path. Ensure the index is
// within the --module-path range before assigning to the classpath_index.
if ((pkg_entry != NULL) && !(pkg_entry->in_unnamed_module()) && (i > 0)) {
if ((pkg_entry != nullptr) && !(pkg_entry->in_unnamed_module()) && (i > 0)) {
if (i >= ClassLoaderExt::app_module_paths_start_index() &&
i < FileMapInfo::get_number_of_shared_paths()) {
classpath_index = i;
@ -1345,7 +1345,7 @@ void ClassLoader::record_result(JavaThread* current, InstanceKlass* ik,
const char* const class_name = ik->name()->as_C_string();
const char* const file_name = file_name_for_class_name(class_name,
ik->name()->utf8_length());
assert(file_name != NULL, "invariant");
assert(file_name != nullptr, "invariant");
ClassLoaderExt::record_result(classpath_index, ik, redefined);
}
@ -1395,7 +1395,7 @@ char* lookup_vm_resource(JImageFile *jimage, const char *jimage_version, const c
jlong size;
JImageLocationRef location = (*JImageFindResource)(jimage, "java.base", jimage_version, path, &size);
if (location == 0)
return NULL;
return nullptr;
char *val = NEW_C_HEAP_ARRAY(char, size+1, mtClass);
(*JImageGetResource)(jimage, location, val, size);
val[size] = '\0';
@ -1413,8 +1413,8 @@ char* ClassLoader::lookup_vm_options() {
jio_snprintf(modules_path, JVM_MAXPATHLEN, "%s%slib%smodules", Arguments::get_java_home(), fileSep, fileSep);
JImage_file =(*JImageOpen)(modules_path, &error);
if (JImage_file == NULL) {
return NULL;
if (JImage_file == nullptr) {
return nullptr;
}
const char *jimage_version = get_jimage_version_string();
@ -1423,8 +1423,8 @@ char* ClassLoader::lookup_vm_options() {
}
bool ClassLoader::is_module_observable(const char* module_name) {
assert(JImageOpen != NULL, "jimage library should have been opened");
if (JImage_file == NULL) {
assert(JImageOpen != nullptr, "jimage library should have been opened");
if (JImage_file == nullptr) {
struct stat st;
const char *path = get_exploded_module_path(module_name, true);
bool res = os::stat(path, &st) == 0;
@ -1456,7 +1456,7 @@ int ClassLoader::num_module_path_entries() {
Arguments::assert_is_dumping_archive();
int num_entries = 0;
ClassPathEntry* e= ClassLoader::_module_path_entries;
while (e != NULL) {
while (e != nullptr) {
num_entries ++;
e = e->next();
}
@ -1514,7 +1514,7 @@ void ClassLoader::classLoader_init2(JavaThread* current) {
// Setup the list of module/path pairs for --patch-module processing
// This must be done after the SymbolTable is created in order
// to use fast_compare on module names instead of a string compare.
if (Arguments::get_patch_mod_prefix() != NULL) {
if (Arguments::get_patch_mod_prefix() != nullptr) {
setup_patch_mod_entries();
}
@ -1532,7 +1532,7 @@ void ClassLoader::classLoader_init2(JavaThread* current) {
// Set up the boot loader's _exploded_entries list. Note that this gets
// done before loading any classes, by the same thread that will
// subsequently do the first class load. So, no lock is needed for this.
assert(_exploded_entries == NULL, "Should only get initialized once");
assert(_exploded_entries == nullptr, "Should only get initialized once");
_exploded_entries = new (mtModule)
GrowableArray<ModuleClassPathList*>(EXPLODED_ENTRY_SIZE, mtModule);
add_to_exploded_build_list(current, vmSymbols::java_base());
@ -1540,7 +1540,7 @@ void ClassLoader::classLoader_init2(JavaThread* current) {
}
char* ClassLoader::get_canonical_path(const char* orig, Thread* thread) {
assert(orig != NULL, "bad arguments");
assert(orig != nullptr, "bad arguments");
// caller needs to allocate ResourceMark for the following output buffer
char* canonical_path = NEW_RESOURCE_ARRAY_IN_THREAD(thread, char, JVM_MAXPATHLEN);
ResourceMark rm(thread);
@ -1548,7 +1548,7 @@ char* ClassLoader::get_canonical_path(const char* orig, Thread* thread) {
char* orig_copy = NEW_RESOURCE_ARRAY_IN_THREAD(thread, char, strlen(orig)+1);
strcpy(orig_copy, orig);
if ((CanonicalizeEntry)(os::native_path(orig_copy), canonical_path, JVM_MAXPATHLEN) < 0) {
return NULL;
return nullptr;
}
return canonical_path;
}
@ -1562,16 +1562,16 @@ void ClassLoader::create_javabase() {
// Get module entry table
ModuleEntryTable* null_cld_modules = null_cld->modules();
if (null_cld_modules == NULL) {
if (null_cld_modules == nullptr) {
vm_exit_during_initialization("No ModuleEntryTable for the boot class loader");
}
{
MutexLocker ml(current, Module_lock);
if (ModuleEntryTable::javabase_moduleEntry() == NULL) { // may have been inited by CDS.
if (ModuleEntryTable::javabase_moduleEntry() == nullptr) { // may have been inited by CDS.
ModuleEntry* jb_module = null_cld_modules->locked_create_entry(Handle(),
false, vmSymbols::java_base(), NULL, NULL, null_cld);
if (jb_module == NULL) {
false, vmSymbols::java_base(), nullptr, nullptr, null_cld);
if (jb_module == nullptr) {
vm_exit_during_initialization("Unable to create ModuleEntry for " JAVA_BASE_NAME);
}
ModuleEntryTable::set_javabase_moduleEntry(jb_module);
@ -1584,7 +1584,7 @@ void ClassLoader::create_javabase() {
void PerfClassTraceTime::initialize() {
if (!UsePerfData) return;
if (_eventp != NULL) {
if (_eventp != nullptr) {
// increment the event counter
_eventp->inc();
}
@ -1599,7 +1599,7 @@ void PerfClassTraceTime::initialize() {
}
}
if (_recursion_counters == NULL || (_recursion_counters[_event_type])++ == 0) {
if (_recursion_counters == nullptr || (_recursion_counters[_event_type])++ == 0) {
// start the inclusive timer if not recursively called
_t.start();
}
@ -1622,12 +1622,12 @@ PerfClassTraceTime::~PerfClassTraceTime() {
_timers[_prev_active_event].start();
}
if (_recursion_counters != NULL && --(_recursion_counters[_event_type]) > 0) return;
if (_recursion_counters != nullptr && --(_recursion_counters[_event_type]) > 0) return;
// increment the counters only on the leaf call
_t.stop();
_timep->inc(_t.ticks());
if (_selftimep != NULL) {
if (_selftimep != nullptr) {
_selftimep->inc(selftime);
}
// add all class loading related event selftime to the accumulated time counter

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
@ -59,10 +59,10 @@ public:
// Is this entry created from the "Class-path" attribute from a JAR Manifest?
virtual bool from_class_path_attr() const { return false; }
virtual const char* name() const = 0;
virtual JImageFile* jimage() const { return NULL; }
virtual JImageFile* jimage() const { return nullptr; }
virtual void close_jimage() {}
// Constructor
ClassPathEntry() : _next(NULL) {}
ClassPathEntry() : _next(nullptr) {}
// Attempt to locate file_name through this class path entry.
// Returns a class file parsing stream if successful.
virtual ClassFileStream* open_stream(JavaThread* current, const char* name) = 0;
@ -120,7 +120,7 @@ private:
DEBUG_ONLY(static ClassPathImageEntry* _singleton;)
public:
bool is_modules_image() const;
const char* name() const { return _name == NULL ? "" : _name; }
const char* name() const { return _name == nullptr ? "" : _name; }
JImageFile* jimage() const;
JImageFile* jimage_non_null() const;
void close_jimage();
@ -235,7 +235,7 @@ class ClassLoader: AllStatic {
CDS_ONLY(static ClassPathEntry* app_classpath_entries() {return _app_classpath_entries;})
CDS_ONLY(static ClassPathEntry* module_path_entries() {return _module_path_entries;})
static bool has_bootclasspath_append() { return first_append_entry() != NULL; }
static bool has_bootclasspath_append() { return first_append_entry() != nullptr; }
protected:
// Initialization:
@ -308,7 +308,7 @@ class ClassLoader: AllStatic {
}
// Modular java runtime image is present vs. a build with exploded modules
static bool has_jrt_entry() { return (_jrt_entry != NULL); }
static bool has_jrt_entry() { return (_jrt_entry != nullptr); }
static ClassPathEntry* get_jrt_entry() { return _jrt_entry; }
static void close_jrt_image();
@ -381,7 +381,7 @@ class ClassLoader: AllStatic {
static JImageLocationRef jimage_find_resource(JImageFile* jf, const char* module_name,
const char* file_name, jlong &size);
static void trace_class_path(const char* msg, const char* name = NULL);
static void trace_class_path(const char* msg, const char* name = nullptr);
// VM monitoring and management support
static jlong classloader_time_ms();
@ -395,15 +395,15 @@ class ClassLoader: AllStatic {
// adds a class path to the boot append entries
static void add_to_boot_append_entries(ClassPathEntry* new_entry);
// creates a class path zip entry (returns NULL if JAR file cannot be opened)
// creates a class path zip entry (returns null if JAR file cannot be opened)
static ClassPathZipEntry* create_class_path_zip_entry(const char *apath, bool is_boot_append);
static bool string_ends_with(const char* str, const char* str_to_find);
// Extract package name from a fully qualified class name
// *bad_class_name is set to true if there's a problem with parsing class_name, to
// distinguish from a class_name with no package name, as both cases have a NULL return value
static Symbol* package_from_class_name(const Symbol* class_name, bool* bad_class_name = NULL);
// distinguish from a class_name with no package name, as both cases have a null return value
static Symbol* package_from_class_name(const Symbol* class_name, bool* bad_class_name = nullptr);
// Debugging
static void verify() PRODUCT_RETURN;
@ -458,7 +458,7 @@ class PerfClassTraceTime {
inline PerfClassTraceTime(PerfLongCounter* timep, /* counter incremented with inclusive time */
elapsedTimer* timers, /* thread-local timer array */
int type /* event type */ ) :
_timep(timep), _selftimep(NULL), _eventp(NULL), _recursion_counters(NULL), _timers(timers), _event_type(type) {
_timep(timep), _selftimep(nullptr), _eventp(nullptr), _recursion_counters(nullptr), _timers(timers), _event_type(type) {
initialize();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 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
@ -51,7 +51,7 @@ inline ClassPathEntry* ClassLoader::classpath_entry(int n) {
// class path vs. the shared archive class path.
ClassPathEntry* e = first_append_entry();
while (--n >= 1) {
assert(e != NULL, "Not that many classpath entries.");
assert(e != nullptr, "Not that many classpath entries.");
e = e->next();
}
return e;
@ -74,7 +74,7 @@ inline int ClassLoader::num_boot_classpath_entries() {
assert(has_jrt_entry(), "must have a java runtime image");
int num_entries = 1; // count the runtime image
ClassPathEntry* e = first_append_entry();
while (e != NULL) {
while (e != nullptr) {
num_entries ++;
e = e->next();
}
@ -95,7 +95,7 @@ inline int ClassLoader::num_app_classpath_entries() {
Arguments::assert_is_dumping_archive();
int num_entries = 0;
ClassPathEntry* e= ClassLoader::_app_classpath_entries;
while (e != NULL) {
while (e != nullptr) {
num_entries ++;
e = e->next();
}

View File

@ -43,7 +43,7 @@
// Instances of java.lang.ClassLoader holds a pointer to a ClassLoaderData that
// that represent the loader's "linking domain" in the JVM.
//
// The bootstrap loader (represented by NULL) also has a ClassLoaderData,
// The bootstrap loader (represented by null) also has a ClassLoaderData,
// the singleton class the_null_class_loader_data().
#include "precompiled.hpp"
@ -80,11 +80,11 @@
#include "utilities/macros.hpp"
#include "utilities/ostream.hpp"
ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL;
ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = nullptr;
void ClassLoaderData::init_null_class_loader_data() {
assert(_the_null_class_loader_data == NULL, "cannot initialize twice");
assert(ClassLoaderDataGraph::_head == NULL, "cannot initialize twice");
assert(_the_null_class_loader_data == nullptr, "cannot initialize twice");
assert(ClassLoaderDataGraph::_head == nullptr, "cannot initialize twice");
_the_null_class_loader_data = new ClassLoaderData(Handle(), false);
ClassLoaderDataGraph::_head = _the_null_class_loader_data;
@ -110,10 +110,10 @@ void ClassLoaderData::initialize_name(Handle class_loader) {
// Obtain the class loader's name. If the class loader's name was not
// explicitly set during construction, the CLD's _name field will be null.
oop cl_name = java_lang_ClassLoader::name(class_loader());
if (cl_name != NULL) {
if (cl_name != nullptr) {
const char* cl_instance_name = java_lang_String::as_utf8_string(cl_name);
if (cl_instance_name != NULL && cl_instance_name[0] != '\0') {
if (cl_instance_name != nullptr && cl_instance_name[0] != '\0') {
_name = SymbolTable::new_symbol(cl_instance_name);
}
}
@ -127,14 +127,14 @@ void ClassLoaderData::initialize_name(Handle class_loader) {
// name. Thus CLD's _name_and_id field should never have a null value.
oop cl_name_and_id = java_lang_ClassLoader::nameAndId(class_loader());
const char* cl_instance_name_and_id =
(cl_name_and_id == NULL) ? _class_loader_klass->external_name() :
(cl_name_and_id == nullptr) ? _class_loader_klass->external_name() :
java_lang_String::as_utf8_string(cl_name_and_id);
assert(cl_instance_name_and_id != NULL && cl_instance_name_and_id[0] != '\0', "class loader has no name and id");
assert(cl_instance_name_and_id != nullptr && cl_instance_name_and_id[0] != '\0', "class loader has no name and id");
_name_and_id = SymbolTable::new_symbol(cl_instance_name_and_id);
}
ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool has_class_mirror_holder) :
_metaspace(NULL),
_metaspace(nullptr),
_metaspace_lock(new Mutex(Mutex::nosafepoint-2, "MetaspaceAllocation_lock")),
_unloading(false), _has_class_mirror_holder(has_class_mirror_holder),
_modified_oops(true),
@ -144,11 +144,11 @@ ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool has_class_mirror_ho
_keep_alive((has_class_mirror_holder || h_class_loader.is_null()) ? 1 : 0),
_claim(0),
_handles(),
_klasses(NULL), _packages(NULL), _modules(NULL), _unnamed_module(NULL), _dictionary(NULL),
_jmethod_ids(NULL),
_deallocate_list(NULL),
_next(NULL),
_class_loader_klass(NULL), _name(NULL), _name_and_id(NULL) {
_klasses(nullptr), _packages(nullptr), _modules(nullptr), _unnamed_module(nullptr), _dictionary(nullptr),
_jmethod_ids(nullptr),
_deallocate_list(nullptr),
_next(nullptr),
_class_loader_klass(nullptr), _name(nullptr), _name_and_id(nullptr) {
if (!h_class_loader.is_null()) {
_class_loader = _handles.add(h_class_loader());
@ -181,7 +181,7 @@ ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool has_class_mirror_ho
ClassLoaderData::ChunkedHandleList::~ChunkedHandleList() {
Chunk* c = _head;
while (c != NULL) {
while (c != nullptr) {
Chunk* next = c->_next;
delete c;
c = next;
@ -189,7 +189,7 @@ ClassLoaderData::ChunkedHandleList::~ChunkedHandleList() {
}
OopHandle ClassLoaderData::ChunkedHandleList::add(oop o) {
if (_head == NULL || _head->_size == Chunk::CAPACITY) {
if (_head == nullptr || _head->_size == Chunk::CAPACITY) {
Chunk* next = new Chunk(_head);
Atomic::release_store(&_head, next);
}
@ -202,7 +202,7 @@ OopHandle ClassLoaderData::ChunkedHandleList::add(oop o) {
int ClassLoaderData::ChunkedHandleList::count() const {
int count = 0;
Chunk* chunk = _head;
while (chunk != NULL) {
while (chunk != nullptr) {
count += chunk->_size;
chunk = chunk->_next;
}
@ -217,10 +217,10 @@ inline void ClassLoaderData::ChunkedHandleList::oops_do_chunk(OopClosure* f, Chu
void ClassLoaderData::ChunkedHandleList::oops_do(OopClosure* f) {
Chunk* head = Atomic::load_acquire(&_head);
if (head != NULL) {
if (head != nullptr) {
// Must be careful when reading size of head
oops_do_chunk(f, head, Atomic::load_acquire(&head->_size));
for (Chunk* c = head->_next; c != NULL; c = c->_next) {
for (Chunk* c = head->_next; c != nullptr; c = c->_next) {
oops_do_chunk(f, c, c->_size);
}
}
@ -234,7 +234,7 @@ class VerifyContainsOopClosure : public OopClosure {
VerifyContainsOopClosure(oop target) : _target(target), _found(false) {}
void do_oop(oop* p) {
if (p != NULL && NativeAccess<AS_NO_KEEPALIVE>::oop_load(p) == _target) {
if (p != nullptr && NativeAccess<AS_NO_KEEPALIVE>::oop_load(p) == _target) {
_found = true;
}
}
@ -258,7 +258,7 @@ bool ClassLoaderData::ChunkedHandleList::contains(oop p) {
#ifndef PRODUCT
bool ClassLoaderData::ChunkedHandleList::owner_of(oop* oop_handle) {
Chunk* chunk = _head;
while (chunk != NULL) {
while (chunk != nullptr) {
if (&(chunk->_data[0]) <= oop_handle && oop_handle < &(chunk->_data[chunk->_size])) {
return true;
}
@ -334,7 +334,7 @@ void ClassLoaderData::oops_do(OopClosure* f, int claim_value, bool clear_mod_oop
void ClassLoaderData::classes_do(KlassClosure* klass_closure) {
// Lock-free access requires load_acquire
for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
for (Klass* k = Atomic::load_acquire(&_klasses); k != nullptr; k = k->next_link()) {
klass_closure->do_klass(k);
assert(k != k->next_link(), "no loops!");
}
@ -342,7 +342,7 @@ void ClassLoaderData::classes_do(KlassClosure* klass_closure) {
void ClassLoaderData::classes_do(void f(Klass * const)) {
// Lock-free access requires load_acquire
for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
for (Klass* k = Atomic::load_acquire(&_klasses); k != nullptr; k = k->next_link()) {
f(k);
assert(k != k->next_link(), "no loops!");
}
@ -350,7 +350,7 @@ void ClassLoaderData::classes_do(void f(Klass * const)) {
void ClassLoaderData::methods_do(void f(Method*)) {
// Lock-free access requires load_acquire
for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
for (Klass* k = Atomic::load_acquire(&_klasses); k != nullptr; k = k->next_link()) {
if (k->is_instance_klass() && InstanceKlass::cast(k)->is_loaded()) {
InstanceKlass::cast(k)->methods_do(f);
}
@ -362,7 +362,7 @@ void ClassLoaderData::loaded_classes_do(KlassClosure* klass_closure) {
assert_locked_or_safepoint(MultiArray_lock);
// Lock-free access requires load_acquire
for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
for (Klass* k = Atomic::load_acquire(&_klasses); k != nullptr; k = k->next_link()) {
// Filter out InstanceKlasses (or their ObjArrayKlasses) that have not entered the
// loaded state.
if (k->is_instance_klass()) {
@ -381,7 +381,7 @@ void ClassLoaderData::loaded_classes_do(KlassClosure* klass_closure) {
#ifdef ASSERT
oop m = k->java_mirror();
assert(m != NULL, "NULL mirror");
assert(m != nullptr, "nullptr mirror");
assert(m->is_a(vmClasses::Class_klass()), "invalid mirror");
#endif
klass_closure->do_klass(k);
@ -390,7 +390,7 @@ void ClassLoaderData::loaded_classes_do(KlassClosure* klass_closure) {
void ClassLoaderData::classes_do(void f(InstanceKlass*)) {
// Lock-free access requires load_acquire
for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
for (Klass* k = Atomic::load_acquire(&_klasses); k != nullptr; k = k->next_link()) {
if (k->is_instance_klass()) {
f(InstanceKlass::cast(k));
}
@ -400,23 +400,23 @@ void ClassLoaderData::classes_do(void f(InstanceKlass*)) {
void ClassLoaderData::modules_do(void f(ModuleEntry*)) {
assert_locked_or_safepoint(Module_lock);
if (_unnamed_module != NULL) {
if (_unnamed_module != nullptr) {
f(_unnamed_module);
}
if (_modules != NULL) {
if (_modules != nullptr) {
_modules->modules_do(f);
}
}
void ClassLoaderData::packages_do(void f(PackageEntry*)) {
assert_locked_or_safepoint(Module_lock);
if (_packages != NULL) {
if (_packages != nullptr) {
_packages->packages_do(f);
}
}
void ClassLoaderData::record_dependency(const Klass* k) {
assert(k != NULL, "invariant");
assert(k != nullptr, "invariant");
ClassLoaderData * const from_cld = this;
ClassLoaderData * const to_cld = k->class_loader_data();
@ -498,7 +498,7 @@ void ClassLoaderData::add_class(Klass* k, bool publicize /* true */) {
}
void ClassLoaderData::initialize_holder(Handle loader_or_mirror) {
if (loader_or_mirror() != NULL) {
if (loader_or_mirror() != nullptr) {
assert(_holder.is_null(), "never replace holders");
_holder = WeakHandle(Universe::vm_weak(), loader_or_mirror);
}
@ -512,10 +512,10 @@ void ClassLoaderData::remove_class(Klass* scratch_class) {
// Adjust global class iterator.
ClassLoaderDataGraph::adjust_saved_class(scratch_class);
Klass* prev = NULL;
for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
Klass* prev = nullptr;
for (Klass* k = _klasses; k != nullptr; k = k->next_link()) {
if (k == scratch_class) {
if (prev == NULL) {
if (prev == nullptr) {
_klasses = k->next_link();
} else {
Klass* next = k->next_link();
@ -557,7 +557,7 @@ void ClassLoaderData::unload() {
// after erroneous classes are released.
classes_do(InstanceKlass::unload_class);
// Method::clear_jmethod_ids only sets the jmethod_ids to NULL without
// Method::clear_jmethod_ids only sets the jmethod_ids to null without
// releasing the memory for related JNIMethodBlocks and JNIMethodBlockNodes.
// This is done intentionally because native code (e.g. JVMTI agent) holding
// jmethod_ids may access them after the associated classes and class loader
@ -565,10 +565,10 @@ void ClassLoaderData::unload() {
// does not prevent the VM from unloading the class from which the ID has
// been derived. After the class is unloaded, the method or field ID becomes
// invalid". In real world usages, the native code may rely on jmethod_ids
// being NULL after class unloading. Hence, it is unsafe to free the memory
// being null after class unloading. Hence, it is unsafe to free the memory
// from the VM side without knowing when native code is going to stop using
// them.
if (_jmethod_ids != NULL) {
if (_jmethod_ids != nullptr) {
Method::clear_jmethod_ids(this);
}
@ -580,10 +580,10 @@ ModuleEntryTable* ClassLoaderData::modules() {
// Lazily create the module entry table at first request.
// Lock-free access requires load_acquire.
ModuleEntryTable* modules = Atomic::load_acquire(&_modules);
if (modules == NULL) {
if (modules == nullptr) {
MutexLocker m1(Module_lock);
// Check if _modules got allocated while we were waiting for this lock.
if ((modules = _modules) == NULL) {
if ((modules = _modules) == nullptr) {
modules = new ModuleEntryTable();
{
@ -602,7 +602,7 @@ const int _default_loader_dictionary_size = 107;
Dictionary* ClassLoaderData::create_dictionary() {
assert(!has_class_mirror_holder(), "class mirror holder cld does not have a dictionary");
int size;
if (_the_null_class_loader_data == NULL) {
if (_the_null_class_loader_data == nullptr) {
size = _boot_loader_dictionary_size;
} else if (class_loader()->is_a(vmClasses::reflect_DelegatingClassLoader_klass())) {
size = 1; // there's only one class in relection class loader and no initiated classes
@ -622,26 +622,26 @@ oop ClassLoaderData::holder() const {
// or a reachable object making it alive again. The SATB part of G1 needs
// to get notified about this potential resurrection, otherwise the marking
// might not find the object.
if (!_holder.is_null()) { // NULL class_loader
if (!_holder.is_null()) { // null class_loader
return _holder.resolve();
} else {
return NULL;
return nullptr;
}
}
// Let the GC read the holder without keeping it alive.
oop ClassLoaderData::holder_no_keepalive() const {
if (!_holder.is_null()) { // NULL class_loader
if (!_holder.is_null()) { // null class_loader
return _holder.peek();
} else {
return NULL;
return nullptr;
}
}
// Unloading support
bool ClassLoaderData::is_alive() const {
bool alive = keep_alive() // null class loader and incomplete non-strong hidden class.
|| (_holder.peek() != NULL); // and not cleaned by the GC weak handle processing.
|| (_holder.peek() != nullptr); // and not cleaned by the GC weak handle processing.
return alive;
}
@ -679,35 +679,35 @@ ClassLoaderData::~ClassLoaderData() {
_holder.release(Universe::vm_weak());
// Release C heap allocated hashtable for all the packages.
if (_packages != NULL) {
if (_packages != nullptr) {
// Destroy the table itself
delete _packages;
_packages = NULL;
_packages = nullptr;
}
// Release C heap allocated hashtable for all the modules.
if (_modules != NULL) {
if (_modules != nullptr) {
// Destroy the table itself
delete _modules;
_modules = NULL;
_modules = nullptr;
}
// Release C heap allocated hashtable for the dictionary
if (_dictionary != NULL) {
if (_dictionary != nullptr) {
// Destroy the table itself
delete _dictionary;
_dictionary = NULL;
_dictionary = nullptr;
}
if (_unnamed_module != NULL) {
if (_unnamed_module != nullptr) {
delete _unnamed_module;
_unnamed_module = NULL;
_unnamed_module = nullptr;
}
// release the metaspace
ClassLoaderMetaspace *m = _metaspace;
if (m != NULL) {
_metaspace = NULL;
if (m != nullptr) {
_metaspace = nullptr;
delete m;
}
@ -715,15 +715,15 @@ ClassLoaderData::~ClassLoaderData() {
delete _metaspace_lock;
// Delete free list
if (_deallocate_list != NULL) {
if (_deallocate_list != nullptr) {
delete _deallocate_list;
}
// Decrement refcounts of Symbols if created.
if (_name != NULL) {
if (_name != nullptr) {
_name->decrement_refcount();
}
if (_name_and_id != NULL) {
if (_name_and_id != nullptr) {
_name_and_id->decrement_refcount();
}
}
@ -766,12 +766,12 @@ ClassLoaderMetaspace* ClassLoaderData::metaspace_non_null() {
// simply for delegating with no metadata of their own.
// Lock-free access requires load_acquire.
ClassLoaderMetaspace* metaspace = Atomic::load_acquire(&_metaspace);
if (metaspace == NULL) {
if (metaspace == nullptr) {
MutexLocker ml(_metaspace_lock, Mutex::_no_safepoint_check_flag);
// Check if _metaspace got allocated while we were waiting for this lock.
if ((metaspace = _metaspace) == NULL) {
if ((metaspace = _metaspace) == nullptr) {
if (this == the_null_class_loader_data()) {
assert (class_loader() == NULL, "Must be");
assert (class_loader() == nullptr, "Must be");
metaspace = new ClassLoaderMetaspace(_metaspace_lock, Metaspace::BootMetaspaceType);
} else if (has_class_mirror_holder()) {
metaspace = new ClassLoaderMetaspace(_metaspace_lock, Metaspace::ClassMirrorHolderMetaspaceType);
@ -796,15 +796,15 @@ OopHandle ClassLoaderData::add_handle(Handle h) {
void ClassLoaderData::remove_handle(OopHandle h) {
assert(!is_unloading(), "Do not remove a handle for a CLD that is unloading");
oop* ptr = h.ptr_raw();
if (ptr != NULL) {
if (ptr != nullptr) {
assert(_handles.owner_of(ptr), "Got unexpected handle " PTR_FORMAT, p2i(ptr));
NativeAccess<>::oop_store(ptr, oop(NULL));
NativeAccess<>::oop_store(ptr, oop(nullptr));
}
}
void ClassLoaderData::init_handle_locked(OopHandle& dest, Handle h) {
MutexLocker ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
if (dest.resolve() != NULL) {
if (dest.resolve() != nullptr) {
return;
} else {
record_modified_oops();
@ -818,7 +818,7 @@ void ClassLoaderData::add_to_deallocate_list(Metadata* m) {
// Metadata in shared region isn't deleted.
if (!m->is_shared()) {
MutexLocker ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
if (_deallocate_list == NULL) {
if (_deallocate_list == nullptr) {
_deallocate_list = new (mtClass) GrowableArray<Metadata*>(100, mtClass);
}
_deallocate_list->append_if_missing(m);
@ -834,7 +834,7 @@ void ClassLoaderData::free_deallocate_list() {
// safepoint cleanup time.
assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
assert(!is_unloading(), "only called for ClassLoaderData that are not unloading");
if (_deallocate_list == NULL) {
if (_deallocate_list == nullptr) {
return;
}
// Go backwards because this removes entries that are freed.
@ -873,7 +873,7 @@ void ClassLoaderData::free_deallocate_list() {
void ClassLoaderData::free_deallocate_list_C_heap_structures() {
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
assert(is_unloading(), "only called for ClassLoaderData that are unloading");
if (_deallocate_list == NULL) {
if (_deallocate_list == nullptr) {
return;
}
// Go backwards because this removes entries that are freed.
@ -899,9 +899,9 @@ void ClassLoaderData::free_deallocate_list_C_heap_structures() {
// If the class loader's _name has not been explicitly set, the class loader's
// qualified class name is returned.
const char* ClassLoaderData::loader_name() const {
if (_class_loader_klass == NULL) {
if (_class_loader_klass == nullptr) {
return BOOTSTRAP_LOADER_NAME;
} else if (_name != NULL) {
} else if (_name != nullptr) {
return _name->as_C_string();
} else {
return _class_loader_klass->external_name();
@ -914,9 +914,9 @@ const char* ClassLoaderData::loader_name() const {
// If the defining loader has no name then <qualified-class-name> @<id>
// If built-in loader, then omit '@<id>' as there is only one instance.
const char* ClassLoaderData::loader_name_and_id() const {
if (_class_loader_klass == NULL) {
if (_class_loader_klass == nullptr) {
return "'" BOOTSTRAP_LOADER_NAME "'";
} else if (_name_and_id != NULL) {
} else if (_name_and_id != nullptr) {
return _name_and_id->as_C_string();
} else {
// May be called in a race before _name_and_id is initialized.
@ -925,7 +925,7 @@ const char* ClassLoaderData::loader_name_and_id() const {
}
void ClassLoaderData::print_value_on(outputStream* out) const {
if (!is_unloading() && class_loader() != NULL) {
if (!is_unloading() && class_loader() != nullptr) {
out->print("loader data: " INTPTR_FORMAT " for instance ", p2i(this));
class_loader()->print_value_on(out); // includes loader_name_and_id() and address of class loader instance
} else {
@ -997,7 +997,7 @@ void ClassLoaderData::print_on(outputStream* out) const {
} else {
out->print_cr(" - dictionary " INTPTR_FORMAT, p2i(_dictionary));
}
if (_jmethod_ids != NULL) {
if (_jmethod_ids != nullptr) {
out->print (" - jmethod count ");
Method::print_jmethod_ids_count(this, out);
out->print_cr("");
@ -1031,22 +1031,22 @@ void ClassLoaderData::verify() {
oop cl = class_loader();
guarantee(this == class_loader_data(cl) || has_class_mirror_holder(), "Must be the same");
guarantee(cl != NULL || this == ClassLoaderData::the_null_class_loader_data() || has_class_mirror_holder(), "must be");
guarantee(cl != nullptr || this == ClassLoaderData::the_null_class_loader_data() || has_class_mirror_holder(), "must be");
// Verify the integrity of the allocated space.
#ifdef ASSERT
if (metaspace_or_null() != NULL) {
if (metaspace_or_null() != nullptr) {
metaspace_or_null()->verify();
}
#endif
for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
for (Klass* k = _klasses; k != nullptr; k = k->next_link()) {
guarantee(k->class_loader_data() == this, "Must be the same");
k->verify();
assert(k != k->next_link(), "no loops!");
}
if (_modules != NULL) {
if (_modules != nullptr) {
_modules->verify();
}
@ -1066,7 +1066,7 @@ void ClassLoaderData::verify() {
bool ClassLoaderData::contains_klass(Klass* klass) {
// Lock-free access requires load_acquire
for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
for (Klass* k = Atomic::load_acquire(&_klasses); k != nullptr; k = k->next_link()) {
if (k == klass) return true;
}
return false;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
@ -84,7 +84,7 @@ class ClassLoaderData : public CHeapObj<mtClass> {
void oops_do_chunk(OopClosure* f, Chunk* c, const juint size);
public:
ChunkedHandleList() : _head(NULL) {}
ChunkedHandleList() : _head(nullptr) {}
~ChunkedHandleList();
// Only one thread at a time can add, guarded by ClassLoaderData::metaspace_lock().
@ -143,7 +143,7 @@ class ClassLoaderData : public CHeapObj<mtClass> {
ModuleEntry* _unnamed_module; // This class loader's unnamed module.
Dictionary* _dictionary; // The loaded InstanceKlasses, including initiated by this class loader
// These method IDs are created for the class loader and set to NULL when the
// These method IDs are created for the class loader and set to null when the
// class loader is unloaded. They are rarely freed, only for redefine classes
// and if they lose a data race in InstanceKlass.
JNIMethodBlock* _jmethod_ids;
@ -254,7 +254,7 @@ class ClassLoaderData : public CHeapObj<mtClass> {
OopHandle class_loader_handle() const { return _class_loader; }
// The Metaspace is created lazily so may be NULL. This
// The Metaspace is created lazily so may be null. This
// method will allocate a Metaspace if needed.
ClassLoaderMetaspace* metaspace_non_null();
@ -300,7 +300,7 @@ class ClassLoaderData : public CHeapObj<mtClass> {
PackageEntryTable* packages() { return _packages; }
ModuleEntry* unnamed_module() { return _unnamed_module; }
ModuleEntryTable* modules();
bool modules_defined() { return (_modules != NULL); }
bool modules_defined() { return (_modules != nullptr); }
// Offsets
static ByteSize holder_offset() { return in_ByteSize(offset_of(ClassLoaderData, _holder)); }
@ -314,7 +314,7 @@ class ClassLoaderData : public CHeapObj<mtClass> {
static ClassLoaderData* class_loader_data(oop loader);
static ClassLoaderData* class_loader_data_or_null(oop loader);
// Returns Klass* of associated class loader, or NULL if associated loader is 'bootstrap'.
// Returns Klass* of associated class loader, or null if associated loader is 'bootstrap'.
// Also works if unloading.
Klass* class_loader_klass() const { return _class_loader_klass; }
@ -322,7 +322,7 @@ class ClassLoaderData : public CHeapObj<mtClass> {
// construction or the class loader's qualified class name.
// Works during unloading.
const char* loader_name() const;
// Returns the explicitly specified class loader name or NULL.
// Returns the explicitly specified class loader name or null.
Symbol* name() const { return _name; }
// Obtain the class loader's _name_and_id, works during unloading.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 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
@ -35,22 +35,22 @@
inline oop ClassLoaderData::class_loader() const {
assert(!_unloading, "This oop is not available to unloading class loader data");
assert(_holder.is_null() || holder_no_keepalive() != NULL , "This class loader data holder must be alive");
assert(_holder.is_null() || holder_no_keepalive() != nullptr , "This class loader data holder must be alive");
return _class_loader.resolve();
}
inline oop ClassLoaderData::class_loader_no_keepalive() const {
assert(!_unloading, "This oop is not available to unloading class loader data");
assert(_holder.is_null() || holder_no_keepalive() != NULL , "This class loader data holder must be alive");
assert(_holder.is_null() || holder_no_keepalive() != nullptr , "This class loader data holder must be alive");
return _class_loader.peek();
}
inline bool ClassLoaderData::is_boot_class_loader_data() const {
return this == _the_null_class_loader_data || class_loader() == NULL;
return this == _the_null_class_loader_data || class_loader() == nullptr;
}
inline ClassLoaderData* ClassLoaderData::class_loader_data_or_null(oop loader) {
if (loader == NULL) {
if (loader == nullptr) {
return ClassLoaderData::the_null_class_loader_data();
}
return java_lang_ClassLoader::loader_data_acquire(loader);
@ -58,7 +58,7 @@ inline ClassLoaderData* ClassLoaderData::class_loader_data_or_null(oop loader) {
inline ClassLoaderData* ClassLoaderData::class_loader_data(oop loader) {
ClassLoaderData* loader_data = class_loader_data_or_null(loader);
assert(loader_data != NULL, "Must be");
assert(loader_data != nullptr, "Must be");
return loader_data;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 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
@ -61,20 +61,20 @@ void ClassLoaderDataGraph::clear_claimed_marks() {
//
// Any ClassLoaderData added after or during walking the list are prepended to
// _head. Their claim mark need not be handled here.
for (ClassLoaderData* cld = Atomic::load_acquire(&_head); cld != NULL; cld = cld->next()) {
for (ClassLoaderData* cld = Atomic::load_acquire(&_head); cld != nullptr; cld = cld->next()) {
cld->clear_claim();
}
}
void ClassLoaderDataGraph::clear_claimed_marks(int claim) {
for (ClassLoaderData* cld = Atomic::load_acquire(&_head); cld != NULL; cld = cld->next()) {
for (ClassLoaderData* cld = Atomic::load_acquire(&_head); cld != nullptr; cld = cld->next()) {
cld->clear_claim(claim);
}
}
void ClassLoaderDataGraph::verify_claimed_marks_cleared(int claim) {
#ifdef ASSERT
for (ClassLoaderData* cld = Atomic::load_acquire(&_head); cld != NULL; cld = cld->next()) {
for (ClassLoaderData* cld = Atomic::load_acquire(&_head); cld != nullptr; cld = cld->next()) {
cld->verify_not_claimed(claim);
}
#endif
@ -87,7 +87,7 @@ class ClassLoaderDataGraphKlassIteratorStatic {
Klass* _current_class_entry;
public:
ClassLoaderDataGraphKlassIteratorStatic() : _current_loader_data(NULL), _current_class_entry(NULL) {}
ClassLoaderDataGraphKlassIteratorStatic() : _current_loader_data(nullptr), _current_class_entry(nullptr) {}
InstanceKlass* try_get_next_class() {
assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
@ -95,7 +95,7 @@ class ClassLoaderDataGraphKlassIteratorStatic {
assert(max_classes > 0, "should not be called with no instance classes");
for (size_t i = 0; i < max_classes; ) {
if (_current_class_entry != NULL) {
if (_current_class_entry != nullptr) {
Klass* k = _current_class_entry;
_current_class_entry = _current_class_entry->next_link();
@ -110,11 +110,11 @@ class ClassLoaderDataGraphKlassIteratorStatic {
}
} else {
// Go to next CLD
if (_current_loader_data != NULL) {
if (_current_loader_data != nullptr) {
_current_loader_data = _current_loader_data->next();
}
// Start at the beginning
if (_current_loader_data == NULL) {
if (_current_loader_data == nullptr) {
_current_loader_data = ClassLoaderDataGraph::_head;
}
@ -122,8 +122,8 @@ class ClassLoaderDataGraphKlassIteratorStatic {
}
}
// Should never be reached unless all instance classes have failed or are not fully loaded.
// Caller handles NULL.
return NULL;
// Caller handles null.
return nullptr;
}
// If the current class for the static iterator is a class being unloaded or
@ -131,7 +131,7 @@ class ClassLoaderDataGraphKlassIteratorStatic {
void adjust_saved_class(ClassLoaderData* cld) {
if (_current_loader_data == cld) {
_current_loader_data = cld->next();
if (_current_loader_data != NULL) {
if (_current_loader_data != nullptr) {
_current_class_entry = _current_loader_data->klasses();
} // else try_get_next_class will start at the head
}
@ -162,7 +162,7 @@ void ClassLoaderDataGraph::adjust_saved_class(Klass* klass) {
void ClassLoaderDataGraph::clean_deallocate_lists(bool walk_previous_versions) {
assert(SafepointSynchronize::is_at_safepoint(), "must only be called at safepoint");
uint loaders_processed = 0;
for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
for (ClassLoaderData* cld = _head; cld != nullptr; cld = cld->next()) {
// is_alive check will be necessary for concurrent class unloading.
if (cld->is_alive()) {
// clean metaspace
@ -202,8 +202,8 @@ void ClassLoaderDataGraph::walk_metadata_and_clean_metaspaces() {
}
// GC root of class loader data created.
ClassLoaderData* volatile ClassLoaderDataGraph::_head = NULL;
ClassLoaderData* ClassLoaderDataGraph::_unloading = NULL;
ClassLoaderData* volatile ClassLoaderDataGraph::_head = nullptr;
ClassLoaderData* ClassLoaderDataGraph::_unloading = nullptr;
bool ClassLoaderDataGraph::_should_clean_deallocate_lists = false;
bool ClassLoaderDataGraph::_safepoint_cleanup_needed = false;
@ -221,7 +221,7 @@ ClassLoaderData* ClassLoaderDataGraph::add_to_graph(Handle loader, bool has_clas
// it into the loader while we were waiting for the lock.
if (!has_class_mirror_holder && loader.not_null()) {
cld = java_lang_ClassLoader::loader_data_acquire(loader());
if (cld != NULL) {
if (cld != nullptr) {
return cld;
}
}
@ -264,7 +264,7 @@ ClassLoaderData* ClassLoaderDataGraph::add(Handle loader, bool has_class_mirror_
void ClassLoaderDataGraph::cld_unloading_do(CLDClosure* cl) {
assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock);
for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {
for (ClassLoaderData* cld = _unloading; cld != nullptr; cld = cld->next()) {
assert(cld->is_unloading(), "invariant");
cl->do_cld(cld);
}
@ -274,16 +274,16 @@ void ClassLoaderDataGraph::cld_unloading_do(CLDClosure* cl) {
// unloading ones.
void ClassLoaderDataGraph::cld_do(CLDClosure* cl) {
assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock);
for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->_next) {
for (ClassLoaderData* cld = _head; cld != nullptr; cld = cld->_next) {
cl->do_cld(cld);
}
}
void ClassLoaderDataGraph::roots_cld_do(CLDClosure* strong, CLDClosure* weak) {
assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock);
for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->_next) {
for (ClassLoaderData* cld = _head; cld != nullptr; cld = cld->_next) {
CLDClosure* closure = cld->keep_alive() ? strong : weak;
if (closure != NULL) {
if (closure != nullptr) {
closure->do_cld(cld);
}
}
@ -292,7 +292,7 @@ void ClassLoaderDataGraph::roots_cld_do(CLDClosure* strong, CLDClosure* weak) {
void ClassLoaderDataGraph::always_strong_cld_do(CLDClosure* cl) {
assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock);
if (ClassUnloading) {
roots_cld_do(cl, NULL);
roots_cld_do(cl, nullptr);
} else {
cld_do(cl);
}
@ -306,7 +306,7 @@ LockedClassesDo::LockedClassesDo(classes_do_func_t f) : _function(f),
}
}
LockedClassesDo::LockedClassesDo() : _function(NULL),
LockedClassesDo::LockedClassesDo() : _function(nullptr),
_do_lock(!SafepointSynchronize::is_at_safepoint()) {
// callers provide their own do_klass
if (_do_lock) {
@ -343,17 +343,17 @@ public:
ClassLoaderData* get_next() {
ClassLoaderData* cld = _next;
// Skip already unloaded CLD for concurrent unloading.
while (cld != NULL && !cld->is_alive()) {
while (cld != nullptr && !cld->is_alive()) {
cld = cld->next();
}
if (cld != NULL) {
if (cld != nullptr) {
if (keep_alive) {
// Keep cld that is being returned alive.
Handle(_thread, cld->holder());
}
_next = cld->next();
} else {
_next = NULL;
_next = nullptr;
}
return cld;
}
@ -424,7 +424,7 @@ void ClassLoaderDataGraph::loaded_classes_do(KlassClosure* klass_closure) {
void ClassLoaderDataGraph::classes_unloading_do(void f(Klass* const)) {
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {
for (ClassLoaderData* cld = _unloading; cld != nullptr; cld = cld->next()) {
assert(cld->is_unloading(), "invariant");
cld->classes_do(f);
}
@ -441,7 +441,7 @@ void ClassLoaderDataGraph::verify_dictionary() {
#define FOR_ALL_DICTIONARY(X) ClassLoaderDataGraphIterator iter; \
while (ClassLoaderData* X = iter.get_next()) \
if (X->dictionary() != NULL)
if (X->dictionary() != nullptr)
void ClassLoaderDataGraph::print_dictionary(outputStream* st) {
FOR_ALL_DICTIONARY(cld) {
@ -465,7 +465,7 @@ void ClassLoaderDataGraph::print_table_statistics(outputStream* st) {
#ifndef PRODUCT
bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) {
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
for (ClassLoaderData* data = _head; data != NULL; data = data->next()) {
for (ClassLoaderData* data = _head; data != nullptr; data = data->next()) {
if (loader_data == data) {
return true;
}
@ -477,11 +477,11 @@ bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) {
bool ClassLoaderDataGraph::is_valid(ClassLoaderData* loader_data) {
DEBUG_ONLY( if (!VMError::is_error_reported()) { assert_locked_or_safepoint(ClassLoaderDataGraph_lock); } )
if (loader_data != NULL) {
if (loader_data != nullptr) {
if (loader_data == ClassLoaderData::the_null_class_loader_data()) {
return true;
}
for (ClassLoaderData* data = _head; data != NULL; data = data->next()) {
for (ClassLoaderData* data = _head; data != nullptr; data = data->next()) {
if (loader_data == data) {
return true;
}
@ -496,13 +496,13 @@ bool ClassLoaderDataGraph::do_unloading() {
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
ClassLoaderData* data = _head;
ClassLoaderData* prev = NULL;
ClassLoaderData* prev = nullptr;
bool seen_dead_loader = false;
uint loaders_processed = 0;
uint loaders_removed = 0;
data = _head;
while (data != NULL) {
while (data != nullptr) {
if (data->is_alive()) {
prev = data;
data = data->next();
@ -517,7 +517,7 @@ bool ClassLoaderDataGraph::do_unloading() {
// Remove from loader list.
// This class loader data will no longer be found
// in the ClassLoaderDataGraph.
if (prev != NULL) {
if (prev != nullptr) {
prev->set_next(data);
} else {
assert(dead == _head, "sanity check");
@ -538,14 +538,14 @@ void ClassLoaderDataGraph::clean_module_and_package_info() {
assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
ClassLoaderData* data = _head;
while (data != NULL) {
while (data != nullptr) {
// Walk a ModuleEntry's reads, and a PackageEntry's exports
// lists to determine if there are modules on those lists that are now
// dead and should be removed. A module's life cycle is equivalent
// to its defining class loader's life cycle. Since a module is
// considered dead if its class loader is dead, these walks must
// occur after each class loader's aliveness is determined.
if (data->packages() != NULL) {
if (data->packages() != nullptr) {
data->packages()->purge_all_package_exports();
}
if (data->modules_defined()) {
@ -557,10 +557,10 @@ void ClassLoaderDataGraph::clean_module_and_package_info() {
void ClassLoaderDataGraph::purge(bool at_safepoint) {
ClassLoaderData* list = _unloading;
_unloading = NULL;
_unloading = nullptr;
ClassLoaderData* next = list;
bool classes_unloaded = false;
while (next != NULL) {
while (next != nullptr) {
ClassLoaderData* purge_me = next;
next = purge_me->next();
delete purge_me;
@ -591,16 +591,16 @@ void ClassLoaderDataGraph::purge(bool at_safepoint) {
}
ClassLoaderDataGraphKlassIteratorAtomic::ClassLoaderDataGraphKlassIteratorAtomic()
: _next_klass(NULL) {
: _next_klass(nullptr) {
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
ClassLoaderData* cld = ClassLoaderDataGraph::_head;
Klass* klass = NULL;
Klass* klass = nullptr;
// Find the first klass in the CLDG.
while (cld != NULL) {
while (cld != nullptr) {
assert_locked_or_safepoint(cld->metaspace_lock());
klass = cld->_klasses;
if (klass != NULL) {
if (klass != nullptr) {
_next_klass = klass;
return;
}
@ -610,16 +610,16 @@ ClassLoaderDataGraphKlassIteratorAtomic::ClassLoaderDataGraphKlassIteratorAtomic
Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass_in_cldg(Klass* klass) {
Klass* next = klass->next_link();
if (next != NULL) {
if (next != nullptr) {
return next;
}
// No more klasses in the current CLD. Time to find a new CLD.
ClassLoaderData* cld = klass->class_loader_data();
assert_locked_or_safepoint(cld->metaspace_lock());
while (next == NULL) {
while (next == nullptr) {
cld = cld->next();
if (cld == NULL) {
if (cld == nullptr) {
break;
}
next = cld->_klasses;
@ -631,7 +631,7 @@ Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass_in_cldg(Klass* klass)
Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass() {
Klass* head = _next_klass;
while (head != NULL) {
while (head != nullptr) {
Klass* next = next_klass_in_cldg(head);
Klass* old_head = Atomic::cmpxchg(&_next_klass, head, next);
@ -644,8 +644,8 @@ Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass() {
}
// Nothing more for the iterator to hand out.
assert(head == NULL, "head is " PTR_FORMAT ", expected not null:", p2i(head));
return NULL;
assert(head == nullptr, "head is " PTR_FORMAT ", expected not null:", p2i(head));
return nullptr;
}
void ClassLoaderDataGraph::verify() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 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
@ -33,7 +33,7 @@
#include "runtime/orderAccess.hpp"
inline ClassLoaderData *ClassLoaderDataGraph::find_or_create(Handle loader) {
guarantee(loader() != NULL && oopDesc::is_oop(loader()), "Loader must be oop");
guarantee(loader() != nullptr && oopDesc::is_oop(loader()), "Loader must be oop");
// Gets the class loader data out of the java/lang/ClassLoader object, if non-null
// it's already in the loader_data, so no need to add
ClassLoaderData* loader_data = java_lang_ClassLoader::loader_data_acquire(loader());

View File

@ -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
@ -41,15 +41,15 @@ class ArchivedClassLoaderData {
Array<ModuleEntry*>* _modules;
void assert_valid(ClassLoaderData* loader_data) {
// loader_data may be NULL if the boot layer has loaded no modules for the platform or
// loader_data may be null if the boot layer has loaded no modules for the platform or
// system loaders (e.g., if you create a custom JDK image with only java.base).
if (loader_data != NULL) {
if (loader_data != nullptr) {
assert(!loader_data->has_class_mirror_holder(),
"loaders for non-strong hidden classes not supported");
}
}
public:
ArchivedClassLoaderData() : _packages(NULL), _modules(NULL) {}
ArchivedClassLoaderData() : _packages(nullptr), _modules(nullptr) {}
void iterate_symbols(ClassLoaderData* loader_data, MetaspaceClosure* closure);
void allocate(ClassLoaderData* loader_data);
@ -67,12 +67,12 @@ public:
static ArchivedClassLoaderData _archived_boot_loader_data;
static ArchivedClassLoaderData _archived_platform_loader_data;
static ArchivedClassLoaderData _archived_system_loader_data;
static ModuleEntry* _archived_javabase_moduleEntry = NULL;
static ModuleEntry* _archived_javabase_moduleEntry = nullptr;
void ArchivedClassLoaderData::iterate_symbols(ClassLoaderData* loader_data, MetaspaceClosure* closure) {
assert(DumpSharedSpaces, "must be");
assert_valid(loader_data);
if (loader_data != NULL) {
if (loader_data != nullptr) {
loader_data->packages()->iterate_symbols(closure);
loader_data->modules() ->iterate_symbols(closure);
}
@ -81,7 +81,7 @@ void ArchivedClassLoaderData::iterate_symbols(ClassLoaderData* loader_data, Meta
void ArchivedClassLoaderData::allocate(ClassLoaderData* loader_data) {
assert(DumpSharedSpaces, "must be");
assert_valid(loader_data);
if (loader_data != NULL) {
if (loader_data != nullptr) {
// We can't create hashtables at dump time because the hashcode depends on the
// address of the Symbols, which may be relocated at runtime due to ASLR.
// So we store the packages/modules in Arrays. At runtime, we create
@ -94,7 +94,7 @@ void ArchivedClassLoaderData::allocate(ClassLoaderData* loader_data) {
void ArchivedClassLoaderData::init_archived_entries(ClassLoaderData* loader_data) {
assert(DumpSharedSpaces, "must be");
assert_valid(loader_data);
if (loader_data != NULL) {
if (loader_data != nullptr) {
loader_data->packages()->init_archived_entries(_packages);
loader_data->modules() ->init_archived_entries(_modules);
}
@ -103,7 +103,7 @@ void ArchivedClassLoaderData::init_archived_entries(ClassLoaderData* loader_data
void ArchivedClassLoaderData::restore(ClassLoaderData* loader_data, bool do_entries, bool do_oops) {
assert(UseSharedSpaces, "must be");
assert_valid(loader_data);
if (_modules != NULL) { // Could be NULL if we have archived no modules for platform/system loaders
if (_modules != nullptr) { // Could be null if we have archived no modules for platform/system loaders
ModuleEntryTable* modules = loader_data->modules();
PackageEntryTable* packages = loader_data->packages();
@ -120,7 +120,7 @@ void ArchivedClassLoaderData::restore(ClassLoaderData* loader_data, bool do_entr
void ArchivedClassLoaderData::clear_archived_oops() {
assert(UseSharedSpaces, "must be");
if (_modules != NULL) {
if (_modules != nullptr) {
for (int i = 0; i < _modules->length(); i++) {
_modules->at(i)->clear_archived_oops();
}
@ -131,7 +131,7 @@ void ArchivedClassLoaderData::clear_archived_oops() {
static ClassLoaderData* null_class_loader_data() {
ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
assert(loader_data != NULL, "must be");
assert(loader_data != nullptr, "must be");
return loader_data;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
@ -130,9 +130,9 @@ char* ClassLoaderExt::read_manifest(JavaThread* current, ClassPathEntry* entry,
assert(entry->is_jar_file(), "must be");
manifest = (char*) ((ClassPathZipEntry*)entry )->open_entry(current, name, &size, true);
if (manifest == NULL) { // No Manifest
if (manifest == nullptr) { // No Manifest
*manifest_size = 0;
return NULL;
return nullptr;
}
@ -152,7 +152,7 @@ char* ClassLoaderExt::read_manifest(JavaThread* current, ClassPathEntry* entry,
char* ClassLoaderExt::get_class_path_attr(const char* jar_path, char* manifest, jint manifest_size) {
const char* tag = "Class-Path: ";
const int tag_len = (int)strlen(tag);
char* found = NULL;
char* found = nullptr;
char* line_start = manifest;
char* end = manifest + manifest_size;
@ -160,12 +160,12 @@ char* ClassLoaderExt::get_class_path_attr(const char* jar_path, char* manifest,
while (line_start < end) {
char* line_end = strchr(line_start, '\n');
if (line_end == NULL) {
if (line_end == nullptr) {
// JAR spec require the manifest file to be terminated by a new line.
break;
}
if (strncmp(tag, line_start, tag_len) == 0) {
if (found != NULL) {
if (found != nullptr) {
// Same behavior as jdk/src/share/classes/java/util/jar/Attributes.java
// If duplicated entries are found, the last one is used.
log_warning(cds)("Warning: Duplicate name in Manifest: %s.\n"
@ -187,24 +187,24 @@ void ClassLoaderExt::process_jar_manifest(JavaThread* current, ClassPathEntry* e
jint manifest_size;
char* manifest = read_manifest(current, entry, &manifest_size);
if (manifest == NULL) {
if (manifest == nullptr) {
return;
}
if (strstr(manifest, "Extension-List:") != NULL) {
if (strstr(manifest, "Extension-List:") != nullptr) {
vm_exit_during_cds_dumping(err_msg("-Xshare:dump does not support Extension-List in JAR manifest: %s", entry->name()));
}
char* cp_attr = get_class_path_attr(entry->name(), manifest, manifest_size);
if (cp_attr != NULL && strlen(cp_attr) > 0) {
if (cp_attr != nullptr && strlen(cp_attr) > 0) {
trace_class_path("found Class-Path: ", cp_attr);
char sep = os::file_separator()[0];
const char* dir_name = entry->name();
const char* dir_tail = strrchr(dir_name, sep);
int dir_len;
if (dir_tail == NULL) {
if (dir_tail == nullptr) {
dir_len = 0;
} else {
dir_len = dir_tail - dir_name + 1;
@ -216,7 +216,7 @@ void ClassLoaderExt::process_jar_manifest(JavaThread* current, ClassPathEntry* e
while (file_start < end) {
char* file_end = strchr(file_start, ' ');
if (file_end != NULL) {
if (file_end != nullptr) {
*file_end = 0;
file_end += 1;
} else {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -48,8 +48,8 @@ ClassLoaderHierarchyDCmd::ClassLoaderHierarchyDCmd(outputStream* output, bool he
int ClassLoaderHierarchyDCmd::num_arguments() {
ResourceMark rm;
ClassLoaderHierarchyDCmd* dcmd = new ClassLoaderHierarchyDCmd(NULL, false);
if (dcmd != NULL) {
ClassLoaderHierarchyDCmd* dcmd = new ClassLoaderHierarchyDCmd(nullptr, false);
if (dcmd != nullptr) {
DCmdMark mark(dcmd);
return dcmd->_dcmdparser.num_arguments();
} else {
@ -122,7 +122,7 @@ public:
const ClassLoaderData* const _cld;
LoadedClassInfo(Klass* klass, const ClassLoaderData* cld)
: _next(NULL), _klass(klass), _cld(cld) {}
: _next(nullptr), _klass(klass), _cld(cld) {}
};
@ -137,7 +137,7 @@ class LoaderTreeNode : public ResourceObj {
// this parent loader, we fill in all the other details.
const oop _loader_oop;
const ClassLoaderData* _cld; // May be NULL if loader never loaded anything
const ClassLoaderData* _cld; // May be null if loader never loaded anything
LoaderTreeNode* _child;
LoaderTreeNode* _next;
@ -154,31 +154,31 @@ class LoaderTreeNode : public ResourceObj {
// one.
int _num_folded;
// Returns Klass of loader; NULL for bootstrap loader
// Returns Klass of loader; null for bootstrap loader
const Klass* loader_klass() const {
return (_loader_oop != NULL) ? _loader_oop->klass() : NULL;
return (_loader_oop != nullptr) ? _loader_oop->klass() : nullptr;
}
// Returns ResourceArea-allocated class name of loader class; "" if there is no klass (bootstrap loader)
const char* loader_class_name() const {
const Klass* klass = loader_klass();
return klass != NULL ? klass->external_name() : "";
return klass != nullptr ? klass->external_name() : "";
}
// Returns oop of loader name; NULL for bootstrap; NULL if no name was set
// Returns oop of loader name; null for bootstrap; null if no name was set
oop loader_name_oop() const {
return (_loader_oop != NULL) ? java_lang_ClassLoader::name(_loader_oop) : NULL;
return (_loader_oop != nullptr) ? java_lang_ClassLoader::name(_loader_oop) : nullptr;
}
// Returns ResourceArea-allocated name of loader, "" if none is set
const char* loader_name() const {
oop name_oop = loader_name_oop();
return name_oop != NULL ? java_lang_String::as_utf8_string(name_oop) : "";
return name_oop != nullptr ? java_lang_String::as_utf8_string(name_oop) : "";
}
bool is_bootstrap() const {
if (_loader_oop == NULL) {
assert(_cld != NULL && _cld->is_boot_class_loader_data(), "bootstrap loader must have CLD");
if (_loader_oop == nullptr) {
assert(_cld != nullptr && _cld->is_boot_class_loader_data(), "bootstrap loader must have CLD");
return true;
}
return false;
@ -215,13 +215,13 @@ class LoaderTreeNode : public ResourceObj {
// Output following this node (node details and child nodes) - up to the next sibling node
// needs to be prefixed with "|" if there is a follow up sibling.
const bool have_sibling = _next != NULL;
const bool have_sibling = _next != nullptr;
BranchTracker::Mark trm(branchtracker, have_sibling);
{
// optional node details following this node needs to be prefixed with "|"
// if there are follow up child nodes.
const bool have_child = _child != NULL;
const bool have_child = _child != nullptr;
BranchTracker::Mark trm(branchtracker, have_child);
// Empty line
@ -244,8 +244,8 @@ class LoaderTreeNode : public ResourceObj {
}
if (print_classes) {
if (_classes != NULL) {
assert(_cld != NULL, "we have classes, we should have a CLD");
if (_classes != nullptr) {
assert(_cld != nullptr, "we have classes, we should have a CLD");
for (LoadedClassInfo* lci = _classes; lci; lci = lci->_next) {
// non-strong hidden classes should not live in
// the primary CLD of their loaders.
@ -269,8 +269,8 @@ class LoaderTreeNode : public ResourceObj {
st->cr();
}
if (_hidden_classes != NULL) {
assert(_cld != NULL, "we have classes, we should have a CLD");
if (_hidden_classes != nullptr) {
assert(_cld != nullptr, "we have classes, we should have a CLD");
for (LoadedClassInfo* lci = _hidden_classes; lci; lci = lci->_next) {
branchtracker.print(st);
if (lci == _hidden_classes) { // first iteration
@ -303,7 +303,7 @@ class LoaderTreeNode : public ResourceObj {
// Print children, recursively
LoaderTreeNode* c = _child;
while (c != NULL) {
while (c != nullptr) {
c->print_with_child_nodes(st, branchtracker, print_classes, verbose);
c = c->_next;
}
@ -318,7 +318,7 @@ class LoaderTreeNode : public ResourceObj {
// Must have the same non-null klass
const Klass* k = loader_klass();
if (k == NULL || k != target_node->loader_klass()) {
if (k == nullptr || k != target_node->loader_klass()) {
return false;
}
@ -333,13 +333,13 @@ class LoaderTreeNode : public ResourceObj {
public:
LoaderTreeNode(const oop loader_oop)
: _loader_oop(loader_oop), _cld(NULL), _child(NULL), _next(NULL),
_classes(NULL), _num_classes(0), _hidden_classes(NULL),
: _loader_oop(loader_oop), _cld(nullptr), _child(nullptr), _next(nullptr),
_classes(nullptr), _num_classes(0), _hidden_classes(nullptr),
_num_hidden_classes(0), _num_folded(0)
{}
void set_cld(const ClassLoaderData* cld) {
assert(_cld == NULL, "there should be only one primary CLD per loader");
assert(_cld == nullptr, "there should be only one primary CLD per loader");
_cld = cld;
}
@ -349,7 +349,7 @@ public:
}
void add_sibling(LoaderTreeNode* info) {
assert(info->_next == NULL, "must be");
assert(info->_next == nullptr, "must be");
info->_next = _next;
_next = info;
}
@ -363,7 +363,7 @@ public:
p_list_to_add_to = &_classes;
}
// Search tail.
while ((*p_list_to_add_to) != NULL) {
while ((*p_list_to_add_to) != nullptr) {
p_list_to_add_to = &(*p_list_to_add_to)->_next;
}
*p_list_to_add_to = first_class;
@ -375,12 +375,12 @@ public:
}
LoaderTreeNode* find(const oop loader_oop) {
LoaderTreeNode* result = NULL;
LoaderTreeNode* result = nullptr;
if (_loader_oop == loader_oop) {
result = this;
} else {
LoaderTreeNode* c = _child;
while (c != NULL && result == NULL) {
while (c != nullptr && result == nullptr) {
result = c->find(loader_oop);
c = c->_next;
}
@ -388,20 +388,20 @@ public:
return result;
}
bool is_leaf() const { return _child == NULL; }
bool is_leaf() const { return _child == nullptr; }
// Attempt to fold similar nodes among this node's children. We only fold leaf nodes
// (no child class loaders).
// For non-leaf nodes (class loaders with child class loaders), do this recursively.
void fold_children() {
LoaderTreeNode* node = _child;
LoaderTreeNode* prev = NULL;
LoaderTreeNode* prev = nullptr;
ResourceMark rm;
while (node != NULL) {
LoaderTreeNode* matching_node = NULL;
while (node != nullptr) {
LoaderTreeNode* matching_node = nullptr;
if (node->is_leaf()) {
// Look among the preceding node siblings for a match.
for (LoaderTreeNode* node2 = _child; node2 != node && matching_node == NULL;
for (LoaderTreeNode* node2 = _child; node2 != node && matching_node == nullptr;
node2 = node2->_next) {
if (node2->is_leaf() && node->can_fold_into(node2)) {
matching_node = node2;
@ -410,10 +410,10 @@ public:
} else {
node->fold_children();
}
if (matching_node != NULL) {
if (matching_node != nullptr) {
// Increase fold count for the matching node and remove folded node from the child list.
matching_node->_num_folded ++;
assert(prev != NULL, "Sanity"); // can never happen since we do not fold the first node.
assert(prev != nullptr, "Sanity"); // can never happen since we do not fold the first node.
prev->_next = node->_next;
} else {
prev = node;
@ -435,7 +435,7 @@ public:
const ClassLoaderData* _cld;
int _num_classes;
LoadedClassCollectClosure(const ClassLoaderData* cld)
: _list(NULL), _cld(cld), _num_classes(0) {}
: _list(nullptr), _cld(cld), _num_classes(0) {}
void do_klass(Klass* k) {
LoadedClassInfo* lki = new LoadedClassInfo(k, _cld);
lki->_next = _list;
@ -451,7 +451,7 @@ class LoaderInfoScanClosure : public CLDClosure {
LoaderTreeNode* _root;
static void fill_in_classes(LoaderTreeNode* info, const ClassLoaderData* cld) {
assert(info != NULL && cld != NULL, "must be");
assert(info != nullptr && cld != nullptr, "must be");
LoadedClassCollectClosure lccc(cld);
const_cast<ClassLoaderData*>(cld)->classes_do(&lccc);
if (lccc._num_classes > 0) {
@ -461,30 +461,30 @@ class LoaderInfoScanClosure : public CLDClosure {
LoaderTreeNode* find_node_or_add_empty_node(oop loader_oop) {
assert(_root != NULL, "root node must exist");
assert(_root != nullptr, "root node must exist");
if (loader_oop == NULL) {
if (loader_oop == nullptr) {
return _root;
}
// Check if a node for this oop already exists.
LoaderTreeNode* info = _root->find(loader_oop);
if (info == NULL) {
if (info == nullptr) {
// It does not. Create a node.
info = new LoaderTreeNode(loader_oop);
// Add it to tree.
LoaderTreeNode* parent_info = NULL;
LoaderTreeNode* parent_info = nullptr;
// Recursively add parent nodes if needed.
const oop parent_oop = java_lang_ClassLoader::parent(loader_oop);
if (parent_oop == NULL) {
if (parent_oop == nullptr) {
parent_info = _root;
} else {
parent_info = find_node_or_add_empty_node(parent_oop);
}
assert(parent_info != NULL, "must be");
assert(parent_info != nullptr, "must be");
parent_info->add_child(info);
}
@ -494,8 +494,8 @@ class LoaderInfoScanClosure : public CLDClosure {
public:
LoaderInfoScanClosure(bool print_classes, bool verbose)
: _print_classes(print_classes), _verbose(verbose), _root(NULL) {
_root = new LoaderTreeNode(NULL);
: _print_classes(print_classes), _verbose(verbose), _root(nullptr) {
_root = new LoaderTreeNode(nullptr);
}
void print_results(outputStream* st) const {
@ -512,7 +512,7 @@ public:
const oop loader_oop = cld->class_loader();
LoaderTreeNode* info = find_node_or_add_empty_node(loader_oop);
assert(info != NULL, "must be");
assert(info != nullptr, "must be");
// Update CLD in node, but only if this is the primary CLD for this loader.
if (cld->has_class_mirror_holder() == false) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -48,7 +48,7 @@ public:
}
static const JavaPermission permission() {
JavaPermission p = {"java.lang.management.ManagementPermission",
"monitor", NULL};
"monitor", nullptr};
return p;
}
static int num_arguments();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
@ -65,7 +65,7 @@ void ClassLoaderStatsClosure::do_cld(ClassLoaderData* cld) {
cls->_cld = cld;
}
if (cl != NULL) {
if (cl != nullptr) {
cls->_parent = java_lang_ClassLoader::parent_no_keepalive(cl);
addEmptyParents(cls->_parent);
}
@ -83,7 +83,7 @@ void ClassLoaderStatsClosure::do_cld(ClassLoaderData* cld) {
_total_classes += csc._num_classes;
ClassLoaderMetaspace* ms = cld->metaspace_or_null();
if (ms != NULL) {
if (ms != nullptr) {
size_t used_bytes, capacity_bytes;
ms->calculate_jfr_stats(&used_bytes, &capacity_bytes);
if(cld->has_class_mirror_holder()) {
@ -108,14 +108,14 @@ void ClassLoaderStatsClosure::do_cld(ClassLoaderData* cld) {
bool ClassLoaderStatsClosure::do_entry(oop const& key, ClassLoaderStats const& cls) {
Klass* class_loader_klass = (cls._class_loader == NULL ? NULL : cls._class_loader->klass());
Klass* parent_klass = (cls._parent == NULL ? NULL : cls._parent->klass());
Klass* class_loader_klass = (cls._class_loader == nullptr ? nullptr : cls._class_loader->klass());
Klass* parent_klass = (cls._parent == nullptr ? nullptr : cls._parent->klass());
_out->print(INTPTR_FORMAT " " INTPTR_FORMAT " " INTPTR_FORMAT " " UINTX_FORMAT_W(6) " " SIZE_FORMAT_W(8) " " SIZE_FORMAT_W(8) " ",
p2i(class_loader_klass), p2i(parent_klass), p2i(cls._cld),
cls._classes_count,
cls._chunk_sz, cls._block_sz);
if (class_loader_klass != NULL) {
if (class_loader_klass != nullptr) {
_out->print("%s", class_loader_klass->external_name());
} else {
_out->print("<boot class loader>");
@ -146,7 +146,7 @@ void ClassLoaderStatsClosure::print() {
void ClassLoaderStatsClosure::addEmptyParents(oop cl) {
while (cl != NULL && java_lang_ClassLoader::loader_data_acquire(cl) == NULL) {
while (cl != nullptr && java_lang_ClassLoader::loader_data_acquire(cl) == nullptr) {
// This classloader has not loaded any classes
bool added = false;
ClassLoaderStats* cls = _stats->put_if_absent(cl, &added);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
@ -61,7 +61,7 @@ public:
static const JavaPermission permission() {
JavaPermission p = {"java.lang.management.ManagementPermission",
"monitor", NULL};
"monitor", nullptr};
return p;
}
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 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
@ -77,7 +77,7 @@ public:
}
static bool match(const char* pattern, Symbol* sym) {
return (pattern == NULL || sym->is_star_match(pattern));
return (pattern == nullptr || sym->is_star_match(pattern));
}
void print_klass_name(InstanceKlass* ik) {
@ -147,7 +147,7 @@ void ClassPrinter::print_flags_help(outputStream* os) {
}
void ClassPrinter::print_classes(const char* class_name_pattern, int flags, outputStream* os) {
KlassPrintClosure closure(class_name_pattern, NULL, NULL, true, flags, os);
KlassPrintClosure closure(class_name_pattern, nullptr, nullptr, true, flags, os);
ClassLoaderDataGraph::classes_do(&closure);
}
@ -158,9 +158,9 @@ void ClassPrinter::print_methods(const char* class_name_pattern,
const char* method_signature_pattern;
const char* colon = strchr(method_pattern, ':');
if (colon == NULL) {
if (colon == nullptr) {
method_name_pattern = method_pattern;
method_signature_pattern = NULL;
method_signature_pattern = nullptr;
} else {
ptrdiff_t name_pat_len = colon - method_pattern;
assert(name_pat_len >= 0, "sanity");

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
@ -56,8 +56,8 @@ CompactHashtableWriter::CompactHashtableWriter(int num_entries,
}
_stats = stats;
_compact_buckets = NULL;
_compact_entries = NULL;
_compact_buckets = nullptr;
_compact_entries = nullptr;
_num_empty_buckets = 0;
_num_value_only_buckets = 0;
_num_other_buckets = 0;
@ -239,8 +239,8 @@ HashtableTextDump::HashtableTextDump(const char* filename) : _fd(-1) {
if (_fd < 0) {
quit("Unable to open hashtable dump file", filename);
}
_base = os::map_memory(_fd, filename, 0, NULL, _size, true, false);
if (_base == NULL) {
_base = os::map_memory(_fd, filename, 0, nullptr, _size, true, false);
if (_base == nullptr) {
quit("Unable to map hashtable dump file", filename);
}
_p = _base;

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
@ -279,7 +279,7 @@ public:
}
}
}
return NULL;
return nullptr;
}
template <class ITER>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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
@ -84,7 +84,7 @@ static void print_method(outputStream* str, Method* mo, bool with_class=true) {
*
* Bare minimum needed to be an ALGO class:
* class Algo : public HierarchyVisitor<Algo> {
* void* new_node_data() { return NULL; }
* void* new_node_data() { return nullptr; }
* void free_node_data(void* data) { return; }
* bool visit() { return true; }
* };
@ -138,7 +138,7 @@ class HierarchyVisitor : StackObj {
Node* current_top() const { return _path.top(); }
bool has_more_nodes() const { return _path.length() > 0; }
void push(InstanceKlass* cls, ALGO* algo) {
assert(cls != NULL, "Requires a valid instance class");
assert(cls != nullptr, "Requires a valid instance class");
if (cls == vmClasses::Object_klass()) {
_visited_Object = true;
}
@ -163,11 +163,11 @@ class HierarchyVisitor : StackObj {
// only ensures we don't then repeatedly enqueue Object for each interface
// in the class hierarchy.
bool has_super(InstanceKlass* cls) {
return cls->super() != NULL && (!_visited_Object || !cls->is_interface());
return cls->super() != nullptr && (!_visited_Object || !cls->is_interface());
}
Node* node_at_depth(int i) const {
return (i >= _path.length()) ? NULL : _path.at(_path.length() - i - 1);
return (i >= _path.length()) ? nullptr : _path.at(_path.length() - i - 1);
}
protected:
@ -182,13 +182,13 @@ class HierarchyVisitor : StackObj {
InstanceKlass* class_at_depth(int i) {
Node* n = node_at_depth(i);
return n == NULL ? NULL : n->_class;
return n == nullptr ? nullptr : n->_class;
}
InstanceKlass* current_class() { return class_at_depth(0); }
void* data_at_depth(int i) {
Node* n = node_at_depth(i);
return n == NULL ? NULL : n->_algorithm_data;
return n == nullptr ? nullptr : n->_algorithm_data;
}
void* current_data() { return data_at_depth(0); }
@ -216,7 +216,7 @@ class HierarchyVisitor : StackObj {
algo->free_node_data(top->_algorithm_data);
pop();
} else {
InstanceKlass* next = NULL;
InstanceKlass* next = nullptr;
if (top->has_visited_super() == false) {
next = top->next_super();
top->set_super_visited();
@ -224,7 +224,7 @@ class HierarchyVisitor : StackObj {
next = top->next_interface();
top->increment_visited_interface();
}
assert(next != NULL, "Otherwise we shouldn't be here");
assert(next != nullptr, "Otherwise we shouldn't be here");
push(next, algo);
top_needs_visit = true;
}
@ -243,7 +243,7 @@ class PrintHierarchy : public HierarchyVisitor<PrintHierarchy> {
return true;
}
void* new_node_data() { return NULL; }
void* new_node_data() { return nullptr; }
void free_node_data(void* data) { return; }
PrintHierarchy(outputStream* st = tty) : _st(st) {}
@ -291,7 +291,7 @@ class KeepAliveVisitor : public HierarchyVisitor<KeepAliveVisitor> {
public:
KeepAliveVisitor(KeepAliveRegistrar* registrar) : _registrar(registrar) {}
void* new_node_data() { return NULL; }
void* new_node_data() { return nullptr; }
void free_node_data(void* data) { return; }
bool visit() {
@ -313,7 +313,7 @@ class MethodState {
Method* _method;
QualifiedState _state;
MethodState() : _method(NULL), _state(DISQUALIFIED) {}
MethodState() : _method(nullptr), _state(DISQUALIFIED) {}
MethodState(Method* method, QualifiedState state) : _method(method), _state(state) {}
};
@ -332,7 +332,7 @@ class MethodFamily : public ResourceObj {
return &_members.at(i);
}
}
return NULL;
return nullptr;
}
void add_method(Method* method, QualifiedState state) {
@ -347,10 +347,10 @@ class MethodFamily : public ResourceObj {
public:
MethodFamily()
: _selected_target(NULL), _exception_message(NULL), _exception_name(NULL) {}
: _selected_target(nullptr), _exception_message(nullptr), _exception_name(nullptr) {}
void set_target_if_empty(Method* m) {
if (_selected_target == NULL && !m->is_overpass()) {
if (_selected_target == nullptr && !m->is_overpass()) {
_selected_target = m;
}
}
@ -360,15 +360,15 @@ class MethodFamily : public ResourceObj {
// as is if state is qualified, or set it to disqualified if state is
// disqualified.
MethodState* method_state = find_method(m);
if (method_state == NULL) {
if (method_state == nullptr) {
add_method(m, state);
} else if (state == DISQUALIFIED) {
method_state->_state = DISQUALIFIED;
}
}
bool has_target() const { return _selected_target != NULL; }
bool throws_exception() { return _exception_message != NULL; }
bool has_target() const { return _selected_target != nullptr; }
bool throws_exception() { return _exception_message != nullptr; }
Method* get_selected_target() { return _selected_target; }
Symbol* get_exception_message() { return _exception_message; }
@ -419,7 +419,7 @@ class MethodFamily : public ResourceObj {
if (qualified_methods.length() == 0) {
_exception_message = generate_no_defaults_message();
} else {
assert(root != NULL, "Null root class");
assert(root != nullptr, "Null root class");
_exception_message = generate_method_message(root->name(), qualified_methods.at(0));
}
_exception_name = vmSymbols::java_lang_AbstractMethodError();
@ -449,7 +449,7 @@ class MethodFamily : public ResourceObj {
void print_exception(outputStream* str, int indent) {
assert(throws_exception(), "Should be called otherwise");
assert(_exception_name != NULL, "exception_name should be set");
assert(_exception_name != nullptr, "exception_name should be set");
streamIndentor si(str, indent * 2);
str->indent().print_cr("%s: %s", _exception_name->as_C_string(), _exception_message->as_C_string());
}
@ -530,7 +530,7 @@ class StateRestorer : public ResourceObj {
StatefulMethodFamily* _method;
QualifiedState _state_to_restore;
StateRestorer() : _method(NULL), _state_to_restore(DISQUALIFIED) {}
StateRestorer() : _method(nullptr), _state_to_restore(DISQUALIFIED) {}
void restore_state() { _method->set_qualification_state(_state_to_restore); }
};
@ -595,14 +595,14 @@ class EmptyVtableSlot : public ResourceObj {
public:
EmptyVtableSlot(Method* method)
: _name(method->name()), _signature(method->signature()),
_size_of_parameters(method->size_of_parameters()), _binding(NULL) {}
_size_of_parameters(method->size_of_parameters()), _binding(nullptr) {}
Symbol* name() const { return _name; }
Symbol* signature() const { return _signature; }
int size_of_parameters() const { return _size_of_parameters; }
void bind_family(MethodFamily* lm) { _binding = lm; }
bool is_bound() { return _binding != NULL; }
bool is_bound() { return _binding != nullptr; }
MethodFamily* get_binding() { return _binding; }
void print_on(outputStream* str) const {
@ -625,7 +625,7 @@ static bool already_in_vtable_slots(GrowableArray<EmptyVtableSlot*>* slots, Meth
static void find_empty_vtable_slots(GrowableArray<EmptyVtableSlot*>* slots,
InstanceKlass* klass, const GrowableArray<Method*>* mirandas) {
assert(klass != NULL, "Must be valid class");
assert(klass != nullptr, "Must be valid class");
// All miranda methods are obvious candidates
for (int i = 0; i < mirandas->length(); ++i) {
@ -638,7 +638,7 @@ static void find_empty_vtable_slots(GrowableArray<EmptyVtableSlot*>* slots,
// Also any overpasses in our superclasses, that we haven't implemented.
// (can't use the vtable because it is not guaranteed to be initialized yet)
InstanceKlass* super = klass->java_super();
while (super != NULL) {
while (super != nullptr) {
for (int i = 0; i < super->methods()->length(); ++i) {
Method* m = super->methods()->at(i);
if (m->is_overpass() || m->is_static()) {
@ -648,7 +648,7 @@ static void find_empty_vtable_slots(GrowableArray<EmptyVtableSlot*>* slots,
// unless we have a real implementation of it in the current class.
if (!already_in_vtable_slots(slots, m)) {
Method *impl = klass->lookup_method(m->name(), m->signature());
if (impl == NULL || impl->is_overpass() || impl->is_static()) {
if (impl == nullptr || impl->is_overpass() || impl->is_static()) {
slots->append(new EmptyVtableSlot(m));
}
}
@ -656,7 +656,7 @@ static void find_empty_vtable_slots(GrowableArray<EmptyVtableSlot*>* slots,
}
// also any default methods in our superclasses
if (super->default_methods() != NULL) {
if (super->default_methods() != nullptr) {
for (int i = 0; i < super->default_methods()->length(); ++i) {
Method* m = super->default_methods()->at(i);
// m is a method that would have been a miranda if not for the
@ -665,7 +665,7 @@ static void find_empty_vtable_slots(GrowableArray<EmptyVtableSlot*>* slots,
// unless we have a real implementation of it in the current class.
if (!already_in_vtable_slots(slots, m)) {
Method* impl = klass->lookup_method(m->name(), m->signature());
if (impl == NULL || impl->is_overpass() || impl->is_static()) {
if (impl == nullptr || impl->is_overpass() || impl->is_static()) {
slots->append(new EmptyVtableSlot(m));
}
}
@ -707,15 +707,15 @@ class FindMethodsByErasedSig : public HierarchyVisitor<FindMethodsByErasedSig> {
reset();
_method_name = name;
_method_signature = signature;
_family = NULL;
_family = nullptr;
_cur_class_is_interface = is_interf;
}
void get_discovered_family(MethodFamily** family) {
if (_family != NULL) {
if (_family != nullptr) {
*family = _family->get_method_family();
} else {
*family = NULL;
*family = nullptr;
}
}
@ -750,9 +750,9 @@ class FindMethodsByErasedSig : public HierarchyVisitor<FindMethodsByErasedSig> {
// Non-public methods in java.lang.Object are not candidates for default
// methods.
// Future: take access controls into account for superclass methods
if (m != NULL && !m->is_static() && !m->is_overpass() && !m->is_private() &&
if (m != nullptr && !m->is_static() && !m->is_overpass() && !m->is_private() &&
(!_cur_class_is_interface || !SystemDictionary::is_nonpublic_Object_method(m))) {
if (_family == NULL) {
if (_family == nullptr) {
_family = new StatefulMethodFamily();
}
@ -790,7 +790,7 @@ static void generate_erased_defaults(
MethodFamily* family;
visitor->get_discovered_family(&family);
if (family != NULL) {
if (family != nullptr) {
family->determine_target_or_set_exception_message(klass);
slot->bind_family(family);
}
@ -815,7 +815,7 @@ static void create_default_methods( InstanceKlass* klass,
// The JVM does not create bridges nor handle generic signatures here.
void DefaultMethods::generate_default_methods(
InstanceKlass* klass, const GrowableArray<Method*>* mirandas, TRAPS) {
assert(klass != NULL, "invariant");
assert(klass != nullptr, "invariant");
assert(klass != vmClasses::Object_klass(), "Shouldn't be called for Object");
// This resource mark is the bound for all memory allocation that takes
@ -891,7 +891,7 @@ static Method* new_method(
int code_length = 0;
InlineTableSizes sizes;
if (bytecodes != NULL && bytecodes->length() > 0) {
if (bytecodes != nullptr && bytecodes->length() > 0) {
code_start = static_cast<address>(bytecodes->adr_at(0));
code_length = bytecodes->length();
}
@ -900,14 +900,14 @@ static Method* new_method(
code_length, flags, &sizes,
mt, name, CHECK_NULL);
m->set_constants(NULL); // This will get filled in later
m->set_constants(nullptr); // This will get filled in later
m->set_name_index(cp->utf8(name));
m->set_signature_index(cp->utf8(sig));
m->compute_from_signature(sig);
m->set_size_of_parameters(params);
m->set_max_stack(max_stack);
m->set_max_locals(params);
m->constMethod()->set_stackmap_data(NULL);
m->constMethod()->set_stackmap_data(nullptr);
m->set_code(code_start);
return m;
@ -956,7 +956,7 @@ static void create_defaults_and_exceptions(GrowableArray<EmptyVtableSlot*>* slot
GrowableArray<Method*> defaults;
BytecodeConstantPool bpool(klass->constants());
BytecodeBuffer* buffer = NULL; // Lazily create a reusable buffer
BytecodeBuffer* buffer = nullptr; // Lazily create a reusable buffer
for (int i = 0; i < slots->length(); ++i) {
EmptyVtableSlot* slot = slots->at(i);
@ -984,7 +984,7 @@ static void create_defaults_and_exceptions(GrowableArray<EmptyVtableSlot*>* slot
defaults.push(selected);
}
} else if (method->throws_exception()) {
if (buffer == NULL) {
if (buffer == nullptr) {
buffer = new BytecodeBuffer();
} else {
buffer->clear();
@ -998,7 +998,7 @@ static void create_defaults_and_exceptions(GrowableArray<EmptyVtableSlot*>* slot
ConstMethod::OVERPASS, CHECK);
// We push to the methods list:
// overpass methods which are exception throwing methods
if (m != NULL) {
if (m != nullptr) {
overpasses.push(m);
}
}
@ -1023,7 +1023,7 @@ static void create_default_methods(InstanceKlass* klass,
int new_size = new_methods->length();
Array<Method*>* total_default_methods = MetadataFactory::new_array<Method*>(
klass->class_loader_data(), new_size, NULL, CHECK);
klass->class_loader_data(), new_size, nullptr, CHECK);
for (int index = 0; index < new_size; index++ ) {
total_default_methods->at_put(index, new_methods->at(index));
}
@ -1076,7 +1076,7 @@ static void merge_in_new_methods(InstanceKlass* klass,
int new_size = klass->methods()->length() + new_methods->length();
Array<Method*>* merged_methods = MetadataFactory::new_array<Method*>(
klass->class_loader_data(), new_size, NULL, CHECK);
klass->class_loader_data(), new_size, nullptr, CHECK);
// original_ordering might be empty if this class has no methods of its own
if (JvmtiExport::can_maintain_original_method_order() || Arguments::is_dumping_archive()) {
@ -1092,8 +1092,8 @@ static void merge_in_new_methods(InstanceKlass* klass,
int new_idx = 0;
for (int i = 0; i < new_size; ++i) {
Method* orig_method = NULL;
Method* new_method = NULL;
Method* orig_method = nullptr;
Method* new_method = nullptr;
if (orig_idx < original_methods->length()) {
orig_method = original_methods->at(orig_idx);
}
@ -1101,12 +1101,12 @@ static void merge_in_new_methods(InstanceKlass* klass,
new_method = new_methods->at(new_idx);
}
if (orig_method != NULL &&
(new_method == NULL || orig_method->name() < new_method->name())) {
if (orig_method != nullptr &&
(new_method == nullptr || orig_method->name() < new_method->name())) {
merged_methods->at_put(i, orig_method);
original_methods->at_put(orig_idx, NULL);
original_methods->at_put(orig_idx, nullptr);
if (merged_ordering->length() > 0) {
assert(original_ordering != NULL && original_ordering->length() > 0,
assert(original_ordering != nullptr && original_ordering->length() > 0,
"should have original order information for this method");
merged_ordering->at_put(i, original_ordering->at(orig_idx));
}
@ -1144,7 +1144,7 @@ static void merge_in_new_methods(InstanceKlass* klass,
if (original_methods->length() > 0) {
MetadataFactory::free_array(cld, original_methods);
}
if (original_ordering != NULL && original_ordering->length() > 0) {
if (original_ordering != nullptr && original_ordering->length() > 0) {
MetadataFactory::free_array(cld, original_ordering);
}
}

View File

@ -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
@ -90,7 +90,7 @@ DictionaryEntry::~DictionaryEntry() {
// pd_set is accessed during a safepoint.
// This doesn't require a lock because nothing is reading this
// entry anymore. The ClassLoader is dead.
while (pd_set_acquire() != NULL) {
while (pd_set_acquire() != nullptr) {
ProtectionDomainEntry* to_delete = pd_set_acquire();
release_set_pd_set(to_delete->next_acquire());
delete to_delete;
@ -110,7 +110,7 @@ bool Dictionary::check_if_needs_resize() {
bool DictionaryEntry::is_valid_protection_domain(Handle protection_domain) {
return protection_domain() == NULL || !java_lang_System::allow_security_manager()
return protection_domain() == nullptr || !java_lang_System::allow_security_manager()
? true
: contains_protection_domain(protection_domain());
}
@ -133,7 +133,7 @@ bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
// Ensure this doesn't show up in the pd_set (invariant)
bool in_pd_set = false;
for (ProtectionDomainEntry* current = pd_set_acquire();
current != NULL;
current != nullptr;
current = current->next_acquire()) {
if (current->object_no_keepalive() == protection_domain) {
in_pd_set = true;
@ -153,7 +153,7 @@ bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
}
for (ProtectionDomainEntry* current = pd_set_acquire();
current != NULL;
current != nullptr;
current = current->next_acquire()) {
if (current->object_no_keepalive() == protection_domain) {
return true;
@ -240,7 +240,7 @@ public:
void Dictionary::add_klass(JavaThread* current, Symbol* class_name,
InstanceKlass* obj) {
assert_locked_or_safepoint(SystemDictionary_lock); // doesn't matter now
assert(obj != NULL, "adding NULL obj");
assert(obj != nullptr, "adding nullptr obj");
assert(obj->name() == class_name, "sanity check on name");
DictionaryEntry* entry = new DictionaryEntry(obj);
@ -296,10 +296,10 @@ InstanceKlass* Dictionary::find(Thread* current, Symbol* name,
NoSafepointVerifier nsv;
DictionaryEntry* entry = get_entry(current, name);
if (entry != NULL && entry->is_valid_protection_domain(protection_domain)) {
if (entry != nullptr && entry->is_valid_protection_domain(protection_domain)) {
return entry->instance_klass();
} else {
return NULL;
return nullptr;
}
}
@ -307,7 +307,7 @@ InstanceKlass* Dictionary::find_class(Thread* current,
Symbol* name) {
assert_locked_or_safepoint(SystemDictionary_lock);
DictionaryEntry* entry = get_entry(current, name);
return (entry != NULL) ? entry->instance_klass() : NULL;
return (entry != nullptr) ? entry->instance_klass() : nullptr;
}
void Dictionary::add_protection_domain(JavaThread* current,
@ -317,8 +317,8 @@ void Dictionary::add_protection_domain(JavaThread* current,
Symbol* klass_name = klass->name();
DictionaryEntry* entry = get_entry(current, klass_name);
assert(entry != NULL,"entry must be present, we just created it");
assert(protection_domain() != NULL,
assert(entry != nullptr,"entry must be present, we just created it");
assert(protection_domain() != nullptr,
"real protection domain should be present");
entry->add_protection_domain(loader_data(), protection_domain);
@ -344,8 +344,8 @@ void Dictionary::validate_protection_domain(InstanceKlass* klass,
Handle protection_domain,
TRAPS) {
assert(class_loader() != NULL, "Should not call this");
assert(protection_domain() != NULL, "Should not call this");
assert(class_loader() != nullptr, "Should not call this");
assert(protection_domain() != nullptr, "Should not call this");
if (!java_lang_System::allow_security_manager() ||
is_valid_protection_domain(THREAD, klass->name(), protection_domain)) {
@ -422,9 +422,9 @@ void Dictionary::clean_cached_protection_domains(GrowableArray<ProtectionDomainE
Klass* e = probe->instance_klass();
ProtectionDomainEntry* current = probe->pd_set_acquire();
ProtectionDomainEntry* prev = NULL;
while (current != NULL) {
if (current->object_no_keepalive() == NULL) {
ProtectionDomainEntry* prev = nullptr;
while (current != nullptr) {
if (current->object_no_keepalive() == nullptr) {
LogTarget(Debug, protectiondomain) lt;
if (lt.is_enabled()) {
ResourceMark rm;
@ -438,7 +438,7 @@ void Dictionary::clean_cached_protection_domains(GrowableArray<ProtectionDomainE
if (probe->pd_set_acquire() == current) {
probe->release_set_pd_set(current->next_acquire());
} else {
assert(prev != NULL, "should be set by alive entry");
assert(prev != nullptr, "should be set by alive entry");
prev->release_set_next(current->next_acquire());
}
// Mark current for deletion but in the meantime it can still be
@ -459,7 +459,7 @@ void Dictionary::clean_cached_protection_domains(GrowableArray<ProtectionDomainE
void DictionaryEntry::verify_protection_domain_set() {
assert(SafepointSynchronize::is_at_safepoint(), "must only be called as safepoint");
for (ProtectionDomainEntry* current = pd_set_acquire(); // accessed at a safepoint
current != NULL;
current != nullptr;
current = current->next_acquire()) {
guarantee(oopDesc::is_oop_or_null(current->object_no_keepalive()), "Invalid oop");
}
@ -469,7 +469,7 @@ void DictionaryEntry::print_count(outputStream *st) {
assert_locked_or_safepoint(SystemDictionary_lock);
int count = 0;
for (ProtectionDomainEntry* current = pd_set_acquire();
current != NULL;
current != nullptr;
current = current->next_acquire()) {
count++;
}
@ -486,7 +486,7 @@ void Dictionary::print_size(outputStream* st) const {
void Dictionary::print_on(outputStream* st) const {
ResourceMark rm;
assert(loader_data() != NULL, "loader data should not be null");
assert(loader_data() != nullptr, "loader data should not be null");
assert(!loader_data()->has_class_mirror_holder(), "cld should have a ClassLoader holder not a Class holder");
print_size(st);
st->print_cr("^ indicates that initiating loader is different from defining loader");
@ -532,7 +532,7 @@ void Dictionary::verify() {
ClassLoaderData* cld = loader_data();
// class loader must be present; a null class loader is the
// bootstrap loader
guarantee(cld != NULL &&
guarantee(cld != nullptr &&
(cld->is_the_null_class_loader_data() || cld->class_loader_no_keepalive()->is_instance()),
"checking type of class_loader");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 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
@ -36,8 +36,8 @@
LayoutRawBlock::LayoutRawBlock(Kind kind, int size) :
_next_block(NULL),
_prev_block(NULL),
_next_block(nullptr),
_prev_block(nullptr),
_kind(kind),
_offset(-1),
_alignment(1),
@ -51,8 +51,8 @@ LayoutRawBlock::LayoutRawBlock(Kind kind, int size) :
LayoutRawBlock::LayoutRawBlock(int index, Kind kind, int size, int alignment, bool is_reference) :
_next_block(NULL),
_prev_block(NULL),
_next_block(nullptr),
_prev_block(nullptr),
_kind(kind),
_offset(-1),
_alignment(alignment),
@ -74,16 +74,16 @@ bool LayoutRawBlock::fit(int size, int alignment) {
}
FieldGroup::FieldGroup(int contended_group) :
_next(NULL),
_primitive_fields(NULL),
_oop_fields(NULL),
_next(nullptr),
_primitive_fields(nullptr),
_oop_fields(nullptr),
_contended_group(contended_group), // -1 means no contended group, 0 means default contended group
_oop_count(0) {}
void FieldGroup::add_primitive_field(AllFieldStream fs, BasicType type) {
int size = type2aelembytes(type);
LayoutRawBlock* block = new LayoutRawBlock(fs.index(), LayoutRawBlock::REGULAR, size, size /* alignment == size for primitive types */, false);
if (_primitive_fields == NULL) {
if (_primitive_fields == nullptr) {
_primitive_fields = new GrowableArray<LayoutRawBlock*>(INITIAL_LIST_SIZE);
}
_primitive_fields->append(block);
@ -92,7 +92,7 @@ void FieldGroup::add_primitive_field(AllFieldStream fs, BasicType type) {
void FieldGroup::add_oop_field(AllFieldStream fs) {
int size = type2aelembytes(T_OBJECT);
LayoutRawBlock* block = new LayoutRawBlock(fs.index(), LayoutRawBlock::REGULAR, size, size /* alignment == size for oops */, true);
if (_oop_fields == NULL) {
if (_oop_fields == nullptr) {
_oop_fields = new GrowableArray<LayoutRawBlock*>(INITIAL_LIST_SIZE);
}
_oop_fields->append(block);
@ -100,7 +100,7 @@ void FieldGroup::add_oop_field(AllFieldStream fs) {
}
void FieldGroup::sort_by_size() {
if (_primitive_fields != NULL) {
if (_primitive_fields != nullptr) {
_primitive_fields->sort(LayoutRawBlock::compare_size_inverted);
}
}
@ -108,7 +108,7 @@ void FieldGroup::sort_by_size() {
FieldLayout::FieldLayout(Array<u2>* fields, ConstantPool* cp) :
_fields(fields),
_cp(cp),
_blocks(NULL),
_blocks(nullptr),
_start(_blocks),
_last(_blocks) {}
@ -128,7 +128,7 @@ void FieldLayout::initialize_static_layout() {
}
void FieldLayout::initialize_instance_layout(const InstanceKlass* super_klass) {
if (super_klass == NULL) {
if (super_klass == nullptr) {
_blocks = new LayoutRawBlock(LayoutRawBlock::EMPTY, INT_MAX);
_blocks->set_offset(0);
_last = _blocks;
@ -161,15 +161,15 @@ LayoutRawBlock* FieldLayout::first_field_block() {
// add the field at the end of the layout.
// Fields cannot be inserted before the block specified in the "start" argument
void FieldLayout::add(GrowableArray<LayoutRawBlock*>* list, LayoutRawBlock* start) {
if (list == NULL) return;
if (start == NULL) start = this->_start;
if (list == nullptr) return;
if (start == nullptr) start = this->_start;
bool last_search_success = false;
int last_size = 0;
int last_alignment = 0;
for (int i = 0; i < list->length(); i ++) {
LayoutRawBlock* b = list->at(i);
LayoutRawBlock* cursor = NULL;
LayoutRawBlock* candidate = NULL;
LayoutRawBlock* cursor = nullptr;
LayoutRawBlock* candidate = nullptr;
// if start is the last block, just append the field
if (start == last_block()) {
@ -186,21 +186,21 @@ void FieldLayout::add(GrowableArray<LayoutRawBlock*>* list, LayoutRawBlock* star
last_size = b->size();
last_alignment = b->alignment();
cursor = last_block()->prev_block();
assert(cursor != NULL, "Sanity check");
assert(cursor != nullptr, "Sanity check");
last_search_success = true;
while (cursor != start) {
if (cursor->kind() == LayoutRawBlock::EMPTY && cursor->fit(b->size(), b->alignment())) {
if (candidate == NULL || cursor->size() < candidate->size()) {
if (candidate == nullptr || cursor->size() < candidate->size()) {
candidate = cursor;
}
}
cursor = cursor->prev_block();
}
if (candidate == NULL) {
if (candidate == nullptr) {
candidate = last_block();
last_search_success = false;
}
assert(candidate != NULL, "Candidate must not be null");
assert(candidate != nullptr, "Candidate must not be null");
assert(candidate->kind() == LayoutRawBlock::EMPTY, "Candidate must be an empty block");
assert(candidate->fit(b->size(), b->alignment()), "Candidate must be able to store the block");
}
@ -211,13 +211,13 @@ void FieldLayout::add(GrowableArray<LayoutRawBlock*>* list, LayoutRawBlock* star
// Used for classes with hard coded field offsets, insert a field at the specified offset */
void FieldLayout::add_field_at_offset(LayoutRawBlock* block, int offset, LayoutRawBlock* start) {
assert(block != NULL, "Sanity check");
assert(block != nullptr, "Sanity check");
block->set_offset(offset);
if (start == NULL) {
if (start == nullptr) {
start = this->_start;
}
LayoutRawBlock* slot = start;
while (slot != NULL) {
while (slot != nullptr) {
if ((slot->offset() <= block->offset() && (slot->offset() + slot->size()) > block->offset()) ||
slot == _last){
assert(slot->kind() == LayoutRawBlock::EMPTY, "Matching slot must be an empty slot");
@ -243,8 +243,8 @@ void FieldLayout::add_field_at_offset(LayoutRawBlock* block, int offset, LayoutR
// in the first empty slot big enough to contain the whole set ((including padding
// to fit alignment constraints).
void FieldLayout::add_contiguously(GrowableArray<LayoutRawBlock*>* list, LayoutRawBlock* start) {
if (list == NULL) return;
if (start == NULL) {
if (list == nullptr) return;
if (start == nullptr) {
start = _start;
}
// This code assumes that if the first block is well aligned, the following
@ -254,7 +254,7 @@ void FieldLayout::add_contiguously(GrowableArray<LayoutRawBlock*>* list, LayoutR
size += list->at(i)->size();
}
LayoutRawBlock* candidate = NULL;
LayoutRawBlock* candidate = nullptr;
if (start == last_block()) {
candidate = last_block();
} else {
@ -267,7 +267,7 @@ void FieldLayout::add_contiguously(GrowableArray<LayoutRawBlock*>* list, LayoutR
}
candidate = candidate->prev_block();
}
assert(candidate != NULL, "Candidate must not be null");
assert(candidate != nullptr, "Candidate must not be null");
assert(candidate->kind() == LayoutRawBlock::EMPTY, "Candidate must be an empty block");
assert(candidate->fit(size, first->alignment()), "Candidate must be able to store the whole contiguous block");
}
@ -297,7 +297,7 @@ LayoutRawBlock* FieldLayout::insert_field_block(LayoutRawBlock* slot, LayoutRawB
bool FieldLayout::reconstruct_layout(const InstanceKlass* ik) {
bool has_instance_fields = false;
GrowableArray<LayoutRawBlock*>* all_fields = new GrowableArray<LayoutRawBlock*>(32);
while (ik != NULL) {
while (ik != nullptr) {
for (AllFieldStream fs(ik->fields(), ik->constants()); !fs.done(); fs.next()) {
BasicType type = Signature::basic_type(fs.signature());
// distinction between static and non-static fields is missing
@ -309,7 +309,7 @@ bool FieldLayout::reconstruct_layout(const InstanceKlass* ik) {
block->set_offset(fs.offset());
all_fields->append(block);
}
ik = ik->super() == NULL ? NULL : InstanceKlass::cast(ik->super());
ik = ik->super() == nullptr ? nullptr : InstanceKlass::cast(ik->super());
}
all_fields->sort(LayoutRawBlock::compare_offset);
@ -334,11 +334,11 @@ bool FieldLayout::reconstruct_layout(const InstanceKlass* ik) {
// by inserting PADDING blocks instead of EMPTY block to prevent subclasses'
// fields to interfere with contended fields/classes.
void FieldLayout::fill_holes(const InstanceKlass* super_klass) {
assert(_blocks != NULL, "Sanity check");
assert(_blocks != nullptr, "Sanity check");
assert(_blocks->offset() == 0, "first block must be at offset zero");
LayoutRawBlock::Kind filling_type = super_klass->has_contended_annotations() ? LayoutRawBlock::PADDING: LayoutRawBlock::EMPTY;
LayoutRawBlock* b = _blocks;
while (b->next_block() != NULL) {
while (b->next_block() != nullptr) {
if (b->next_block()->offset() > (b->offset() + b->size())) {
int size = b->next_block()->offset() - (b->offset() + b->size());
LayoutRawBlock* empty = new LayoutRawBlock(filling_type, size);
@ -350,7 +350,7 @@ void FieldLayout::fill_holes(const InstanceKlass* super_klass) {
}
b = b->next_block();
}
assert(b->next_block() == NULL, "Invariant at this point");
assert(b->next_block() == nullptr, "Invariant at this point");
assert(b->kind() != LayoutRawBlock::EMPTY, "Sanity check");
// If the super class has @Contended annotation, a padding block is
@ -397,7 +397,7 @@ LayoutRawBlock* FieldLayout::insert(LayoutRawBlock* slot, LayoutRawBlock* block)
block->set_prev_block(slot->prev_block());
block->set_next_block(slot);
slot->set_prev_block(block);
if (block->prev_block() != NULL) {
if (block->prev_block() != nullptr) {
block->prev_block()->set_next_block(block);
}
if (_blocks == slot) {
@ -407,15 +407,15 @@ LayoutRawBlock* FieldLayout::insert(LayoutRawBlock* slot, LayoutRawBlock* block)
}
void FieldLayout::remove(LayoutRawBlock* block) {
assert(block != NULL, "Sanity check");
assert(block != nullptr, "Sanity check");
assert(block != _last, "Sanity check");
if (_blocks == block) {
_blocks = block->next_block();
if (_blocks != NULL) {
_blocks->set_prev_block(NULL);
if (_blocks != nullptr) {
_blocks->set_prev_block(nullptr);
}
} else {
assert(block->prev_block() != NULL, "_prev should be set for non-head blocks");
assert(block->prev_block() != nullptr, "_prev should be set for non-head blocks");
block->prev_block()->set_next_block(block->next_block());
block->next_block()->set_prev_block(block->prev_block());
}
@ -460,10 +460,10 @@ void FieldLayout::print(outputStream* output, bool is_static, const InstanceKlas
}
case LayoutRawBlock::INHERITED: {
assert(!is_static, "Static fields are not inherited in layouts");
assert(super != NULL, "super klass must be provided to retrieve inherited fields info");
assert(super != nullptr, "super klass must be provided to retrieve inherited fields info");
bool found = false;
const InstanceKlass* ik = super;
while (!found && ik != NULL) {
while (!found && ik != nullptr) {
for (AllFieldStream fs(ik->fields(), ik->constants()); !fs.done(); fs.next()) {
if (fs.offset() == b->offset()) {
output->print_cr(" @%d \"%s\" %s %d/%d %s",
@ -505,11 +505,11 @@ FieldLayoutBuilder::FieldLayoutBuilder(const Symbol* classname, const InstanceKl
_constant_pool(constant_pool),
_fields(fields),
_info(info),
_root_group(NULL),
_root_group(nullptr),
_contended_groups(GrowableArray<FieldGroup*>(8)),
_static_fields(NULL),
_layout(NULL),
_static_layout(NULL),
_static_fields(nullptr),
_layout(nullptr),
_static_layout(nullptr),
_nonstatic_oopmap_count(0),
_alignment(-1),
_has_nonstatic_fields(false),
@ -518,7 +518,7 @@ FieldLayoutBuilder::FieldLayoutBuilder(const Symbol* classname, const InstanceKl
FieldGroup* FieldLayoutBuilder::get_or_create_contended_group(int g) {
assert(g > 0, "must only be called for named contended groups");
FieldGroup* fg = NULL;
FieldGroup* fg = nullptr;
for (int i = 0; i < _contended_groups.length(); i++) {
fg = _contended_groups.at(i);
if (fg->contended_group() == g) return fg;
@ -532,7 +532,7 @@ void FieldLayoutBuilder::prologue() {
_layout = new FieldLayout(_fields, _constant_pool);
const InstanceKlass* super_klass = _super_klass;
_layout->initialize_instance_layout(super_klass);
if (super_klass != NULL) {
if (super_klass != nullptr) {
_has_nonstatic_fields = super_klass->has_nonstatic_fields();
}
_static_layout = new FieldLayout(_fields, _constant_pool);
@ -548,7 +548,7 @@ void FieldLayoutBuilder::prologue() {
// - @Contended annotation is ignored for static fields
void FieldLayoutBuilder::regular_field_sorting() {
for (AllFieldStream fs(_fields, _constant_pool); !fs.done(); fs.next()) {
FieldGroup* group = NULL;
FieldGroup* group = nullptr;
if (fs.access_flags().is_static()) {
group = _static_fields;
} else {
@ -565,7 +565,7 @@ void FieldLayoutBuilder::regular_field_sorting() {
group = _root_group;
}
}
assert(group != NULL, "invariant");
assert(group != nullptr, "invariant");
BasicType type = Signature::basic_type(fs.signature());
switch(type) {
case T_BYTE:
@ -646,7 +646,7 @@ void FieldLayoutBuilder::compute_regular_layout() {
void FieldLayoutBuilder::epilogue() {
// Computing oopmaps
int super_oop_map_count = (_super_klass == NULL) ? 0 :_super_klass->nonstatic_oop_map_count();
int super_oop_map_count = (_super_klass == nullptr) ? 0 :_super_klass->nonstatic_oop_map_count();
int max_oop_map_count = super_oop_map_count + _nonstatic_oopmap_count;
OopMapBlocksBuilder* nonstatic_oop_maps =
@ -656,7 +656,7 @@ void FieldLayoutBuilder::epilogue() {
_super_klass->nonstatic_oop_map_count());
}
if (_root_group->oop_fields() != NULL) {
if (_root_group->oop_fields() != nullptr) {
for (int i = 0; i < _root_group->oop_fields()->length(); i++) {
LayoutRawBlock* b = _root_group->oop_fields()->at(i);
nonstatic_oop_maps->add(b->offset(), 1);
@ -667,7 +667,7 @@ void FieldLayoutBuilder::epilogue() {
for (int i = 0; i < _contended_groups.length(); i++) {
FieldGroup* cg = _contended_groups.at(i);
if (cg->oop_count() > 0) {
assert(cg->oop_fields() != NULL && cg->oop_fields()->at(0) != NULL, "oop_count > 0 but no oop fields found");
assert(cg->oop_fields() != nullptr && cg->oop_fields()->at(0) != nullptr, "oop_count > 0 but no oop fields found");
nonstatic_oop_maps->add(cg->oop_fields()->at(0)->offset(), cg->oop_count());
}
}
@ -695,7 +695,7 @@ void FieldLayoutBuilder::epilogue() {
tty->print_cr("Instance fields:");
_layout->print(tty, false, _super_klass);
tty->print_cr("Static fields:");
_static_layout->print(tty, true, NULL);
_static_layout->print(tty, true, nullptr);
tty->print_cr("Instance size = %d bytes", _info->_instance_size * wordSize);
tty->print_cr("---");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 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
@ -188,9 +188,9 @@ class FieldLayout : public ResourceObj {
LayoutRawBlock* last_block() { return _last; }
LayoutRawBlock* first_field_block();
void add(GrowableArray<LayoutRawBlock*>* list, LayoutRawBlock* start = NULL);
void add_field_at_offset(LayoutRawBlock* blocks, int offset, LayoutRawBlock* start = NULL);
void add_contiguously(GrowableArray<LayoutRawBlock*>* list, LayoutRawBlock* start = NULL);
void add(GrowableArray<LayoutRawBlock*>* list, LayoutRawBlock* start = nullptr);
void add_field_at_offset(LayoutRawBlock* blocks, int offset, LayoutRawBlock* start = nullptr);
void add_contiguously(GrowableArray<LayoutRawBlock*>* list, LayoutRawBlock* start = nullptr);
LayoutRawBlock* insert_field_block(LayoutRawBlock* slot, LayoutRawBlock* block);
bool reconstruct_layout(const InstanceKlass* ik);
void fill_holes(const InstanceKlass* ik);

File diff suppressed because it is too large Load Diff

View File

@ -268,7 +268,7 @@ class java_lang_Class : AllStatic {
// Conversion
static Klass* as_Klass(oop java_class);
static void set_klass(oop java_class, Klass* klass);
static BasicType as_BasicType(oop java_class, Klass** reference_klass = NULL);
static BasicType as_BasicType(oop java_class, Klass** reference_klass = nullptr);
static Symbol* as_signature(oop java_class, bool intern_if_not_found);
static void print_signature(oop java_class, outputStream *st);
static const char* as_external_name(oop java_class);
@ -911,7 +911,7 @@ class java_lang_boxing_object: AllStatic {
static void compute_offsets();
static oop initialize_and_allocate(BasicType type, TRAPS);
public:
// Allocation. Returns a boxed value, or NULL for invalid type.
// Allocation. Returns a boxed value, or null for invalid type.
static oop create(BasicType type, jvalue* value, TRAPS);
// Accessors. Returns the basic type being boxed, or T_ILLEGAL for invalid oop.
static BasicType get_value(oop box, jvalue* value);
@ -1072,7 +1072,7 @@ class java_lang_invoke_LambdaForm: AllStatic {
// Testers
static bool is_subclass(Klass* klass) {
return vmClasses::LambdaForm_klass() != NULL &&
return vmClasses::LambdaForm_klass() != nullptr &&
klass->is_subclass_of(vmClasses::LambdaForm_klass());
}
static bool is_instance(oop obj);
@ -1102,7 +1102,7 @@ class jdk_internal_foreign_abi_NativeEntryPoint: AllStatic {
// Testers
static bool is_subclass(Klass* klass) {
return vmClasses::NativeEntryPoint_klass() != NULL &&
return vmClasses::NativeEntryPoint_klass() != nullptr &&
klass->is_subclass_of(vmClasses::NativeEntryPoint_klass());
}
static bool is_instance(oop obj);
@ -1140,7 +1140,7 @@ class jdk_internal_foreign_abi_ABIDescriptor: AllStatic {
// Testers
static bool is_subclass(Klass* klass) {
return vmClasses::ABIDescriptor_klass() != NULL &&
return vmClasses::ABIDescriptor_klass() != nullptr &&
klass->is_subclass_of(vmClasses::ABIDescriptor_klass());
}
static bool is_instance(oop obj);
@ -1168,7 +1168,7 @@ class jdk_internal_foreign_abi_VMStorage: AllStatic {
// Testers
static bool is_subclass(Klass* klass) {
return vmClasses::VMStorage_klass() != NULL &&
return vmClasses::VMStorage_klass() != nullptr &&
klass->is_subclass_of(vmClasses::VMStorage_klass());
}
static bool is_instance(oop obj);
@ -1192,7 +1192,7 @@ class jdk_internal_foreign_abi_CallConv: AllStatic {
// Testers
static bool is_subclass(Klass* klass) {
return vmClasses::CallConv_klass() != NULL &&
return vmClasses::CallConv_klass() != nullptr &&
klass->is_subclass_of(vmClasses::CallConv_klass());
}
static bool is_instance(oop obj);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
@ -108,7 +108,7 @@ int java_lang_String::length(oop java_string, typeArrayOop value) {
assert(is_instance(java_string), "must be java_string");
assert(value_equals(value, java_lang_String::value(java_string)),
"value must be equal to java_lang_String::value(java_string)");
if (value == NULL) {
if (value == nullptr) {
return 0;
}
int arr_length = value->length();
@ -127,7 +127,7 @@ int java_lang_String::length(oop java_string) {
}
bool java_lang_String::is_instance(oop obj) {
return obj != NULL && obj->klass() == vmClasses::String_klass();
return obj != nullptr && obj->klass() == vmClasses::String_klass();
}
// Accessors
@ -248,7 +248,7 @@ inline void java_lang_invoke_CallSite::set_target(oop site, oop target) {
}
inline bool java_lang_invoke_CallSite::is_instance(oop obj) {
return obj != NULL && is_subclass(obj->klass());
return obj != nullptr && is_subclass(obj->klass());
}
inline jboolean java_lang_invoke_ConstantCallSite::is_frozen(oop site) {
@ -256,50 +256,50 @@ inline jboolean java_lang_invoke_ConstantCallSite::is_frozen(oop site) {
}
inline bool java_lang_invoke_ConstantCallSite::is_instance(oop obj) {
return obj != NULL && is_subclass(obj->klass());
return obj != nullptr && is_subclass(obj->klass());
}
inline bool java_lang_invoke_MethodHandleNatives_CallSiteContext::is_instance(oop obj) {
return obj != NULL && is_subclass(obj->klass());
return obj != nullptr && is_subclass(obj->klass());
}
inline bool java_lang_invoke_MemberName::is_instance(oop obj) {
return obj != NULL && obj->klass() == vmClasses::MemberName_klass();
return obj != nullptr && obj->klass() == vmClasses::MemberName_klass();
}
inline bool java_lang_invoke_ResolvedMethodName::is_instance(oop obj) {
return obj != NULL && obj->klass() == vmClasses::ResolvedMethodName_klass();
return obj != nullptr && obj->klass() == vmClasses::ResolvedMethodName_klass();
}
inline bool java_lang_invoke_MethodType::is_instance(oop obj) {
return obj != NULL && obj->klass() == vmClasses::MethodType_klass();
return obj != nullptr && obj->klass() == vmClasses::MethodType_klass();
}
inline bool java_lang_invoke_MethodHandle::is_instance(oop obj) {
return obj != NULL && is_subclass(obj->klass());
return obj != nullptr && is_subclass(obj->klass());
}
inline bool java_lang_Class::is_instance(oop obj) {
return obj != NULL && obj->klass() == vmClasses::Class_klass();
return obj != nullptr && obj->klass() == vmClasses::Class_klass();
}
inline Klass* java_lang_Class::as_Klass(oop java_class) {
//%note memory_2
assert(java_lang_Class::is_instance(java_class), "must be a Class object");
Klass* k = ((Klass*)java_class->metadata_field(_klass_offset));
assert(k == NULL || k->is_klass(), "type check");
assert(k == nullptr || k->is_klass(), "type check");
return k;
}
inline bool java_lang_Class::is_primitive(oop java_class) {
// should assert:
//assert(java_lang_Class::is_instance(java_class), "must be a Class object");
bool is_primitive = (java_class->metadata_field(_klass_offset) == NULL);
bool is_primitive = (java_class->metadata_field(_klass_offset) == nullptr);
#ifdef ASSERT
if (is_primitive) {
Klass* k = ((Klass*)java_class->metadata_field(_array_klass_offset));
assert(k == NULL || is_java_primitive(ArrayKlass::cast(k)->element_type()),
assert(k == nullptr || is_java_primitive(ArrayKlass::cast(k)->element_type()),
"Should be either the T_VOID primitive or a java primitive");
}
#endif
@ -315,11 +315,11 @@ inline size_t java_lang_Class::oop_size(oop java_class) {
}
inline bool java_lang_invoke_DirectMethodHandle::is_instance(oop obj) {
return obj != NULL && is_subclass(obj->klass());
return obj != nullptr && is_subclass(obj->klass());
}
inline bool java_lang_Module::is_instance(oop obj) {
return obj != NULL && obj->klass() == vmClasses::Module_klass();
return obj != nullptr && obj->klass() == vmClasses::Module_klass();
}
inline int Backtrace::merge_bci_and_version(int bci, int version) {
@ -373,7 +373,7 @@ inline Symbol* Backtrace::get_source_file_name(InstanceKlass* holder, int versio
// the source_file_name_index for any older constant pool version
// to be unstable so we shouldn't try to use it.
if (holder->constants()->version() != version) {
return NULL;
return nullptr;
} else {
return holder->source_file_name();
}

View File

@ -51,13 +51,13 @@ InstanceKlass* KlassFactory::check_shared_class_file_load_hook(
const ClassFileStream *cfs,
TRAPS) {
#if INCLUDE_CDS && INCLUDE_JVMTI
assert(ik != NULL, "sanity");
assert(ik != nullptr, "sanity");
assert(ik->is_shared(), "expecting a shared class");
if (JvmtiExport::should_post_class_file_load_hook()) {
// Post the CFLH
JvmtiCachedClassFileData* cached_class_file = NULL;
if (cfs == NULL) {
JvmtiCachedClassFileData* cached_class_file = nullptr;
if (cfs == nullptr) {
cfs = FileMapInfo::open_stream_for_jvmti(ik, class_loader, CHECK_NULL);
}
unsigned char* ptr = (unsigned char*)cfs->buffer();
@ -91,7 +91,7 @@ InstanceKlass* KlassFactory::check_shared_class_file_load_hook(
*cl_inst_info, // dynamic_nest_host and classData
CHECK_NULL);
if (cached_class_file != NULL) {
if (cached_class_file != nullptr) {
new_ik->set_cached_class_file(cached_class_file);
}
@ -104,7 +104,7 @@ InstanceKlass* KlassFactory::check_shared_class_file_load_hook(
}
#endif
return NULL;
return nullptr;
}
@ -115,7 +115,7 @@ static ClassFileStream* check_class_file_load_hook(ClassFileStream* stream,
JvmtiCachedClassFileData** cached_class_file,
TRAPS) {
assert(stream != NULL, "invariant");
assert(stream != nullptr, "invariant");
if (JvmtiExport::should_post_class_file_load_hook()) {
const JavaThread* jt = THREAD;
@ -133,9 +133,9 @@ static ClassFileStream* check_class_file_load_hook(ClassFileStream* stream,
JvmtiThreadState* state = jt->jvmti_thread_state();
if (state != NULL) {
if (state != nullptr) {
Klass* k = state->get_class_being_redefined();
if (k != NULL && state->get_class_load_kind() == jvmti_class_load_kind_retransform) {
if (k != nullptr && state->get_class_load_kind() == jvmti_class_load_kind_retransform) {
InstanceKlass* class_being_redefined = InstanceKlass::cast(k);
*cached_class_file = class_being_redefined->get_cached_class_file();
}
@ -170,13 +170,13 @@ InstanceKlass* KlassFactory::create_from_stream(ClassFileStream* stream,
ClassLoaderData* loader_data,
const ClassLoadInfo& cl_info,
TRAPS) {
assert(stream != NULL, "invariant");
assert(loader_data != NULL, "invariant");
assert(stream != nullptr, "invariant");
assert(loader_data != nullptr, "invariant");
ResourceMark rm(THREAD);
HandleMark hm(THREAD);
JvmtiCachedClassFileData* cached_class_file = NULL;
JvmtiCachedClassFileData* cached_class_file = nullptr;
ClassFileStream* old_stream = stream;
@ -202,9 +202,9 @@ InstanceKlass* KlassFactory::create_from_stream(ClassFileStream* stream,
const ClassInstanceInfo* cl_inst_info = cl_info.class_hidden_info_ptr();
InstanceKlass* result = parser.create_instance_klass(old_stream != stream, *cl_inst_info, CHECK_NULL);
assert(result != NULL, "result cannot be null with no pending exception");
assert(result != nullptr, "result cannot be null with no pending exception");
if (cached_class_file != NULL) {
if (cached_class_file != nullptr) {
// JVMTI: we have an InstanceKlass now, tell it about the cached bytes
result->set_cached_class_file(cached_class_file);
}

View File

@ -43,17 +43,17 @@ class Symbol;
* Output: a VM runtime representation of a Java class
*
* Pre-conditions:
* a non-NULL ClassFileStream* // the classfile bytestream
* a non-NULL Symbol* // the name of the class
* a non-NULL ClassLoaderData* // the metaspace allocator
* a non-null ClassFileStream* // the classfile bytestream
* a non-null Symbol* // the name of the class
* a non-null ClassLoaderData* // the metaspace allocator
* (no pending exceptions)
*
* Returns:
* if the returned value is non-NULL, that value is an indirection (pointer/handle)
* if the returned value is non-null, that value is an indirection (pointer/handle)
* to a Klass. The caller will not have a pending exception.
*
* On broken invariants and/or runtime errors the returned value will be
* NULL (or a NULL handle) and the caller *might* now have a pending exception.
* null (or a null handle) and the caller *might* now have a pending exception.
*
*/

View File

@ -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
@ -118,12 +118,12 @@ void LoaderConstraint::extend_loader_constraint(Symbol* class_name,
lt.print("extending constraint for name %s by adding loader: %s %s",
class_name->as_C_string(),
loader->loader_name_and_id(),
_klass == NULL ? " and setting class object" : "");
_klass == nullptr ? " and setting class object" : "");
}
if (_klass == NULL) {
if (_klass == nullptr) {
set_klass(klass);
} else {
assert(klass == NULL || _klass == klass, "constraints corrupted");
assert(klass == nullptr || _klass == klass, "constraints corrupted");
}
}
@ -181,9 +181,9 @@ class PurgeUnloadedConstraints : public StackObj {
LoaderConstraint* probe = set.constraint_at(i);
InstanceKlass* klass = probe->klass();
// Remove klass that is no longer alive
if (klass != NULL &&
if (klass != nullptr &&
!klass->is_loader_alive()) {
probe->set_klass(NULL);
probe->set_klass(nullptr);
if (lt.is_enabled()) {
ResourceMark rm;
lt.print("purging class object from constraint for name %s,"
@ -228,7 +228,7 @@ class PurgeUnloadedConstraints : public StackObj {
set.remove_constraint(probe);
} else {
#ifdef ASSERT
if (probe->klass() != NULL) {
if (probe->klass() != nullptr) {
assert(probe->klass()->is_loader_alive(), "klass should be live");
}
#endif
@ -268,7 +268,7 @@ bool LoaderConstraintTable::add_entry(Symbol* class_name,
InstanceKlass* klass2, ClassLoaderData* loader2) {
LogTarget(Info, class, loader, constraints) lt;
if (klass1 != NULL && klass2 != NULL) {
if (klass1 != nullptr && klass2 != nullptr) {
if (klass1 == klass2) {
// Same type already loaded in both places. There is no need for any constraint.
return true;
@ -281,10 +281,10 @@ bool LoaderConstraintTable::add_entry(Symbol* class_name,
}
}
InstanceKlass* klass = klass1 != NULL ? klass1 : klass2;
InstanceKlass* klass = klass1 != nullptr ? klass1 : klass2;
LoaderConstraint* pp1 = find_loader_constraint(class_name, loader1);
if (pp1 != NULL && pp1->klass() != NULL) {
if (klass != NULL) {
if (pp1 != nullptr && pp1->klass() != nullptr) {
if (klass != nullptr) {
if (klass != pp1->klass()) {
log_ldr_constraint_msg(class_name,
"The class object presented by loader[0] does not match "
@ -298,8 +298,8 @@ bool LoaderConstraintTable::add_entry(Symbol* class_name,
}
LoaderConstraint* pp2 = find_loader_constraint(class_name, loader2);
if (pp2 != NULL && pp2->klass() != NULL) {
if (klass != NULL) {
if (pp2 != nullptr && pp2->klass() != nullptr) {
if (klass != nullptr) {
if (klass != pp2->klass()) {
log_ldr_constraint_msg(class_name,
"The class object presented by loader[1] does not match "
@ -312,7 +312,7 @@ bool LoaderConstraintTable::add_entry(Symbol* class_name,
}
}
if (pp1 == NULL && pp2 == NULL) {
if (pp1 == nullptr && pp2 == nullptr) {
add_loader_constraint(class_name, klass, loader1, loader2);
if (lt.is_enabled()) {
@ -325,7 +325,7 @@ bool LoaderConstraintTable::add_entry(Symbol* class_name,
}
} else if (pp1 == pp2) {
/* constraint already imposed */
if (pp1->klass() == NULL) {
if (pp1->klass() == nullptr) {
pp1->set_klass(klass);
if (lt.is_enabled()) {
ResourceMark rm;
@ -337,9 +337,9 @@ bool LoaderConstraintTable::add_entry(Symbol* class_name,
} else {
assert(pp1->klass() == klass, "loader constraints corrupted");
}
} else if (pp1 == NULL) {
} else if (pp1 == nullptr) {
pp2->extend_loader_constraint(class_name, loader1, klass);
} else if (pp2 == NULL) {
} else if (pp2 == nullptr) {
pp1->extend_loader_constraint(class_name, loader1, klass);
} else {
merge_loader_constraints(class_name, pp1, pp2, klass);
@ -355,7 +355,7 @@ bool LoaderConstraintTable::check_or_update(InstanceKlass* k,
Symbol* name) {
LogTarget(Info, class, loader, constraints) lt;
LoaderConstraint* p = find_loader_constraint(name, loader);
if (p && p->klass() != NULL && p->klass() != k) {
if (p && p->klass() != nullptr && p->klass() != k) {
if (lt.is_enabled()) {
ResourceMark rm;
lt.print("constraint check failed for name %s, loader %s: "
@ -365,7 +365,7 @@ bool LoaderConstraintTable::check_or_update(InstanceKlass* k,
}
return false;
} else {
if (p && p->klass() == NULL) {
if (p && p->klass() == nullptr) {
p->set_klass(k);
if (lt.is_enabled()) {
ResourceMark rm;
@ -382,18 +382,18 @@ bool LoaderConstraintTable::check_or_update(InstanceKlass* k,
InstanceKlass* LoaderConstraintTable::find_constrained_klass(Symbol* name,
ClassLoaderData* loader) {
LoaderConstraint *p = find_loader_constraint(name, loader);
if (p != NULL && p->klass() != NULL) {
if (p != nullptr && p->klass() != nullptr) {
assert(p->klass()->is_instance_klass(), "sanity");
if (!p->klass()->is_loaded()) {
// Only return fully loaded classes. Classes found through the
// constraints might still be in the process of loading.
return NULL;
return nullptr;
}
return p->klass();
}
// No constraints, or else no klass loaded yet.
return NULL;
return nullptr;
}
void LoaderConstraintTable::merge_loader_constraints(Symbol* class_name,
@ -418,20 +418,20 @@ void LoaderConstraintTable::merge_loader_constraints(Symbol* class_name,
for (int i = 0; i < dest->num_loaders(); i++) {
lt.print(" [%d]: %s", i, dest->loader_data(i)->loader_name_and_id());
}
if (dest->klass() == NULL) {
if (dest->klass() == nullptr) {
lt.print("... and setting class object");
}
}
// dest->klass() will hold NULL if klass, src->klass(), and old
// dest->klass() are all NULL. In addition, all three must have
// matching non-NULL values, otherwise either the constraints would
// dest->klass() will hold null if klass, src->klass(), and old
// dest->klass() are all null. In addition, all three must have
// matching non-null values, otherwise either the constraints would
// have been violated, or the constraints had been corrupted (and an
// assertion would fail).
if (src->klass() != NULL) {
if (src->klass() != nullptr) {
assert(src->klass() == klass, "constraints corrupted");
}
if (dest->klass() == NULL) {
if (dest->klass() == nullptr) {
dest->set_klass(klass);
} else {
assert(dest->klass() == klass, "constraints corrupted");
@ -449,14 +449,14 @@ void LoaderConstraintTable::verify() {
int len = set.num_constraints();
for (int i = 0; i < len; i++) {
LoaderConstraint* probe = set.constraint_at(i);
if (probe->klass() != NULL) {
if (probe->klass() != nullptr) {
InstanceKlass* ik = probe->klass();
guarantee(key == ik->name(), "name should match");
Symbol* name = ik->name();
ClassLoaderData* loader_data = ik->class_loader_data();
Dictionary* dictionary = loader_data->dictionary();
InstanceKlass* k = dictionary->find_class(thread, name);
if (k != NULL) {
if (k != nullptr) {
// We found the class in the dictionary, so we should
// make sure that the Klass* matches what we already have.
guarantee(k == probe->klass(), "klass should be in dictionary");
@ -468,7 +468,7 @@ void LoaderConstraintTable::verify() {
// The InstanceKlass might not be on the entry, so the only
// thing we can check here is whether we were successful in
// finding the class in the placeholders table.
guarantee(entry != NULL, "klass should be in the placeholders");
guarantee(entry != nullptr, "klass should be in the placeholders");
}
}
for (int n = 0; n< probe->num_loaders(); n++) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 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
@ -36,10 +36,10 @@
#include "jvmci/jvmci.hpp"
#endif
MetadataOnStackBuffer* MetadataOnStackMark::_used_buffers = NULL;
MetadataOnStackBuffer* MetadataOnStackMark::_free_buffers = NULL;
MetadataOnStackBuffer* MetadataOnStackMark::_used_buffers = nullptr;
MetadataOnStackBuffer* MetadataOnStackMark::_free_buffers = nullptr;
MetadataOnStackBuffer* MetadataOnStackMark::_current_buffer = NULL;
MetadataOnStackBuffer* MetadataOnStackMark::_current_buffer = nullptr;
NOT_PRODUCT(bool MetadataOnStackMark::_is_active = false;)
class MetadataOnStackClosure : public MetadataClosure {
@ -52,7 +52,7 @@ class MetadataOnStackClosure : public MetadataClosure {
// in metadata Handles.
MetadataOnStackMark::MetadataOnStackMark(bool walk_all_metadata, bool redefinition_walk) {
assert(SafepointSynchronize::is_at_safepoint(), "sanity check");
assert(_used_buffers == NULL, "sanity check");
assert(_used_buffers == nullptr, "sanity check");
assert(!_is_active, "MetadataOnStackMarks do not nest");
assert(!redefinition_walk || walk_all_metadata,
"walk_all_metadata must be true for redefinition_walk");
@ -85,7 +85,7 @@ MetadataOnStackMark::~MetadataOnStackMark() {
retire_current_buffer();
MetadataOnStackBuffer* buffer = _used_buffers;
while (buffer != NULL) {
while (buffer != nullptr) {
// Clear on stack state for all metadata.
size_t size = buffer->size();
for (size_t i = 0; i < size; i++) {
@ -97,7 +97,7 @@ MetadataOnStackMark::~MetadataOnStackMark() {
// Move the buffer to the free list.
buffer->clear();
buffer->set_next_used(NULL);
buffer->set_next_used(nullptr);
buffer->set_next_free(_free_buffers);
_free_buffers = buffer;
@ -105,13 +105,13 @@ MetadataOnStackMark::~MetadataOnStackMark() {
buffer = next;
}
_used_buffers = NULL;
_used_buffers = nullptr;
NOT_PRODUCT(_is_active = false;)
}
void MetadataOnStackMark::retire_buffer(MetadataOnStackBuffer* buffer) {
if (buffer == NULL) {
if (buffer == nullptr) {
return;
}
buffer->set_next_used(_used_buffers);
@ -121,18 +121,18 @@ void MetadataOnStackMark::retire_buffer(MetadataOnStackBuffer* buffer) {
// Current buffer is full or we're ready to walk them, add it to the used list.
void MetadataOnStackMark::retire_current_buffer() {
retire_buffer(_current_buffer);
_current_buffer = NULL;
_current_buffer = nullptr;
}
// Get buffer off free list.
MetadataOnStackBuffer* MetadataOnStackMark::allocate_buffer() {
MetadataOnStackBuffer* allocated = _free_buffers;
if (allocated != NULL) {
if (allocated != nullptr) {
_free_buffers = allocated->next_free();
}
if (allocated == NULL) {
if (allocated == nullptr) {
allocated = new MetadataOnStackBuffer();
}
@ -147,12 +147,12 @@ void MetadataOnStackMark::record(Metadata* m) {
MetadataOnStackBuffer* buffer = _current_buffer;
if (buffer != NULL && buffer->is_full()) {
if (buffer != nullptr && buffer->is_full()) {
retire_buffer(buffer);
buffer = NULL;
buffer = nullptr;
}
if (buffer == NULL) {
if (buffer == nullptr) {
buffer = allocate_buffer();
_current_buffer = buffer;
}

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
@ -47,7 +47,7 @@
#include "utilities/quickSort.hpp"
#include "utilities/resourceHash.hpp"
ModuleEntry* ModuleEntryTable::_javabase_module = NULL;
ModuleEntry* ModuleEntryTable::_javabase_module = nullptr;
oop ModuleEntry::module() const { return _module.resolve(); }
@ -58,7 +58,7 @@ void ModuleEntry::set_location(Symbol* location) {
_location = location;
if (location != NULL) {
if (location != nullptr) {
location->increment_refcount();
CDS_ONLY(if (UseSharedSpaces) {
_shared_path_index = FileMapInfo::get_module_shared_path_index(location);
@ -76,9 +76,9 @@ void ModuleEntry::set_location(Symbol* location) {
// and its version is the same as module java.base's version
// The above check is imprecise but should work in almost all cases.
bool ModuleEntry::should_show_version() {
if (version() == NULL || !is_named()) return false;
if (version() == nullptr || !is_named()) return false;
if (location() != NULL) {
if (location() != nullptr) {
ResourceMark rm;
const char* loc = location()->as_C_string();
ClassLoaderData* cld = loader_data();
@ -121,7 +121,7 @@ void ModuleEntry::set_shared_protection_domain(ClassLoaderData *loader_data,
// Returns true if this module can read module m
bool ModuleEntry::can_read(ModuleEntry* m) const {
assert(m != NULL, "No module to lookup in this module's reads list");
assert(m != nullptr, "No module to lookup in this module's reads list");
// Unnamed modules read everyone and all modules
// read java.base. If either of these conditions
@ -160,10 +160,10 @@ void ModuleEntry::add_read(ModuleEntry* m) {
}
MutexLocker m1(Module_lock);
if (m == NULL) {
if (m == nullptr) {
set_can_read_all_unnamed();
} else {
if (_reads == NULL) {
if (_reads == nullptr) {
// Lazily create a module's reads list
_reads = new (mtModule) GrowableArray<ModuleEntry*>(MODULE_READS_SIZE, mtModule);
}
@ -192,7 +192,7 @@ void ModuleEntry::set_read_walk_required(ClassLoaderData* m_loader_data) {
if (log_is_enabled(Trace, module)) {
ResourceMark rm;
log_trace(module)("ModuleEntry::set_read_walk_required(): module %s reads list must be walked",
(name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE);
(name() != nullptr) ? name()->as_C_string() : UNNAMED_MODULE);
}
}
}
@ -207,7 +207,7 @@ void ModuleEntry::set_is_open(bool is_open) {
// module will return false.
bool ModuleEntry::has_reads_list() const {
assert_locked_or_safepoint(Module_lock);
return ((_reads != NULL) && !_reads->is_empty());
return ((_reads != nullptr) && !_reads->is_empty());
}
// Purge dead module entries out of reads list.
@ -222,7 +222,7 @@ void ModuleEntry::purge_reads() {
if (log_is_enabled(Trace, module)) {
ResourceMark rm;
log_trace(module)("ModuleEntry::purge_reads(): module %s reads list being walked",
(name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE);
(name() != nullptr) ? name()->as_C_string() : UNNAMED_MODULE);
}
// Go backwards because this removes entries that are dead.
@ -242,7 +242,7 @@ void ModuleEntry::purge_reads() {
void ModuleEntry::module_reads_do(ModuleClosure* f) {
assert_locked_or_safepoint(Module_lock);
assert(f != NULL, "invariant");
assert(f != nullptr, "invariant");
if (has_reads_list()) {
int reads_len = _reads->length();
@ -254,7 +254,7 @@ void ModuleEntry::module_reads_do(ModuleClosure* f) {
void ModuleEntry::delete_reads() {
delete _reads;
_reads = NULL;
_reads = nullptr;
}
ModuleEntry::ModuleEntry(Handle module_handle,
@ -295,7 +295,7 @@ ModuleEntry::ModuleEntry(Handle module_handle,
if (log_is_enabled(Trace, module, patch)) {
ResourceMark rm;
log_trace(module, patch)("Marked module %s as patched from --patch-module",
name != NULL ? name->as_C_string() : UNNAMED_MODULE);
name != nullptr ? name->as_C_string() : UNNAMED_MODULE);
}
}
@ -335,7 +335,7 @@ ModuleEntry* ModuleEntry::create_boot_unnamed_module(ClassLoaderData* cld) {
// is not known until a call to JVM_SetBootLoaderUnnamedModule is made. At
// this point initially create the ModuleEntry for the unnamed module.
ModuleEntry* unnamed_module = new_unnamed_module_entry(Handle(), cld);
assert(unnamed_module != NULL, "boot loader unnamed module should not be null");
assert(unnamed_module != nullptr, "boot loader unnamed module should not be null");
return unnamed_module;
}
@ -386,7 +386,7 @@ typedef ResourceHashtable<
ModuleEntry*,
557, // prime number
AnyObj::C_HEAP> ArchivedModuleEntries;
static ArchivedModuleEntries* _archive_modules_entries = NULL;
static ArchivedModuleEntries* _archive_modules_entries = nullptr;
#ifndef PRODUCT
static int _num_archived_module_entries = 0;
@ -399,10 +399,10 @@ ModuleEntry* ModuleEntry::allocate_archived_entry() const {
memcpy((void*)archived_entry, (void*)this, sizeof(ModuleEntry));
archived_entry->_archived_module_index = -1;
if (_archive_modules_entries == NULL) {
if (_archive_modules_entries == nullptr) {
_archive_modules_entries = new (mtClass)ArchivedModuleEntries();
}
assert(_archive_modules_entries->get(this) == NULL, "Each ModuleEntry must not be shared across ModuleEntryTables");
assert(_archive_modules_entries->get(this) == nullptr, "Each ModuleEntry must not be shared across ModuleEntryTables");
_archive_modules_entries->put(this, archived_entry);
DEBUG_ONLY(_num_archived_module_entries++);
@ -422,7 +422,7 @@ bool ModuleEntry::has_been_archived() {
ModuleEntry* ModuleEntry::get_archived_entry(ModuleEntry* orig_entry) {
ModuleEntry** ptr = _archive_modules_entries->get(orig_entry);
assert(ptr != NULL && *ptr != NULL, "must have been allocated");
assert(ptr != nullptr && *ptr != nullptr, "must have been allocated");
return *ptr;
}
@ -430,8 +430,8 @@ ModuleEntry* ModuleEntry::get_archived_entry(ModuleEntry* orig_entry) {
// GrowableArray cannot be directly archived, as it needs to be expandable at runtime.
// Write it out as an Array, and convert it back to GrowableArray at runtime.
Array<ModuleEntry*>* ModuleEntry::write_growable_array(GrowableArray<ModuleEntry*>* array) {
Array<ModuleEntry*>* archived_array = NULL;
int length = (array == NULL) ? 0 : array->length();
Array<ModuleEntry*>* archived_array = nullptr;
int length = (array == nullptr) ? 0 : array->length();
if (length > 0) {
archived_array = ArchiveBuilder::new_ro_array<ModuleEntry*>(length);
for (int i = 0; i < length; i++) {
@ -445,8 +445,8 @@ Array<ModuleEntry*>* ModuleEntry::write_growable_array(GrowableArray<ModuleEntry
}
GrowableArray<ModuleEntry*>* ModuleEntry::restore_growable_array(Array<ModuleEntry*>* archived_array) {
GrowableArray<ModuleEntry*>* array = NULL;
int length = (archived_array == NULL) ? 0 : archived_array->length();
GrowableArray<ModuleEntry*>* array = nullptr;
int length = (archived_array == nullptr) ? 0 : archived_array->length();
if (length > 0) {
array = new (mtModule) GrowableArray<ModuleEntry*>(length, mtModule);
for (int i = 0; i < length; i++) {
@ -467,17 +467,17 @@ void ModuleEntry::iterate_symbols(MetaspaceClosure* closure) {
void ModuleEntry::init_as_archived_entry() {
Array<ModuleEntry*>* archived_reads = write_growable_array(_reads);
_loader_data = NULL; // re-init at runtime
_loader_data = nullptr; // re-init at runtime
_shared_path_index = FileMapInfo::get_module_shared_path_index(_location);
if (name() != NULL) {
if (name() != nullptr) {
_name = ArchiveBuilder::get_buffered_symbol(_name);
ArchivePtrMarker::mark_pointer((address*)&_name);
}
_reads = (GrowableArray<ModuleEntry*>*)archived_reads;
if (_version != NULL) {
if (_version != nullptr) {
_version = ArchiveBuilder::get_buffered_symbol(_version);
}
if (_location != NULL) {
if (_location != nullptr) {
_location = ArchiveBuilder::get_buffered_symbol(_location);
}
JFR_ONLY(set_trace_id(0));// re-init at runtime
@ -494,7 +494,7 @@ void ModuleEntry::update_oops_in_archived_module(int root_oop_index) {
_archived_module_index = root_oop_index;
assert(shared_protection_domain() == NULL, "never set during -Xshare:dump");
assert(shared_protection_domain() == nullptr, "never set during -Xshare:dump");
// Clear handles and restore at run time. Handles cannot be archived.
OopHandle null_handle;
_module = null_handle;
@ -612,9 +612,9 @@ ModuleEntry* ModuleEntryTable::locked_create_entry(Handle module_handle,
Symbol* module_version,
Symbol* module_location,
ClassLoaderData* loader_data) {
assert(module_name != NULL, "ModuleEntryTable locked_create_entry should never be called for unnamed module.");
assert(module_name != nullptr, "ModuleEntryTable locked_create_entry should never be called for unnamed module.");
assert(Module_lock->owned_by_self(), "should have the Module_lock");
assert(lookup_only(module_name) == NULL, "Module already exists");
assert(lookup_only(module_name) == nullptr, "Module already exists");
ModuleEntry* entry = new ModuleEntry(module_handle, is_open, module_name,
module_version, module_location, loader_data);
bool created = _table.put(module_name, entry);
@ -625,7 +625,7 @@ ModuleEntry* ModuleEntryTable::locked_create_entry(Handle module_handle,
// lookup_only by Symbol* to find a ModuleEntry.
ModuleEntry* ModuleEntryTable::lookup_only(Symbol* name) {
assert_locked_or_safepoint(Module_lock);
assert(name != NULL, "name cannot be NULL");
assert(name != nullptr, "name cannot be nullptr");
ModuleEntry** entry = _table.get(name);
return (entry == nullptr) ? nullptr : *entry;
}
@ -645,7 +645,7 @@ void ModuleEntryTable::finalize_javabase(Handle module_handle, Symbol* version,
ClassLoaderData* boot_loader_data = ClassLoaderData::the_null_class_loader_data();
ModuleEntryTable* module_table = boot_loader_data->modules();
assert(module_table != NULL, "boot loader's ModuleEntryTable not defined");
assert(module_table != nullptr, "boot loader's ModuleEntryTable not defined");
if (module_handle.is_null()) {
fatal("Unable to finalize module definition for " JAVA_BASE_NAME);
@ -653,7 +653,7 @@ void ModuleEntryTable::finalize_javabase(Handle module_handle, Symbol* version,
// Set java.lang.Module, version and location for java.base
ModuleEntry* jb_module = javabase_moduleEntry();
assert(jb_module != NULL, JAVA_BASE_NAME " ModuleEntry not defined");
assert(jb_module != nullptr, JAVA_BASE_NAME " ModuleEntry not defined");
jb_module->set_version(version);
jb_module->set_location(location);
// Once java.base's ModuleEntry _module field is set with the known
@ -707,7 +707,7 @@ void ModuleEntryTable::patch_javabase_entries(JavaThread* current, Handle module
}
delete java_lang_Class::fixup_module_field_list();
java_lang_Class::set_fixup_module_field_list(NULL);
java_lang_Class::set_fixup_module_field_list(nullptr);
}
void ModuleEntryTable::print(outputStream* st) {
@ -740,11 +740,11 @@ void ModuleEntryTable::modules_do(ModuleClosure* closure) {
void ModuleEntry::print(outputStream* st) {
st->print_cr("entry " PTR_FORMAT " name %s module " PTR_FORMAT " loader %s version %s location %s strict %s",
p2i(this),
name() == NULL ? UNNAMED_MODULE : name()->as_C_string(),
name() == nullptr ? UNNAMED_MODULE : name()->as_C_string(),
p2i(module()),
loader_data()->loader_name_and_id(),
version() != NULL ? version()->as_C_string() : "NULL",
location() != NULL ? location()->as_C_string() : "NULL",
version() != nullptr ? version()->as_C_string() : "nullptr",
location() != nullptr ? location()->as_C_string() : "nullptr",
BOOL_TO_STR(!can_read_all_unnamed()));
}
@ -757,5 +757,5 @@ void ModuleEntryTable::verify() {
}
void ModuleEntry::verify() {
guarantee(loader_data() != NULL, "A module entry must be associated with a loader.");
guarantee(loader_data() != nullptr, "A module entry must be associated with a loader.");
}

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
@ -121,7 +121,7 @@ public:
bool is_open() const { return _is_open; }
void set_is_open(bool is_open);
bool is_named() const { return (_name != NULL); }
bool is_named() const { return (_name != nullptr); }
bool can_read_all_unnamed() const {
assert(is_named() || _can_read_all_unnamed == true,
@ -233,12 +233,12 @@ public:
// Special handling for java.base
static ModuleEntry* javabase_moduleEntry() { return _javabase_module; }
static void set_javabase_moduleEntry(ModuleEntry* java_base) {
assert(_javabase_module == NULL, "_javabase_module is already defined");
assert(_javabase_module == nullptr, "_javabase_module is already defined");
_javabase_module = java_base;
}
static bool javabase_defined() { return ((_javabase_module != NULL) &&
(_javabase_module->module() != NULL)); }
static bool javabase_defined() { return ((_javabase_module != nullptr) &&
(_javabase_module->module() != nullptr)); }
static void finalize_javabase(Handle module_handle, Symbol* version, Symbol* location);
static void patch_javabase_entries(JavaThread* current, Handle module_handle);

View File

@ -54,12 +54,12 @@
#include "utilities/utf8.hpp"
static bool verify_module_name(const char *module_name, int len) {
assert(module_name != NULL, "invariant");
assert(module_name != nullptr, "invariant");
return (len > 0 && len <= Symbol::max_length());
}
static bool verify_package_name(const char* package_name, int len) {
assert(package_name != NULL, "Package name derived from non-null jstring can't be NULL");
assert(package_name != nullptr, "Package name derived from non-null jstring can't be null");
return (len > 0 && len <= Symbol::max_length() &&
ClassFileParser::verify_unqualified_name(package_name, len,
ClassFileParser::LegalClass));
@ -67,7 +67,7 @@ static bool verify_package_name(const char* package_name, int len) {
static char* get_module_name(oop module, int& len, TRAPS) {
oop name_oop = java_lang_Module::name(module);
if (name_oop == NULL) {
if (name_oop == nullptr) {
THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(), "Null module name");
}
char* module_name = java_lang_String::as_utf8_string(name_oop, len);
@ -79,8 +79,8 @@ static char* get_module_name(oop module, int& len, TRAPS) {
}
static Symbol* as_symbol(jstring str_object) {
if (str_object == NULL) {
return NULL;
if (str_object == nullptr) {
return nullptr;
}
int len;
char* str = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(str_object), len);
@ -112,28 +112,28 @@ static ModuleEntry* get_module_entry(Handle module, TRAPS) {
static PackageEntry* get_locked_package_entry(ModuleEntry* module_entry, const char* package_name, int len) {
assert(Module_lock->owned_by_self(), "should have the Module_lock");
assert(package_name != NULL, "Precondition");
assert(package_name != nullptr, "Precondition");
TempNewSymbol pkg_symbol = SymbolTable::new_symbol(package_name, len);
PackageEntryTable* package_entry_table = module_entry->loader_data()->packages();
assert(package_entry_table != NULL, "Unexpected null package entry table");
assert(package_entry_table != nullptr, "Unexpected null package entry table");
PackageEntry* package_entry = package_entry_table->locked_lookup_only(pkg_symbol);
assert(package_entry == NULL || package_entry->module() == module_entry, "Unexpectedly found a package linked to another module");
assert(package_entry == nullptr || package_entry->module() == module_entry, "Unexpectedly found a package linked to another module");
return package_entry;
}
static PackageEntry* get_package_entry_by_name(Symbol* package, Handle h_loader) {
if (package != NULL) {
if (package != nullptr) {
PackageEntryTable* const package_entry_table =
get_package_entry_table(h_loader);
assert(package_entry_table != NULL, "Unexpected null package entry table");
assert(package_entry_table != nullptr, "Unexpected null package entry table");
return package_entry_table->lookup_only(package);
}
return NULL;
return nullptr;
}
bool Modules::is_package_defined(Symbol* package, Handle h_loader) {
PackageEntry* res = get_package_entry_by_name(package, h_loader);
return res != NULL;
return res != nullptr;
}
// Converts the String oop to an internal package
@ -168,7 +168,7 @@ static void define_javabase_module(Handle module_handle, jstring version, jstrin
for (int x = 0; x < num_packages; x++) {
oop pkg_str = pkgs->obj_at(x);
if (pkg_str == NULL || pkg_str->klass() != vmClasses::String_klass()) {
if (pkg_str == nullptr || pkg_str->klass() != vmClasses::String_klass()) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
err_msg("Bad package name"));
}
@ -185,7 +185,7 @@ static void define_javabase_module(Handle module_handle, jstring version, jstrin
// Validate java_base's loader is the boot loader.
oop loader = java_lang_Module::loader(module_handle());
if (loader != NULL) {
if (loader != nullptr) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Class loader must be the boot class loader");
}
@ -193,10 +193,10 @@ static void define_javabase_module(Handle module_handle, jstring version, jstrin
// Ensure the boot loader's PackageEntryTable has been created
PackageEntryTable* package_table = get_package_entry_table(h_loader);
assert(pkg_list->length() == 0 || package_table != NULL, "Bad package_table");
assert(pkg_list->length() == 0 || package_table != nullptr, "Bad package_table");
// Ensure java.base's ModuleEntry has been created
assert(ModuleEntryTable::javabase_moduleEntry() != NULL, "No ModuleEntry for " JAVA_BASE_NAME);
assert(ModuleEntryTable::javabase_moduleEntry() != nullptr, "No ModuleEntry for " JAVA_BASE_NAME);
bool duplicate_javabase = false;
{
@ -216,7 +216,7 @@ static void define_javabase_module(Handle module_handle, jstring version, jstrin
// Some of java.base's packages were added early in bootstrapping, ignore duplicates.
package_table->locked_create_entry_if_absent(pkg_list->at(x),
ModuleEntryTable::javabase_moduleEntry());
assert(package_table->locked_lookup_only(pkg_list->at(x)) != NULL,
assert(package_table->locked_lookup_only(pkg_list->at(x)) != nullptr,
"Unable to create a " JAVA_BASE_NAME " package entry");
// Unable to have a GrowableArray of TempNewSymbol. Must decrement the refcount of
// the Symbol* that was created above for each package. The refcount was incremented
@ -240,11 +240,11 @@ static void define_javabase_module(Handle module_handle, jstring version, jstrin
ModuleEntryTable::patch_javabase_entries(THREAD, module_handle);
log_info(module, load)(JAVA_BASE_NAME " location: %s",
location_symbol != NULL ? location_symbol->as_C_string() : "NULL");
location_symbol != nullptr ? location_symbol->as_C_string() : "nullptr");
log_debug(module)("define_javabase_module(): Definition of module: "
JAVA_BASE_NAME ", version: %s, location: %s, package #: %d",
version_symbol != NULL ? version_symbol->as_C_string() : "NULL",
location_symbol != NULL ? location_symbol->as_C_string() : "NULL",
version_symbol != nullptr ? version_symbol->as_C_string() : "nullptr",
location_symbol != nullptr ? location_symbol->as_C_string() : "nullptr",
pkg_list->length());
// packages defined to java.base
@ -286,7 +286,7 @@ void Modules::define_module(Handle module, jboolean is_open, jstring version,
int module_name_len;
char* module_name = get_module_name(module(), module_name_len, CHECK);
if (module_name == NULL) {
if (module_name == nullptr) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Module name cannot be null");
}
@ -312,7 +312,7 @@ void Modules::define_module(Handle module, jboolean is_open, jstring version,
// define_module can be called during start-up, before the class loader's ClassLoaderData
// has been created. SystemDictionary::register_loader ensures creation, if needed.
ClassLoaderData* loader_data = SystemDictionary::register_loader(h_loader);
assert(loader_data != NULL, "class loader data shouldn't be null");
assert(loader_data != nullptr, "class loader data shouldn't be null");
// Only modules defined to either the boot or platform class loader, can define a "java/" package.
bool java_pkg_disallowed = !h_loader.is_null() &&
@ -324,7 +324,7 @@ void Modules::define_module(Handle module, jboolean is_open, jstring version,
GrowableArray<Symbol*>* pkg_list = new GrowableArray<Symbol*>(num_packages);
for (int x = 0; x < num_packages; x++) {
oop pkg_str = packages_h->obj_at(x);
if (pkg_str == NULL || pkg_str->klass() != vmClasses::String_klass()) {
if (pkg_str == nullptr || pkg_str->klass() != vmClasses::String_klass()) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
err_msg("Bad package name"));
}
@ -359,7 +359,7 @@ void Modules::define_module(Handle module, jboolean is_open, jstring version,
}
ModuleEntryTable* module_table = get_module_entry_table(h_loader);
assert(module_table != NULL, "module entry table shouldn't be null");
assert(module_table != nullptr, "module entry table shouldn't be null");
// Create symbol* entry for module name.
TempNewSymbol module_symbol = SymbolTable::new_symbol(module_name, module_name_len);
@ -372,22 +372,22 @@ void Modules::define_module(Handle module, jboolean is_open, jstring version,
// Create symbol* entry for module location.
TempNewSymbol location_symbol = as_symbol(location);
PackageEntryTable* package_table = NULL;
PackageEntry* existing_pkg = NULL;
PackageEntryTable* package_table = nullptr;
PackageEntry* existing_pkg = nullptr;
{
MutexLocker ml(THREAD, Module_lock);
if (num_packages > 0) {
package_table = get_package_entry_table(h_loader);
assert(package_table != NULL, "Missing package_table");
assert(package_table != nullptr, "Missing package_table");
// Check that none of the packages exist in the class loader's package table.
for (int x = 0; x < pkg_list->length(); x++) {
existing_pkg = package_table->locked_lookup_only(pkg_list->at(x));
if (existing_pkg != NULL) {
if (existing_pkg != nullptr) {
// This could be because the module was already defined. If so,
// report that error instead of the package error.
if (module_table->lookup_only(module_symbol) != NULL) {
if (module_table->lookup_only(module_symbol) != nullptr) {
dupl_modules = true;
}
break;
@ -396,16 +396,16 @@ void Modules::define_module(Handle module, jboolean is_open, jstring version,
} // if (num_packages > 0)...
// Add the module and its packages.
if (!dupl_modules && existing_pkg == NULL) {
if (module_table->lookup_only(module_symbol) == NULL) {
if (!dupl_modules && existing_pkg == nullptr) {
if (module_table->lookup_only(module_symbol) == nullptr) {
// Create the entry for this module in the class loader's module entry table.
ModuleEntry* module_entry = module_table->locked_create_entry(module,
(is_open == JNI_TRUE), module_symbol,
version_symbol, location_symbol, loader_data);
assert(module_entry != NULL, "module_entry creation failed");
assert(module_entry != nullptr, "module_entry creation failed");
// Add the packages.
assert(pkg_list->length() == 0 || package_table != NULL, "Bad package table");
assert(pkg_list->length() == 0 || package_table != nullptr, "Bad package table");
for (int y = 0; y < pkg_list->length(); y++) {
package_table->locked_create_entry(pkg_list->at(y), module_entry);
@ -427,18 +427,18 @@ void Modules::define_module(Handle module, jboolean is_open, jstring version,
if (dupl_modules) {
THROW_MSG(vmSymbols::java_lang_IllegalStateException(),
err_msg("Module %s is already defined", module_name));
} else if (existing_pkg != NULL) {
} else if (existing_pkg != nullptr) {
throw_dup_pkg_exception(module_name, existing_pkg, CHECK);
}
log_info(module, load)("%s location: %s", module_name,
location_symbol != NULL ? location_symbol->as_C_string() : "NULL");
location_symbol != nullptr ? location_symbol->as_C_string() : "null");
LogTarget(Debug, module) lt;
if (lt.is_enabled()) {
LogStream ls(lt);
ls.print("define_module(): creation of module: %s, version: %s, location: %s, ",
module_name, version_symbol != NULL ? version_symbol->as_C_string() : "NULL",
location_symbol != NULL ? location_symbol->as_C_string() : "NULL");
module_name, version_symbol != nullptr ? version_symbol->as_C_string() : "null",
location_symbol != nullptr ? location_symbol->as_C_string() : "null");
loader_data->print_value_on(&ls);
ls.print_cr(", package #: %d", pkg_list->length());
for (int y = 0; y < pkg_list->length(); y++) {
@ -590,7 +590,7 @@ void Modules::define_archived_modules(Handle h_platform_loader, Handle h_system_
// system_loader_data here is always an instance of jdk.internal.loader.ClassLoader$AppClassLoader.
// However, if -Djava.system.class.loader=xxx is specified, java_platform_loader() would
// be an instance of a user-defined class, so make sure this never happens.
assert(Arguments::get_property("java.system.class.loader") == NULL,
assert(Arguments::get_property("java.system.class.loader") == nullptr,
"archived full module should have been disabled if -Djava.system.class.loader is specified");
ClassLoaderDataShared::restore_java_system_loader_from_archive(system_loader_data);
}
@ -616,14 +616,14 @@ void Modules::set_bootloader_unnamed_module(Handle module, TRAPS) {
// Ensure that this is an unnamed module
oop name = java_lang_Module::name(module());
if (name != NULL) {
if (name != nullptr) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"boot loader's unnamed module's java.lang.Module has a name");
}
// Validate java_base's loader is the boot loader.
oop loader = java_lang_Module::loader(module());
if (loader != NULL) {
if (loader != nullptr) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Class loader must be the boot class loader");
}
@ -633,7 +633,7 @@ void Modules::set_bootloader_unnamed_module(Handle module, TRAPS) {
// Set java.lang.Module for the boot loader's unnamed module
ClassLoaderData* boot_loader_data = ClassLoaderData::the_null_class_loader_data();
ModuleEntry* unnamed_module = boot_loader_data->unnamed_module();
assert(unnamed_module != NULL, "boot loader's unnamed ModuleEntry not defined");
assert(unnamed_module != nullptr, "boot loader's unnamed ModuleEntry not defined");
unnamed_module->set_module(boot_loader_data->add_handle(module));
// Store pointer to the ModuleEntry in the unnamed module's java.lang.Module object.
java_lang_Module::set_module_entry(module(), unnamed_module);
@ -642,7 +642,7 @@ void Modules::set_bootloader_unnamed_module(Handle module, TRAPS) {
void Modules::add_module_exports(Handle from_module, jstring package_name, Handle to_module, TRAPS) {
check_cds_restrictions(CHECK);
if (package_name == NULL) {
if (package_name == nullptr) {
THROW_MSG(vmSymbols::java_lang_NullPointerException(),
"package is null");
}
@ -651,7 +651,7 @@ void Modules::add_module_exports(Handle from_module, jstring package_name, Handl
"from_module is null");
}
ModuleEntry* from_module_entry = get_module_entry(from_module, CHECK);
if (from_module_entry == NULL) {
if (from_module_entry == nullptr) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"from_module cannot be found");
}
@ -661,16 +661,16 @@ void Modules::add_module_exports(Handle from_module, jstring package_name, Handl
ModuleEntry* to_module_entry;
if (to_module.is_null()) {
to_module_entry = NULL; // It's an unqualified export.
to_module_entry = nullptr; // It's an unqualified export.
} else {
to_module_entry = get_module_entry(to_module, CHECK);
if (to_module_entry == NULL) {
if (to_module_entry == nullptr) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"to_module is invalid");
}
}
PackageEntry* package_entry = NULL;
PackageEntry* package_entry = nullptr;
char buf[128];
int package_len;
@ -682,16 +682,16 @@ void Modules::add_module_exports(Handle from_module, jstring package_name, Handl
// Do nothing if modules are the same
// If the package is not found we'll throw an exception later
if (from_module_entry != to_module_entry &&
package_entry != NULL) {
package_entry != nullptr) {
package_entry->set_exported(to_module_entry);
}
}
// Handle errors and logging outside locked section
if (package_entry == NULL) {
if (package_entry == nullptr) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
err_msg("Package %s not found in from_module %s",
pkg != NULL ? pkg : "",
pkg != nullptr ? pkg : "",
from_module_entry->name()->as_C_string()));
}
@ -699,7 +699,7 @@ void Modules::add_module_exports(Handle from_module, jstring package_name, Handl
log_debug(module)("add_module_exports(): package %s in module %s is exported to module %s",
package_entry->name()->as_C_string(),
from_module_entry->name()->as_C_string(),
to_module_entry == NULL ? "NULL" :
to_module_entry == nullptr ? "null" :
to_module_entry->is_named() ?
to_module_entry->name()->as_C_string() : UNNAMED_MODULE);
}
@ -724,7 +724,7 @@ void Modules::add_reads_module(Handle from_module, Handle to_module, TRAPS) {
}
ModuleEntry* from_module_entry = get_module_entry(from_module, CHECK);
if (from_module_entry == NULL) {
if (from_module_entry == nullptr) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"from_module is not valid");
}
@ -732,19 +732,19 @@ void Modules::add_reads_module(Handle from_module, Handle to_module, TRAPS) {
ModuleEntry* to_module_entry;
if (!to_module.is_null()) {
to_module_entry = get_module_entry(to_module, CHECK);
if (to_module_entry == NULL) {
if (to_module_entry == nullptr) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"to_module is invalid");
}
} else {
to_module_entry = NULL;
to_module_entry = nullptr;
}
ResourceMark rm(THREAD);
log_debug(module)("add_reads_module(): Adding read from module %s to module %s",
from_module_entry->is_named() ?
from_module_entry->name()->as_C_string() : UNNAMED_MODULE,
to_module_entry == NULL ? "all unnamed" :
to_module_entry == nullptr ? "all unnamed" :
(to_module_entry->is_named() ?
to_module_entry->name()->as_C_string() : UNNAMED_MODULE));
@ -759,14 +759,14 @@ jobject Modules::get_module(jclass clazz, TRAPS) {
assert(ModuleEntryTable::javabase_defined(),
"Attempt to call get_module before " JAVA_BASE_NAME " is defined");
if (clazz == NULL) {
if (clazz == nullptr) {
THROW_MSG_(vmSymbols::java_lang_NullPointerException(),
"class is null", JNI_FALSE);
}
oop mirror = JNIHandles::resolve_non_null(clazz);
if (mirror == NULL) {
log_debug(module)("get_module(): no mirror, returning NULL");
return NULL;
if (mirror == nullptr) {
log_debug(module)("get_module(): no mirror, returning nullptr");
return nullptr;
}
if (!java_lang_Class::is_instance(mirror)) {
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
@ -775,7 +775,7 @@ jobject Modules::get_module(jclass clazz, TRAPS) {
oop module = java_lang_Class::module(mirror);
assert(module != NULL, "java.lang.Class module field not set");
assert(module != nullptr, "java.lang.Class module field not set");
assert(java_lang_Module::is_instance(module), "module is not an instance of type java.lang.Module");
LogTarget(Debug,module) lt;
@ -784,13 +784,13 @@ jobject Modules::get_module(jclass clazz, TRAPS) {
LogStream ls(lt);
Klass* klass = java_lang_Class::as_Klass(mirror);
oop module_name = java_lang_Module::name(module);
if (module_name != NULL) {
if (module_name != nullptr) {
ls.print("get_module(): module ");
java_lang_String::print(module_name, tty);
} else {
ls.print("get_module(): Unnamed Module");
}
if (klass != NULL) {
if (klass != nullptr) {
ls.print_cr(" for class %s", klass->external_name());
} else {
ls.print_cr(" for primitive class");
@ -805,20 +805,20 @@ oop Modules::get_named_module(Handle h_loader, const char* package_name) {
"Attempt to call get_named_module before " JAVA_BASE_NAME " is defined");
assert(h_loader.is_null() || java_lang_ClassLoader::is_subclass(h_loader->klass()),
"Class loader is not a subclass of java.lang.ClassLoader");
assert(package_name != NULL, "the package_name should not be NULL");
assert(package_name != nullptr, "the package_name should not be null");
if (strlen(package_name) == 0) {
return NULL;
return nullptr;
}
TempNewSymbol package_sym = SymbolTable::new_symbol(package_name);
const PackageEntry* const pkg_entry =
get_package_entry_by_name(package_sym, h_loader);
const ModuleEntry* const module_entry = (pkg_entry != NULL ? pkg_entry->module() : NULL);
const ModuleEntry* const module_entry = (pkg_entry != nullptr ? pkg_entry->module() : nullptr);
if (module_entry != NULL && module_entry->module() != NULL && module_entry->is_named()) {
if (module_entry != nullptr && module_entry->module() != nullptr && module_entry->is_named()) {
return module_entry->module();
}
return NULL;
return nullptr;
}
// Export package in module to all unnamed modules.
@ -828,12 +828,12 @@ void Modules::add_module_exports_to_all_unnamed(Handle module, jstring package_n
THROW_MSG(vmSymbols::java_lang_NullPointerException(),
"module is null");
}
if (package_name == NULL) {
if (package_name == nullptr) {
THROW_MSG(vmSymbols::java_lang_NullPointerException(),
"package is null");
}
ModuleEntry* module_entry = get_module_entry(module, CHECK);
if (module_entry == NULL) {
if (module_entry == nullptr) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"module is invalid");
}
@ -846,22 +846,22 @@ void Modules::add_module_exports_to_all_unnamed(Handle module, jstring package_n
char buf[128];
int pkg_len;
const char* pkg = as_internal_package(JNIHandles::resolve_non_null(package_name), buf, sizeof(buf), pkg_len);
PackageEntry* package_entry = NULL;
PackageEntry* package_entry = nullptr;
{
MutexLocker m1(THREAD, Module_lock);
package_entry = get_locked_package_entry(module_entry, pkg, pkg_len);
// Mark package as exported to all unnamed modules.
if (package_entry != NULL) {
if (package_entry != nullptr) {
package_entry->set_is_exported_allUnnamed();
}
}
// Handle errors and logging outside locked section
if (package_entry == NULL) {
if (package_entry == nullptr) {
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
err_msg("Package %s not found in module %s",
pkg != NULL ? pkg : "",
pkg != nullptr ? pkg : "",
module_entry->name()->as_C_string()));
}

View File

@ -105,8 +105,8 @@ public:
static jobject get_module(jclass clazz, TRAPS);
// Return the java.lang.Module object for this class loader and package.
// Returns NULL if the package name is empty, if the resulting package
// entry is NULL, if the module is not found or is unnamed.
// Returns null if the package name is empty, if the resulting package
// entry is null, if the module is not found or is unnamed.
// The package should contain /'s, not .'s, as in java/lang, not java.lang.
static oop get_named_module(Handle h_loader, const char* package);

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
@ -47,7 +47,7 @@ PackageEntry::PackageEntry(Symbol* name, ModuleEntry* module) :
_export_flags(0),
_classpath_index(-1),
_must_walk_exports(false),
_qualified_exports(NULL),
_qualified_exports(nullptr),
_defined_by_cds_in_class_path(0)
{
// name can't be null
@ -64,7 +64,7 @@ PackageEntry::~PackageEntry() {
// Returns true if this package specifies m as a qualified export, including through an unnamed export
bool PackageEntry::is_qexported_to(ModuleEntry* m) const {
assert(Module_lock->owned_by_self(), "should have the Module_lock");
assert(m != NULL, "No module to lookup in this package's qualified exports list");
assert(m != nullptr, "No module to lookup in this package's qualified exports list");
if (is_exported_allUnnamed() && !m->is_named()) {
return true;
} else if (!has_qual_exports_list()) {
@ -100,15 +100,15 @@ void PackageEntry::set_export_walk_required(ClassLoaderData* m_loader_data) {
assert_locked_or_safepoint(Module_lock);
ModuleEntry* this_pkg_mod = module();
if (!_must_walk_exports &&
(this_pkg_mod == NULL || this_pkg_mod->loader_data() != m_loader_data) &&
(this_pkg_mod == nullptr || this_pkg_mod->loader_data() != m_loader_data) &&
!m_loader_data->is_builtin_class_loader_data()) {
_must_walk_exports = true;
if (log_is_enabled(Trace, module)) {
ResourceMark rm;
assert(name() != NULL, "PackageEntry without a valid name");
assert(name() != nullptr, "PackageEntry without a valid name");
log_trace(module)("PackageEntry::set_export_walk_required(): package %s defined in module %s, exports list must be walked",
name()->as_C_string(),
(this_pkg_mod == NULL || this_pkg_mod->name() == NULL) ?
(this_pkg_mod == nullptr || this_pkg_mod->name() == nullptr) ?
UNNAMED_MODULE : this_pkg_mod->name()->as_C_string());
}
}
@ -123,8 +123,8 @@ void PackageEntry::set_exported(ModuleEntry* m) {
return;
}
if (m == NULL) {
// NULL indicates the package is being unqualifiedly exported. Clean up
if (m == nullptr) {
// null indicates the package is being unqualifiedly exported. Clean up
// the qualified list at the next safepoint.
set_unqual_exported();
} else {
@ -150,7 +150,7 @@ void PackageEntry::set_is_exported_allUnnamed() {
void PackageEntry::purge_qualified_exports() {
assert_locked_or_safepoint(Module_lock);
if (_must_walk_exports &&
_qualified_exports != NULL &&
_qualified_exports != nullptr &&
!_qualified_exports->is_empty()) {
// This package's _must_walk_exports flag will be reset based
@ -159,11 +159,11 @@ void PackageEntry::purge_qualified_exports() {
if (log_is_enabled(Trace, module)) {
ResourceMark rm;
assert(name() != NULL, "PackageEntry without a valid name");
assert(name() != nullptr, "PackageEntry without a valid name");
ModuleEntry* pkg_mod = module();
log_trace(module)("PackageEntry::purge_qualified_exports(): package %s defined in module %s, exports list being walked",
name()->as_C_string(),
(pkg_mod == NULL || pkg_mod->name() == NULL) ? UNNAMED_MODULE : pkg_mod->name()->as_C_string());
(pkg_mod == nullptr || pkg_mod->name() == nullptr) ? UNNAMED_MODULE : pkg_mod->name()->as_C_string());
}
// Go backwards because this removes entries that are dead.
@ -182,10 +182,10 @@ void PackageEntry::purge_qualified_exports() {
}
void PackageEntry::delete_qualified_exports() {
if (_qualified_exports != NULL) {
if (_qualified_exports != nullptr) {
delete _qualified_exports;
}
_qualified_exports = NULL;
_qualified_exports = nullptr;
}
PackageEntryTable::PackageEntryTable() { }
@ -216,17 +216,17 @@ typedef ResourceHashtable<
PackageEntry*,
557, // prime number
AnyObj::C_HEAP> ArchivedPackageEntries;
static ArchivedPackageEntries* _archived_packages_entries = NULL;
static ArchivedPackageEntries* _archived_packages_entries = nullptr;
PackageEntry* PackageEntry::allocate_archived_entry() const {
assert(!in_unnamed_module(), "unnamed packages/modules are not archived");
PackageEntry* archived_entry = (PackageEntry*)ArchiveBuilder::rw_region_alloc(sizeof(PackageEntry));
memcpy((void*)archived_entry, (void*)this, sizeof(PackageEntry));
if (_archived_packages_entries == NULL) {
if (_archived_packages_entries == nullptr) {
_archived_packages_entries = new (mtClass)ArchivedPackageEntries();
}
assert(_archived_packages_entries->get(this) == NULL, "Each PackageEntry must not be shared across PackageEntryTables");
assert(_archived_packages_entries->get(this) == nullptr, "Each PackageEntry must not be shared across PackageEntryTables");
_archived_packages_entries->put(this, archived_entry);
return archived_entry;
@ -234,10 +234,10 @@ PackageEntry* PackageEntry::allocate_archived_entry() const {
PackageEntry* PackageEntry::get_archived_entry(PackageEntry* orig_entry) {
PackageEntry** ptr = _archived_packages_entries->get(orig_entry);
if (ptr != NULL) {
if (ptr != nullptr) {
return *ptr;
} else {
return NULL;
return nullptr;
}
}
@ -331,7 +331,7 @@ void PackageEntryTable::load_archived_entries(Array<PackageEntry*>* archived_pac
// was taken by caller.
void PackageEntryTable::locked_create_entry(Symbol* name, ModuleEntry* module) {
assert(Module_lock->owned_by_self(), "should have the Module_lock");
assert(locked_lookup_only(name) == NULL, "Package entry already exists");
assert(locked_lookup_only(name) == nullptr, "Package entry already exists");
PackageEntry* entry = new PackageEntry(name, module);
bool created = _table.put(name, entry);
assert(created, "must be");
@ -376,8 +376,8 @@ void PackageEntryTable::verify_javabase_packages(GrowableArray<Symbol*> *pkg_lis
assert_lock_strong(Module_lock);
auto verifier = [&] (const SymbolHandle& name, PackageEntry*& entry) {
ModuleEntry* m = entry->module();
Symbol* module_name = (m == NULL ? NULL : m->name());
if (module_name != NULL &&
Symbol* module_name = (m == nullptr ? nullptr : m->name());
if (module_name != nullptr &&
(module_name->fast_compare(vmSymbols::java_base()) == 0) &&
!pkg_list->contains(entry->name())) {
ResourceMark rm;
@ -391,7 +391,7 @@ void PackageEntryTable::verify_javabase_packages(GrowableArray<Symbol*> *pkg_lis
// iteration of qualified exports
void PackageEntry::package_exports_do(ModuleClosure* f) {
assert_locked_or_safepoint(Module_lock);
assert(f != NULL, "invariant");
assert(f != nullptr, "invariant");
if (has_qual_exports_list()) {
int qe_len = _qualified_exports->length();
@ -404,7 +404,7 @@ void PackageEntry::package_exports_do(ModuleClosure* f) {
bool PackageEntry::exported_pending_delete() const {
assert_locked_or_safepoint(Module_lock);
return (is_unqual_exported() && _qualified_exports != NULL);
return (is_unqual_exported() && _qualified_exports != nullptr);
}
// Remove dead entries from all packages' exported list

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
@ -151,7 +151,7 @@ public:
// return true.
bool has_qual_exports_list() const {
assert_locked_or_safepoint(Module_lock);
return (!is_unqual_exported() && _qualified_exports != NULL);
return (!is_unqual_exported() && _qualified_exports != nullptr);
}
bool is_exported_allUnnamed() const {
assert_locked_or_safepoint(Module_lock);

View File

@ -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
@ -69,8 +69,8 @@ private:
public:
SeenThread(JavaThread* thread) {
_thread = thread;
_stnext = NULL;
_stprev = NULL;
_stnext = nullptr;
_stprev = nullptr;
}
JavaThread* thread() const { return _thread;}
void set_thread(JavaThread* thread) { _thread = thread; }
@ -81,7 +81,7 @@ public:
void print_action_queue(outputStream* st) {
SeenThread* seen = this;
while (seen != NULL) {
while (seen != nullptr) {
seen->thread()->print_value_on(st);
st->print(", ");
seen = seen->next();
@ -90,7 +90,7 @@ public:
};
SeenThread* PlaceholderEntry::actionToQueue(PlaceholderTable::classloadAction action) {
SeenThread* queuehead = NULL;
SeenThread* queuehead = nullptr;
switch (action) {
case PlaceholderTable::LOAD_INSTANCE:
queuehead = _loadInstanceThreadQ;
@ -132,15 +132,15 @@ void PlaceholderEntry::add_seen_thread(JavaThread* thread, PlaceholderTable::cla
SeenThread* threadEntry = new SeenThread(thread);
SeenThread* seen = actionToQueue(action);
assert(action != PlaceholderTable::LOAD_INSTANCE || !EnableWaitForParallelLoad || seen == NULL,
assert(action != PlaceholderTable::LOAD_INSTANCE || !EnableWaitForParallelLoad || seen == nullptr,
"Only one LOAD_INSTANCE allowed at a time");
if (seen == NULL) {
if (seen == nullptr) {
set_threadQ(threadEntry, action);
return;
}
SeenThread* next;
while ((next = seen->next()) != NULL) {
while ((next = seen->next()) != nullptr) {
seen = next;
}
seen->set_next(threadEntry);
@ -170,7 +170,7 @@ bool PlaceholderEntry::remove_seen_thread(JavaThread* thread, PlaceholderTable::
assert_lock_strong(SystemDictionary_lock);
SeenThread* threadQ = actionToQueue(action);
SeenThread* seen = threadQ;
SeenThread* prev = NULL;
SeenThread* prev = nullptr;
while (seen) {
if (thread == seen->thread()) {
if (prev) {
@ -187,7 +187,7 @@ bool PlaceholderEntry::remove_seen_thread(JavaThread* thread, PlaceholderTable::
prev = seen;
seen = seen->next();
}
return (actionToQueue(action) == NULL);
return (actionToQueue(action) == nullptr);
}
@ -200,7 +200,7 @@ bool PlaceholderEntry::remove_seen_thread(JavaThread* thread, PlaceholderTable::
PlaceholderEntry* add_entry(Symbol* class_name, ClassLoaderData* loader_data,
Symbol* supername){
assert_locked_or_safepoint(SystemDictionary_lock);
assert(class_name != NULL, "adding NULL obj");
assert(class_name != nullptr, "adding nullptr obj");
PlaceholderEntry entry;
entry.set_supername(supername);
@ -255,9 +255,9 @@ PlaceholderEntry* PlaceholderTable::find_and_add(Symbol* name,
classloadAction action,
Symbol* supername,
JavaThread* thread) {
assert(action != LOAD_SUPER || supername != NULL, "must have a super class name");
assert(action != LOAD_SUPER || supername != nullptr, "must have a super class name");
PlaceholderEntry* probe = get_entry(name, loader_data);
if (probe == NULL) {
if (probe == nullptr) {
// Nothing found, add place holder
probe = add_entry(name, loader_data, supername);
} else {
@ -289,12 +289,12 @@ void PlaceholderTable::find_and_remove(Symbol* name, ClassLoaderData* loader_dat
JavaThread* thread) {
assert_locked_or_safepoint(SystemDictionary_lock);
PlaceholderEntry* probe = get_entry(name, loader_data);
if (probe != NULL) {
if (probe != nullptr) {
log(name, probe, "find_and_remove", action);
probe->remove_seen_thread(thread, action);
// If no other threads using this entry, and this thread is not using this entry for other states
if ((probe->superThreadQ() == NULL) && (probe->loadInstanceThreadQ() == NULL)
&& (probe->defineThreadQ() == NULL) && (probe->definer() == NULL)) {
if ((probe->superThreadQ() == nullptr) && (probe->loadInstanceThreadQ() == nullptr)
&& (probe->defineThreadQ() == nullptr) && (probe->definer() == nullptr)) {
probe->clear_supername();
remove_entry(name, loader_data);
}
@ -308,15 +308,15 @@ void PlaceholderKey::print_on(outputStream* st) const {
}
void PlaceholderEntry::print_on(outputStream* st) const {
if (supername() != NULL) {
if (supername() != nullptr) {
st->print(", supername ");
supername()->print_value_on(st);
}
if (definer() != NULL) {
if (definer() != nullptr) {
st->print(", definer ");
definer()->print_value_on(st);
}
if (instance_klass() != NULL) {
if (instance_klass() != nullptr) {
st->print(", InstanceKlass ");
instance_klass()->print_value_on(st);
}

View File

@ -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
@ -132,15 +132,15 @@ class PlaceholderEntry {
void set_defineThreadQ(SeenThread* SeenThread) { _defineThreadQ = SeenThread; }
bool super_load_in_progress() {
return (_superThreadQ != NULL);
return (_superThreadQ != nullptr);
}
bool instance_load_in_progress() {
return (_loadInstanceThreadQ != NULL);
return (_loadInstanceThreadQ != nullptr);
}
bool define_class_in_progress() {
return (_defineThreadQ != NULL);
return (_defineThreadQ != nullptr);
}
// Used for ClassCircularityError checking

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@ -72,13 +72,13 @@ class CleanProtectionDomainEntries : public CLDClosure {
void do_cld(ClassLoaderData* data) {
Dictionary* dictionary = data->dictionary();
if (dictionary != NULL) {
if (dictionary != nullptr) {
dictionary->clean_cached_protection_domains(_delete_list);
}
}
};
static GrowableArray<ProtectionDomainEntry*>* _delete_list = NULL;
static GrowableArray<ProtectionDomainEntry*>* _delete_list = nullptr;
class HandshakeForPD : public HandshakeClosure {
public:
@ -115,7 +115,7 @@ void ProtectionDomainCacheTable::unlink() {
assert(java_lang_System::allow_security_manager(), "should not be called otherwise");
// Create a list for holding deleted entries
if (_delete_list == NULL) {
if (_delete_list == nullptr) {
_delete_list = new (mtClass)
GrowableArray<ProtectionDomainEntry*>(20, mtClass);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -64,7 +64,7 @@ void ResolutionErrorTable::add_entry(const constantPoolHandle& pool, int cp_inde
Symbol* cause, Symbol* cause_msg)
{
assert_locked_or_safepoint(SystemDictionary_lock);
assert(!pool.is_null() && error != NULL, "adding NULL obj");
assert(!pool.is_null() && error != nullptr, "adding null obj");
ResolutionErrorKey key(pool(), cp_index);
ResolutionErrorEntry *entry = new ResolutionErrorEntry(error, message, cause, cause_msg);
@ -76,7 +76,7 @@ void ResolutionErrorTable::add_entry(const constantPoolHandle& pool, int cp_inde
const char* message)
{
assert_locked_or_safepoint(SystemDictionary_lock);
assert(!pool.is_null() && message != NULL, "adding NULL obj");
assert(!pool.is_null() && message != nullptr, "adding null obj");
ResolutionErrorKey key(pool(), cp_index);
ResolutionErrorEntry *entry = new ResolutionErrorEntry(message);
@ -112,7 +112,7 @@ ResolutionErrorEntry::~ResolutionErrorEntry() {
Symbol::maybe_decrement_refcount(_cause);
Symbol::maybe_decrement_refcount(_cause_msg);
if (nest_host_error() != NULL) {
if (nest_host_error() != nullptr) {
FREE_C_HEAP_ARRAY(char, nest_host_error());
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, 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
@ -85,7 +85,7 @@ class StackMapFrame : public ResourceObj {
_stack[i] = VerificationType::bogus_type();
}
}
_verifier = NULL;
_verifier = nullptr;
}
public:

View File

@ -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
@ -160,7 +160,7 @@ StackMapReader::StackMapReader(ClassVerifier* v, StackMapStream* stream, char* c
int32_t StackMapReader::chop(
VerificationType* locals, int32_t length, int32_t chops) {
if (locals == NULL) return -1;
if (locals == nullptr) return -1;
int32_t pos = length - 1;
for (int32_t i=0; i<chops; i++) {
if (locals[pos].is_category2_2nd()) {
@ -192,7 +192,7 @@ VerificationType StackMapReader::parse_verification_type(u1* flags, TRAPS) {
return VerificationType::reference_type(_cp->klass_name_at(class_index));
}
if (tag == ITEM_UninitializedThis) {
if (flags != NULL) {
if (flags != nullptr) {
*flags |= FLAG_THIS_UNINIT;
}
return VerificationType::uninitialized_this_type();
@ -215,7 +215,7 @@ StackMapFrame* StackMapReader::next(
StackMapFrame* pre_frame, bool first, u2 max_locals, u2 max_stack, TRAPS) {
StackMapFrame* frame;
int offset;
VerificationType* locals = NULL;
VerificationType* locals = nullptr;
u1 frame_type = _stream->get_u1(CHECK_NULL);
if (frame_type < 64) {
// same_frame
@ -232,8 +232,8 @@ StackMapFrame* StackMapReader::next(
}
frame = new StackMapFrame(
offset, pre_frame->flags(), pre_frame->locals_size(), 0,
max_locals, max_stack, locals, NULL, _verifier);
if (first && locals != NULL) {
max_locals, max_stack, locals, nullptr, _verifier);
if (first && locals != nullptr) {
frame->copy_locals(pre_frame);
}
return frame;
@ -254,17 +254,17 @@ StackMapFrame* StackMapReader::next(
VerificationType* stack = NEW_RESOURCE_ARRAY_IN_THREAD(
THREAD, VerificationType, 2);
u2 stack_size = 1;
stack[0] = parse_verification_type(NULL, CHECK_VERIFY_(_verifier, NULL));
stack[0] = parse_verification_type(nullptr, CHECK_VERIFY_(_verifier, nullptr));
if (stack[0].is_category2()) {
stack[1] = stack[0].to_category2_2nd();
stack_size = 2;
}
check_verification_type_array_size(
stack_size, max_stack, CHECK_VERIFY_(_verifier, NULL));
stack_size, max_stack, CHECK_VERIFY_(_verifier, nullptr));
frame = new StackMapFrame(
offset, pre_frame->flags(), pre_frame->locals_size(), stack_size,
max_locals, max_stack, locals, stack, _verifier);
if (first && locals != NULL) {
if (first && locals != nullptr) {
frame->copy_locals(pre_frame);
}
return frame;
@ -275,7 +275,7 @@ StackMapFrame* StackMapReader::next(
if (frame_type < SAME_LOCALS_1_STACK_ITEM_EXTENDED) {
// reserved frame types
_stream->stackmap_format_error(
"reserved frame type", CHECK_VERIFY_(_verifier, NULL));
"reserved frame type", CHECK_VERIFY_(_verifier, nullptr));
}
if (frame_type == SAME_LOCALS_1_STACK_ITEM_EXTENDED) {
@ -294,17 +294,17 @@ StackMapFrame* StackMapReader::next(
VerificationType* stack = NEW_RESOURCE_ARRAY_IN_THREAD(
THREAD, VerificationType, 2);
u2 stack_size = 1;
stack[0] = parse_verification_type(NULL, CHECK_VERIFY_(_verifier, NULL));
stack[0] = parse_verification_type(nullptr, CHECK_VERIFY_(_verifier, nullptr));
if (stack[0].is_category2()) {
stack[1] = stack[0].to_category2_2nd();
stack_size = 2;
}
check_verification_type_array_size(
stack_size, max_stack, CHECK_VERIFY_(_verifier, NULL));
stack_size, max_stack, CHECK_VERIFY_(_verifier, nullptr));
frame = new StackMapFrame(
offset, pre_frame->flags(), pre_frame->locals_size(), stack_size,
max_locals, max_stack, locals, stack, _verifier);
if (first && locals != NULL) {
if (first && locals != nullptr) {
frame->copy_locals(pre_frame);
}
return frame;
@ -320,7 +320,7 @@ StackMapFrame* StackMapReader::next(
if (chops != 0) {
new_length = chop(locals, length, chops);
check_verification_type_array_size(
new_length, max_locals, CHECK_VERIFY_(_verifier, NULL));
new_length, max_locals, CHECK_VERIFY_(_verifier, nullptr));
// Recompute flags since uninitializedThis could have been chopped.
flags = 0;
for (int i=0; i<new_length; i++) {
@ -337,15 +337,15 @@ StackMapFrame* StackMapReader::next(
locals = NEW_RESOURCE_ARRAY_IN_THREAD(
THREAD, VerificationType, new_length);
} else {
locals = NULL;
locals = nullptr;
}
} else {
offset = pre_frame->offset() + offset_delta + 1;
}
frame = new StackMapFrame(
offset, flags, new_length, 0, max_locals, max_stack,
locals, NULL, _verifier);
if (first && locals != NULL) {
locals, nullptr, _verifier);
if (first && locals != nullptr) {
frame->copy_locals(pre_frame);
}
return frame;
@ -370,7 +370,7 @@ StackMapFrame* StackMapReader::next(
++real_length;
}
check_verification_type_array_size(
real_length, max_locals, CHECK_VERIFY_(_verifier, NULL));
real_length, max_locals, CHECK_VERIFY_(_verifier, nullptr));
if (first) {
offset = offset_delta;
} else {
@ -378,7 +378,7 @@ StackMapFrame* StackMapReader::next(
}
frame = new StackMapFrame(
offset, flags, real_length, 0, max_locals,
max_stack, locals, NULL, _verifier);
max_stack, locals, nullptr, _verifier);
return frame;
}
if (frame_type == FULL) {
@ -401,16 +401,16 @@ StackMapFrame* StackMapReader::next(
++real_locals_size;
}
check_verification_type_array_size(
real_locals_size, max_locals, CHECK_VERIFY_(_verifier, NULL));
real_locals_size, max_locals, CHECK_VERIFY_(_verifier, nullptr));
u2 stack_size = _stream->get_u2(CHECK_NULL);
int real_stack_size = 0;
VerificationType* stack = NULL;
VerificationType* stack = nullptr;
if (stack_size > 0) {
stack = NEW_RESOURCE_ARRAY_IN_THREAD(
THREAD, VerificationType, stack_size*2);
}
for (i=0; i<stack_size; i++) {
stack[real_stack_size] = parse_verification_type(NULL, CHECK_NULL);
stack[real_stack_size] = parse_verification_type(nullptr, CHECK_NULL);
if (stack[real_stack_size].is_category2()) {
stack[real_stack_size + 1] = stack[real_stack_size].to_category2_2nd();
++real_stack_size;
@ -418,7 +418,7 @@ StackMapFrame* StackMapReader::next(
++real_stack_size;
}
check_verification_type_array_size(
real_stack_size, max_stack, CHECK_VERIFY_(_verifier, NULL));
real_stack_size, max_stack, CHECK_VERIFY_(_verifier, nullptr));
if (first) {
offset = offset_delta;
} else {
@ -431,6 +431,6 @@ StackMapFrame* StackMapReader::next(
}
_stream->stackmap_format_error(
"reserved frame type", CHECK_VERIFY_(pre_frame->verifier(), NULL));
return NULL;
"reserved frame type", CHECK_VERIFY_(pre_frame->verifier(), nullptr));
return nullptr;
}

View File

@ -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
@ -88,13 +88,13 @@ class StackMapStream : StackObj {
: _data(ah), _index(0) {
}
u1 get_u1(TRAPS) {
if (_data == NULL || _index >= _data->length()) {
if (_data == nullptr || _index >= _data->length()) {
stackmap_format_error("access beyond the end of attribute", CHECK_0);
}
return _data->at(_index++);
}
u2 get_u2(TRAPS) {
if (_data == NULL || _index >= _data->length() - 1) {
if (_data == nullptr || _index >= _data->length() - 1) {
stackmap_format_error("access beyond the end of attribute", CHECK_0);
}
u2 res = Bytes::get_Java_u2(_data->adr_at(_index));
@ -102,7 +102,7 @@ class StackMapStream : StackObj {
return res;
}
bool at_end() {
return (_data == NULL) || (_index == _data->length());
return (_data == nullptr) || (_index == _data->length());
}
static void stackmap_format_error(const char* msg, TRAPS);
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 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
@ -210,7 +210,7 @@ class stack_map_frame {
#define FRAME_TYPE_DECL(stackmap_frame_type, arg1, arg2) \
inline stackmap_frame_type* as_##stackmap_frame_type() const; \
bool is_##stackmap_frame_type() { \
return as_##stackmap_frame_type() != NULL; \
return as_##stackmap_frame_type() != nullptr; \
}
FOR_EACH_STACKMAP_FRAME_TYPE(FRAME_TYPE_DECL, x, x)
@ -252,7 +252,7 @@ class same_frame : public stack_map_frame {
}
int number_of_types() const { return 0; }
verification_type_info* types() const { return NULL; }
verification_type_info* types() const { return nullptr; }
bool is_valid_offset(int offset_delta) const {
return is_frame_type(offset_delta_to_frame_type(offset_delta));
@ -305,7 +305,7 @@ class same_frame_extended : public stack_map_frame {
}
int number_of_types() const { return 0; }
verification_type_info* types() const { return NULL; }
verification_type_info* types() const { return nullptr; }
bool is_valid_offset(int offset) const { return true; }
bool verify_subtype(address start, address end) const {
@ -344,7 +344,7 @@ class same_locals_1_stack_item_frame : public stack_map_frame {
address addr, int offset_delta, verification_type_info* vti) {
same_locals_1_stack_item_frame* sm = (same_locals_1_stack_item_frame*)addr;
sm->set_offset_delta(offset_delta);
if (vti != NULL) {
if (vti != nullptr) {
sm->set_type(vti);
}
return sm;
@ -421,7 +421,7 @@ class same_locals_1_stack_item_extended : public stack_map_frame {
(same_locals_1_stack_item_extended*)addr;
sm->set_frame_type(_frame_id);
sm->set_offset_delta(offset_delta);
if (vti != NULL) {
if (vti != nullptr) {
sm->set_type(vti);
}
return sm;
@ -521,7 +521,7 @@ class chop_frame : public stack_map_frame {
}
int number_of_types() const { return 0; }
verification_type_info* types() const { return NULL; }
verification_type_info* types() const { return nullptr; }
bool is_valid_offset(int offset) { return true; }
bool verify_subtype(address start, address end) const {
@ -568,7 +568,7 @@ class append_frame : public stack_map_frame {
append_frame* sm = (append_frame*)addr;
sm->set_appends(appends);
sm->set_offset_delta(offset_delta);
if (types != NULL) {
if (types != nullptr) {
verification_type_info* cur = sm->types();
for (int i = 0; i < appends; ++i) {
cur->copy_from(types);
@ -680,7 +680,7 @@ class full_frame : public stack_map_frame {
sm->set_frame_type(_frame_id);
sm->set_offset_delta(offset_delta);
sm->set_num_locals(num_locals);
if (locals != NULL) {
if (locals != nullptr) {
verification_type_info* cur = sm->locals();
for (int i = 0; i < num_locals; ++i) {
cur->copy_from(locals);
@ -822,13 +822,13 @@ class full_frame : public stack_map_frame {
#define VIRTUAL_DISPATCH(stack_frame_type, func_name, args) \
stack_frame_type* item_##stack_frame_type = as_##stack_frame_type(); \
if (item_##stack_frame_type != NULL) { \
if (item_##stack_frame_type != nullptr) { \
return item_##stack_frame_type->func_name args; \
}
#define VOID_VIRTUAL_DISPATCH(stack_frame_type, func_name, args) \
stack_frame_type* item_##stack_frame_type = as_##stack_frame_type(); \
if (item_##stack_frame_type != NULL) { \
if (item_##stack_frame_type != nullptr) { \
item_##stack_frame_type->func_name args; \
return; \
}
@ -855,7 +855,7 @@ int stack_map_frame::number_of_types() const {
verification_type_info* stack_map_frame::types() const {
FOR_EACH_STACKMAP_FRAME_TYPE(VIRTUAL_DISPATCH, types, ());
return NULL;
return nullptr;
}
bool stack_map_frame::is_valid_offset(int offset) const {
@ -887,7 +887,7 @@ stack_frame_type* stack_map_frame::as_##stack_frame_type() const { \
if (stack_frame_type::is_frame_type(frame_type())) { \
return (stack_frame_type*)this; \
} else { \
return NULL; \
return nullptr; \
} \
}

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;
}

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
@ -105,11 +105,11 @@ class StringTable : public CHeapObj<mtSymbol>{
// Sharing
private:
static oop lookup_shared(const jchar* name, int len, unsigned int hash) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
static oop lookup_shared(const jchar* name, int len, unsigned int hash) NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
public:
static oop lookup_shared(const jchar* name, int len) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
static oop lookup_shared(const jchar* name, int len) NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
static size_t shared_entry_count() NOT_CDS_JAVA_HEAP_RETURN_(0);
static oop create_archived_string(oop s) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
static oop create_archived_string(oop s) NOT_CDS_JAVA_HEAP_RETURN_(nullptr);
static void write_to_archive(const DumpedInternedStrings* dumped_interned_strings) NOT_CDS_JAVA_HEAP_RETURN;
static void serialize_shared_table_header(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
static void transfer_shared_strings_to_local_table() NOT_CDS_JAVA_HEAP_RETURN;

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
@ -76,7 +76,7 @@ static OffsetCompactHashtable<
// --------------------------------------------------------------------------
typedef ConcurrentHashTable<SymbolTableConfig, mtSymbol> SymbolTableHash;
static SymbolTableHash* _local_table = NULL;
static SymbolTableHash* _local_table = nullptr;
volatile bool SymbolTable::_has_work = 0;
volatile bool SymbolTable::_needs_rehashing = false;
@ -101,7 +101,7 @@ static THREAD_LOCAL bool _lookup_shared_first = false;
#endif
// Static arena for symbols that are not deallocated
Arena* SymbolTable::_arena = NULL;
Arena* SymbolTable::_arena = nullptr;
static uint64_t _alt_hash_seed = 0;
@ -229,11 +229,11 @@ Symbol* SymbolTable::allocate_symbol(const char* name, int len, bool c_heap) {
if (c_heap) {
// refcount starts as 1
sym = new (len) Symbol((const u1*)name, len, 1);
assert(sym != NULL, "new should call vm_exit_out_of_memory if C_HEAP is exhausted");
assert(sym != nullptr, "new should call vm_exit_out_of_memory if C_HEAP is exhausted");
} else if (DumpSharedSpaces) {
// See comments inside Symbol::operator new(size_t, int)
sym = new (len) Symbol((const u1*)name, len, PERM_REFCOUNT);
assert(sym != NULL, "new should call vm_exit_out_of_memory if failed to allocate symbol during DumpSharedSpaces");
assert(sym != nullptr, "new should call vm_exit_out_of_memory if failed to allocate symbol during DumpSharedSpaces");
} else {
// Allocate to global arena
MutexLocker ml(SymbolArena_lock, Mutex::_no_safepoint_check_flag); // Protect arena
@ -247,8 +247,8 @@ class SymbolsDo : StackObj {
public:
SymbolsDo(SymbolClosure *cl) : _cl(cl) {}
bool operator()(Symbol** value) {
assert(value != NULL, "expected valid value");
assert(*value != NULL, "value should point to a symbol");
assert(value != nullptr, "expected valid value");
assert(*value != nullptr, "value should point to a symbol");
_cl->do_symbol(value);
return true;
};
@ -286,14 +286,14 @@ void SymbolTable::shared_symbols_do(SymbolClosure *cl) {
Symbol* SymbolTable::lookup_dynamic(const char* name,
int len, unsigned int hash) {
Symbol* sym = do_lookup(name, len, hash);
assert((sym == NULL) || sym->refcount() != 0, "refcount must not be zero");
assert((sym == nullptr) || sym->refcount() != 0, "refcount must not be zero");
return sym;
}
#if INCLUDE_CDS
Symbol* SymbolTable::lookup_shared(const char* name,
int len, unsigned int hash) {
Symbol* sym = NULL;
Symbol* sym = nullptr;
if (!_shared_table.empty()) {
if (_alt_hash) {
// hash_code parameter may use alternate hashing algorithm but the shared table
@ -301,7 +301,7 @@ Symbol* SymbolTable::lookup_shared(const char* name,
hash = hash_shared_symbol(name, len);
}
sym = _shared_table.lookup(name, hash, len);
if (sym == NULL && DynamicArchive::is_mapped()) {
if (sym == nullptr && DynamicArchive::is_mapped()) {
sym = _dynamic_shared_table.lookup(name, hash, len);
}
}
@ -314,15 +314,15 @@ Symbol* SymbolTable::lookup_common(const char* name,
Symbol* sym;
if (_lookup_shared_first) {
sym = lookup_shared(name, len, hash);
if (sym == NULL) {
if (sym == nullptr) {
_lookup_shared_first = false;
sym = lookup_dynamic(name, len, hash);
}
} else {
sym = lookup_dynamic(name, len, hash);
if (sym == NULL) {
if (sym == nullptr) {
sym = lookup_shared(name, len, hash);
if (sym != NULL) {
if (sym != nullptr) {
_lookup_shared_first = true;
}
}
@ -333,7 +333,7 @@ Symbol* SymbolTable::lookup_common(const char* name,
Symbol* SymbolTable::new_symbol(const char* name, int len) {
unsigned int hash = hash_symbol(name, len, _alt_hash);
Symbol* sym = lookup_common(name, len, hash);
if (sym == NULL) {
if (sym == nullptr) {
sym = do_add_if_needed(name, len, hash, true);
}
assert(sym->refcount() != 0, "lookup should have incremented the count");
@ -348,7 +348,7 @@ Symbol* SymbolTable::new_symbol(const Symbol* sym, int begin, int end) {
int len = end - begin;
unsigned int hash = hash_symbol(name, len, _alt_hash);
Symbol* found = lookup_common(name, len, hash);
if (found == NULL) {
if (found == nullptr) {
found = do_add_if_needed(name, len, hash, true);
}
return found;
@ -366,8 +366,8 @@ public:
return _hash;
}
bool equals(Symbol** value, bool* is_dead) {
assert(value != NULL, "expected valid value");
assert(*value != NULL, "value should point to a symbol");
assert(value != nullptr, "expected valid value");
assert(*value != nullptr, "value should point to a symbol");
Symbol *sym = *value;
if (sym->equals(_str, _len)) {
if (sym->try_increment_refcount()) {
@ -388,10 +388,10 @@ public:
class SymbolTableGet : public StackObj {
Symbol* _return;
public:
SymbolTableGet() : _return(NULL) {}
SymbolTableGet() : _return(nullptr) {}
void operator()(Symbol** value) {
assert(value != NULL, "expected valid value");
assert(*value != NULL, "value should point to a symbol");
assert(value != nullptr, "expected valid value");
assert(*value != nullptr, "value should point to a symbol");
_return = *value;
}
Symbol* get_res_sym() const {
@ -407,7 +407,7 @@ Symbol* SymbolTable::do_lookup(const char* name, int len, uintx hash) {
_local_table->get(thread, lookup, stg, &rehash_warning);
update_needs_rehash(rehash_warning);
Symbol* sym = stg.get_res_sym();
assert((sym == NULL) || sym->refcount() != 0, "found dead symbol");
assert((sym == nullptr) || sym->refcount() != 0, "found dead symbol");
return sym;
}
@ -460,7 +460,7 @@ void SymbolTable::new_symbols(ClassLoaderData* loader_data, const constantPoolHa
const char *name = names[i];
int len = lengths[i];
unsigned int hash = hashValues[i];
assert(lookup_shared(name, len, hash) == NULL, "must have checked already");
assert(lookup_shared(name, len, hash) == nullptr, "must have checked already");
Symbol* sym = do_add_if_needed(name, len, hash, c_heap);
assert(sym->refcount() != 0, "lookup should have incremented the count");
cp->symbol_at_put(cp_indices[i], sym);
@ -472,7 +472,7 @@ Symbol* SymbolTable::do_add_if_needed(const char* name, int len, uintx hash, boo
SymbolTableGet stg;
bool clean_hint = false;
bool rehash_warning = false;
Symbol* sym = NULL;
Symbol* sym = nullptr;
Thread* current = Thread::current();
do {
@ -496,7 +496,7 @@ Symbol* SymbolTable::do_add_if_needed(const char* name, int len, uintx hash, boo
check_concurrent_work();
}
assert((sym == NULL) || sym->refcount() != 0, "found dead symbol");
assert((sym == nullptr) || sym->refcount() != 0, "found dead symbol");
return sym;
}
@ -504,7 +504,7 @@ Symbol* SymbolTable::new_permanent_symbol(const char* name) {
unsigned int hash = 0;
int len = (int)strlen(name);
Symbol* sym = SymbolTable::lookup_only(name, len, hash);
if (sym == NULL) {
if (sym == nullptr) {
sym = do_add_if_needed(name, len, hash, false);
}
if (!sym->is_permanent()) {
@ -516,8 +516,8 @@ Symbol* SymbolTable::new_permanent_symbol(const char* name) {
struct SizeFunc : StackObj {
size_t operator()(Symbol** value) {
assert(value != NULL, "expected valid value");
assert(*value != NULL, "value should point to a symbol");
assert(value != nullptr, "expected valid value");
assert(*value != nullptr, "value should point to a symbol");
return (*value)->size() * HeapWordSize;
};
};
@ -546,8 +546,8 @@ void SymbolTable::print_table_statistics(outputStream* st) {
class VerifySymbols : StackObj {
public:
bool operator()(Symbol** value) {
guarantee(value != NULL, "expected valid value");
guarantee(*value != NULL, "value should point to a symbol");
guarantee(value != nullptr, "expected valid value");
guarantee(*value != nullptr, "value should point to a symbol");
Symbol* sym = *value;
guarantee(sym->equals((const char*)sym->bytes(), sym->utf8_length()),
"symbol must be internally consistent");
@ -578,8 +578,8 @@ class DumpSymbol : StackObj {
public:
DumpSymbol(Thread* thr, outputStream* st) : _thr(thr), _st(st) {}
bool operator()(Symbol** value) {
assert(value != NULL, "expected valid value");
assert(*value != NULL, "value should point to a symbol");
assert(value != nullptr, "expected valid value");
assert(*value != nullptr, "value should point to a symbol");
print_symbol(_st, *value);
return true;
};
@ -590,7 +590,7 @@ class DumpSharedSymbol : StackObj {
public:
DumpSharedSymbol(outputStream* st) : _st(st) {}
void do_value(Symbol* value) {
assert(value != NULL, "value should point to a symbol");
assert(value != nullptr, "value should point to a symbol");
print_symbol(_st, value);
};
};
@ -696,8 +696,8 @@ struct SymbolTableDoDelete : StackObj {
size_t _deleted;
SymbolTableDoDelete() : _deleted(0) {}
void operator()(Symbol** value) {
assert(value != NULL, "expected valid value");
assert(*value != NULL, "value should point to a symbol");
assert(value != nullptr, "expected valid value");
assert(*value != nullptr, "value should point to a symbol");
Symbol *sym = *value;
assert(sym->refcount() == 0, "refcount");
_deleted++;
@ -708,8 +708,8 @@ struct SymbolTableDeleteCheck : StackObj {
size_t _processed;
SymbolTableDeleteCheck() : _processed(0) {}
bool operator()(Symbol** value) {
assert(value != NULL, "expected valid value");
assert(*value != NULL, "value should point to a symbol");
assert(value != nullptr, "expected valid value");
assert(*value != nullptr, "value should point to a symbol");
_processed++;
Symbol *sym = *value;
return (sym->refcount() == 0);
@ -850,8 +850,8 @@ public:
}
}
bool operator()(Symbol** value) {
assert(value != NULL, "expected valid value");
assert(*value != NULL, "value should point to a symbol");
assert(value != nullptr, "expected valid value");
assert(*value != nullptr, "value should point to a symbol");
Symbol* sym = *value;
size_t size = sym->size();
size_t len = sym->utf8_length();

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
@ -89,7 +89,7 @@ class SymbolTable : public AllStatic {
const char** name, int* lengths,
int* cp_indices, unsigned int* hashValues);
static Symbol* lookup_shared(const char* name, int len, unsigned int hash) NOT_CDS_RETURN_(NULL);
static Symbol* lookup_shared(const char* name, int len, unsigned int hash) NOT_CDS_RETURN_(nullptr);
static Symbol* lookup_dynamic(const char* name, int len, unsigned int hash);
static Symbol* lookup_common(const char* name, int len, unsigned int hash);
@ -122,7 +122,7 @@ public:
// Probing
// Needed for preloading classes in signatures when compiling.
// Returns the symbol is already present in symbol table, otherwise
// NULL. NO ALLOCATION IS GUARANTEED!
// null. NO ALLOCATION IS GUARANTEED!
static Symbol* probe(const char* name, int len) {
unsigned int ignore_hash;
return lookup_only(name, len, ignore_hash);

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
@ -190,7 +190,7 @@ ClassLoaderData* SystemDictionary::register_loader(Handle class_loader, bool cre
// Add a new class loader data to the graph.
return ClassLoaderDataGraph::add(class_loader, true);
} else {
return (class_loader() == NULL) ? ClassLoaderData::the_null_class_loader_data() :
return (class_loader() == nullptr) ? ClassLoaderData::the_null_class_loader_data() :
ClassLoaderDataGraph::find_or_create(class_loader);
}
}
@ -227,7 +227,7 @@ bool is_parallelDefine(Handle class_loader) {
// or a custom system class loader. A customer system class loader can be
// specified via -Djava.system.class.loader.
bool SystemDictionary::is_system_class_loader(oop class_loader) {
if (class_loader == NULL) {
if (class_loader == nullptr) {
return false;
}
return (class_loader->klass() == vmClasses::jdk_internal_loader_ClassLoaders_AppClassLoader_klass() ||
@ -236,14 +236,14 @@ bool SystemDictionary::is_system_class_loader(oop class_loader) {
// Returns true if the passed class loader is the platform class loader.
bool SystemDictionary::is_platform_class_loader(oop class_loader) {
if (class_loader == NULL) {
if (class_loader == nullptr) {
return false;
}
return (class_loader->klass() == vmClasses::jdk_internal_loader_ClassLoaders_PlatformClassLoader_klass());
}
Handle SystemDictionary::get_loader_lock_or_null(Handle class_loader) {
// If class_loader is NULL or parallelCapable, the JVM doesn't acquire a lock while loading.
// If class_loader is null or parallelCapable, the JVM doesn't acquire a lock while loading.
if (is_parallelCapable(class_loader)) {
return Handle();
} else {
@ -255,7 +255,7 @@ Handle SystemDictionary::get_loader_lock_or_null(Handle class_loader) {
// Resolving of classes
Symbol* SystemDictionary::class_name_symbol(const char* name, Symbol* exception, TRAPS) {
if (name == NULL) {
if (name == nullptr) {
THROW_MSG_0(exception, "No class name given");
}
if ((int)strlen(name) > Symbol::max_length()) {
@ -265,7 +265,7 @@ Symbol* SystemDictionary::class_name_symbol(const char* name, Symbol* exception,
"Class name exceeds maximum length of %d: %s",
Symbol::max_length(),
name);
return NULL;
return nullptr;
}
// Callers should ensure that the name is never an illegal UTF8 string.
assert(UTF8::is_legal_utf8((const unsigned char*)name, (int)strlen(name), false),
@ -301,7 +301,7 @@ static void handle_resolution_exception(Symbol* class_name, bool throw_error, TR
return; // the caller will throw the incoming exception
}
}
// If the class is not found, ie, caller has checked that klass is NULL, throw the appropriate
// If the class is not found, ie, caller has checked that klass is null, throw the appropriate
// error or exception depending on the value of throw_error.
ResourceMark rm(THREAD);
if (throw_error) {
@ -317,7 +317,7 @@ Klass* SystemDictionary::resolve_or_fail(Symbol* class_name, Handle class_loader
bool throw_error, TRAPS) {
Klass* klass = resolve_or_null(class_name, class_loader, protection_domain, THREAD);
// Check for pending exception or null klass, and throw exception
if (HAS_PENDING_EXCEPTION || klass == NULL) {
if (HAS_PENDING_EXCEPTION || klass == nullptr) {
handle_resolution_exception(class_name, throw_error, CHECK_NULL);
}
return klass;
@ -329,7 +329,7 @@ Klass* SystemDictionary::resolve_or_null(Symbol* class_name, Handle class_loader
if (Signature::is_array(class_name)) {
return resolve_array_class_or_null(class_name, class_loader, protection_domain, THREAD);
} else {
assert(class_name != NULL && !Signature::is_array(class_name), "must be");
assert(class_name != nullptr && !Signature::is_array(class_name), "must be");
if (Signature::has_envelope(class_name)) {
ResourceMark rm(THREAD);
// Ignore wrapping L and ;.
@ -352,7 +352,7 @@ Klass* SystemDictionary::resolve_array_class_or_null(Symbol* class_name,
ResourceMark rm(THREAD);
SignatureStream ss(class_name, false);
int ndims = ss.skip_array_prefix(); // skip all '['s
Klass* k = NULL;
Klass* k = nullptr;
BasicType t = ss.type();
if (ss.has_envelope()) {
Symbol* obj_class = ss.as_symbol();
@ -360,7 +360,7 @@ Klass* SystemDictionary::resolve_array_class_or_null(Symbol* class_name,
class_loader,
protection_domain,
CHECK_NULL);
if (k != NULL) {
if (k != nullptr) {
k = k->array_klass(ndims, CHECK_NULL);
}
} else {
@ -408,7 +408,7 @@ InstanceKlass* SystemDictionary::resolve_super_or_fail(Symbol* class_name,
bool is_superclass,
TRAPS) {
assert(super_name != NULL, "null superclass for resolving");
assert(super_name != nullptr, "null superclass for resolving");
assert(!Signature::is_array(super_name), "invalid superclass name");
#if INCLUDE_CDS
if (DumpSharedSpaces) {
@ -438,8 +438,8 @@ InstanceKlass* SystemDictionary::resolve_super_or_fail(Symbol* class_name,
// To support parallel loading: if class is done loading, just return the superclass
// if the super_name matches class->super()->name() and if the class loaders match.
// Otherwise, a LinkageError will be thrown later.
if (klassk != NULL && is_superclass &&
((quicksuperk = klassk->java_super()) != NULL) &&
if (klassk != nullptr && is_superclass &&
((quicksuperk = klassk->java_super()) != nullptr) &&
((quicksuperk->name() == super_name) &&
(quicksuperk->class_loader() == class_loader()))) {
return quicksuperk;
@ -481,7 +481,7 @@ InstanceKlass* SystemDictionary::resolve_super_or_fail(Symbol* class_name,
}
// Check for pending exception or null superk, and throw exception
if (HAS_PENDING_EXCEPTION || superk == NULL) {
if (HAS_PENDING_EXCEPTION || superk == nullptr) {
handle_resolution_exception(super_name, true, CHECK_NULL);
}
@ -518,7 +518,7 @@ static void double_lock_wait(JavaThread* thread, Handle lockObject) {
assert(EnableWaitForParallelLoad,
"Only called when enabling legacy parallel class loading logic "
"for non-parallel capable class loaders");
assert(lockObject() != NULL, "lockObject must be non-NULL");
assert(lockObject() != nullptr, "lockObject must be non-null");
bool calledholdinglock
= ObjectSynchronizer::current_thread_holds_lock(thread, lockObject);
assert(calledholdinglock, "must hold lock for notify");
@ -568,17 +568,17 @@ InstanceKlass* SystemDictionary::handle_parallel_loading(JavaThread* current,
Handle lockObject,
bool* throw_circularity_error) {
PlaceholderEntry* oldprobe = PlaceholderTable::get_entry(name, loader_data);
if (oldprobe != NULL) {
if (oldprobe != nullptr) {
// only need check_seen_thread once, not on each loop
// 6341374 java/lang/Instrument with -Xcomp
if (oldprobe->check_seen_thread(current, PlaceholderTable::LOAD_INSTANCE)) {
log_circularity_error(name, oldprobe);
*throw_circularity_error = true;
return NULL;
return nullptr;
} else {
// Wait until the first thread has finished loading this class. Also wait until all the
// threads trying to load its superclass have removed their placeholders.
while (oldprobe != NULL &&
while (oldprobe != nullptr &&
(oldprobe->instance_load_in_progress() || oldprobe->super_load_in_progress())) {
// We only get here if the application has released the
@ -599,12 +599,12 @@ InstanceKlass* SystemDictionary::handle_parallel_loading(JavaThread* current,
} else if (EnableWaitForParallelLoad) {
double_lock_wait(current, lockObject);
} else {
return NULL;
return nullptr;
}
// Check if classloading completed while we were waiting
InstanceKlass* check = loader_data->dictionary()->find_class(current, name);
if (check != NULL) {
if (check != nullptr) {
// Klass is already loaded, so just return it
return check;
}
@ -613,12 +613,12 @@ InstanceKlass* SystemDictionary::handle_parallel_loading(JavaThread* current,
}
}
}
return NULL;
return nullptr;
}
void SystemDictionary::post_class_load_event(EventClassLoad* event, const InstanceKlass* k, const ClassLoaderData* init_cld) {
assert(event != NULL, "invariant");
assert(k != NULL, "invariant");
assert(event != nullptr, "invariant");
assert(k != nullptr, "invariant");
event->set_loadedClass(k);
event->set_definingClassLoader(k->class_loader_data());
event->set_initiatingClassLoader(init_cld);
@ -629,13 +629,13 @@ void SystemDictionary::post_class_load_event(EventClassLoad* event, const Instan
// After checking if the InstanceKlass already exists, it checks for ClassCircularityError and
// whether the thread must wait for loading in parallel. It eventually calls load_instance_class,
// which will load the class via the bootstrap loader or call ClassLoader.loadClass().
// This can return NULL, an exception or an InstanceKlass.
// This can return null, an exception or an InstanceKlass.
InstanceKlass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
Handle class_loader,
Handle protection_domain,
TRAPS) {
// name must be in the form of "java/lang/Object" -- cannot be "Ljava/lang/Object;"
assert(name != NULL && !Signature::is_array(name) &&
assert(name != nullptr && !Signature::is_array(name) &&
!Signature::has_envelope(name), "invalid class name");
EventClassLoad class_load_start_event;
@ -653,7 +653,7 @@ InstanceKlass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
// All subsequent calls use find_class, and set loaded_class so that
// before we return a result, we call out to java to check for valid protection domain.
InstanceKlass* probe = dictionary->find(THREAD, name, protection_domain);
if (probe != NULL) return probe;
if (probe != nullptr) return probe;
// Non-bootstrap class loaders will call out to class loader and
// define via jvm/jni_DefineClass which will acquire the
@ -668,8 +668,8 @@ InstanceKlass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
ObjectLocker ol(lockObject, THREAD);
bool super_load_in_progress = false;
InstanceKlass* loaded_class = NULL;
Symbol* superclassname = NULL;
InstanceKlass* loaded_class = nullptr;
Symbol* superclassname = nullptr;
assert(THREAD->can_call_java(),
"can not load classes with compiler thread: class=%s, classloader=%s",
@ -680,15 +680,15 @@ InstanceKlass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
{
MutexLocker mu(THREAD, SystemDictionary_lock);
InstanceKlass* check = dictionary->find_class(THREAD, name);
if (check != NULL) {
if (check != nullptr) {
// InstanceKlass is already loaded, but we still need to check protection domain below.
loaded_class = check;
} else {
PlaceholderEntry* placeholder = PlaceholderTable::get_entry(name, loader_data);
if (placeholder != NULL && placeholder->super_load_in_progress()) {
if (placeholder != nullptr && placeholder->super_load_in_progress()) {
super_load_in_progress = true;
superclassname = placeholder->supername();
assert(superclassname != NULL, "superclass has to have a name");
assert(superclassname != nullptr, "superclass has to have a name");
}
}
}
@ -703,7 +703,7 @@ InstanceKlass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
}
bool throw_circularity_error = false;
if (loaded_class == NULL) {
if (loaded_class == nullptr) {
bool load_placeholder_added = false;
// Add placeholder entry to record loading instance class
@ -735,16 +735,16 @@ InstanceKlass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
// Recheck if the class has been loaded for all class loader cases and
// add a LOAD_INSTANCE placeholder while holding the SystemDictionary_lock.
if (!throw_circularity_error && loaded_class == NULL) {
if (!throw_circularity_error && loaded_class == nullptr) {
InstanceKlass* check = dictionary->find_class(THREAD, name);
if (check != NULL) {
if (check != nullptr) {
loaded_class = check;
} else if (needs_load_placeholder(class_loader)) {
// Add the LOAD_INSTANCE token. Threads will wait on loading to complete for this thread,
// and check for ClassCircularityError with -Xcomp.
PlaceholderEntry* newprobe = PlaceholderTable::find_and_add(name, loader_data,
PlaceholderTable::LOAD_INSTANCE,
NULL,
nullptr,
THREAD);
load_placeholder_added = true;
}
@ -763,7 +763,7 @@ InstanceKlass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
// you need to find_and_remove it before returning.
// So be careful to not exit with a CHECK_ macro between these calls.
if (loaded_class == NULL) {
if (loaded_class == nullptr) {
// Do actual loading
loaded_class = load_instance_class(name, class_loader, THREAD);
}
@ -778,8 +778,8 @@ InstanceKlass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
}
}
if (HAS_PENDING_EXCEPTION || loaded_class == NULL) {
return NULL;
if (HAS_PENDING_EXCEPTION || loaded_class == nullptr) {
return nullptr;
}
if (class_load_start_event.should_commit()) {
@ -790,7 +790,7 @@ InstanceKlass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
DEBUG_ONLY(verify_dictionary_entry(name, loaded_class));
// Check if the protection domain is present it has the right access
if (protection_domain() != NULL) {
if (protection_domain() != nullptr) {
// Verify protection domain. If it fails an exception is thrown
dictionary->validate_protection_domain(loaded_class, class_loader, protection_domain, CHECK_NULL);
}
@ -821,10 +821,10 @@ InstanceKlass* SystemDictionary::find_instance_klass(Thread* current,
oop class_loader_oop = java_lang_ClassLoader::non_reflection_class_loader(class_loader());
ClassLoaderData* loader_data = ClassLoaderData::class_loader_data_or_null(class_loader_oop);
if (loader_data == NULL) {
if (loader_data == nullptr) {
// If the ClassLoaderData has not been setup,
// then the class loader has no entries in the dictionary.
return NULL;
return nullptr;
}
Dictionary* dictionary = loader_data->dictionary();
@ -832,13 +832,13 @@ InstanceKlass* SystemDictionary::find_instance_klass(Thread* current,
}
// Look for a loaded instance or array klass by name. Do not do any loading.
// return NULL in case of error.
// return null in case of error.
Klass* SystemDictionary::find_instance_or_array_klass(Thread* current,
Symbol* class_name,
Handle class_loader,
Handle protection_domain) {
Klass* k = NULL;
assert(class_name != NULL, "class name must be non NULL");
Klass* k = nullptr;
assert(class_name != nullptr, "class name must be non nullptr");
if (Signature::is_array(class_name)) {
// The name refers to an array. Parse the name.
@ -852,7 +852,7 @@ Klass* SystemDictionary::find_instance_or_array_klass(Thread* current,
} else {
k = SystemDictionary::find_instance_klass(current, ss.as_symbol(), class_loader, protection_domain);
}
if (k != NULL) {
if (k != nullptr) {
k = k->array_klass_or_null(ndims);
}
} else {
@ -881,7 +881,7 @@ InstanceKlass* SystemDictionary::resolve_hidden_class_from_stream(
bool create_mirror_cld = !cl_info.is_strong_hidden();
loader_data = register_loader(class_loader, create_mirror_cld);
assert(st != NULL, "invariant");
assert(st != nullptr, "invariant");
assert(st->need_verify(), "invariant");
// Parse stream and create a klass.
@ -890,7 +890,7 @@ InstanceKlass* SystemDictionary::resolve_hidden_class_from_stream(
loader_data,
cl_info,
CHECK_NULL);
assert(k != NULL, "no klass created");
assert(k != nullptr, "no klass created");
// Hidden classes that are not strong must update ClassLoaderData holder
// so that they can be unloaded when the mirror is no longer referenced.
@ -920,10 +920,10 @@ InstanceKlass* SystemDictionary::resolve_hidden_class_from_stream(
// Add a klass to the system from a stream (called by jni_DefineClass and
// JVM_DefineClass).
// Note: class_name can be NULL. In that case we do not know the name of
// Note: class_name can be null. In that case we do not know the name of
// the class until we have parsed the stream.
// This function either returns an InstanceKlass or throws an exception. It does
// not return NULL without a pending exception.
// not return null without a pending exception.
InstanceKlass* SystemDictionary::resolve_class_from_stream(
ClassFileStream* st,
Symbol* class_name,
@ -944,7 +944,7 @@ InstanceKlass* SystemDictionary::resolve_class_from_stream(
// Note that we do this even though this klass might
// already be present in the SystemDictionary, otherwise we would not
// throw potential ClassFormatErrors.
InstanceKlass* k = NULL;
InstanceKlass* k = nullptr;
#if INCLUDE_CDS
if (!DumpSharedSpaces) {
@ -956,13 +956,13 @@ InstanceKlass* SystemDictionary::resolve_class_from_stream(
}
#endif
if (k == NULL) {
if (k == nullptr) {
k = KlassFactory::create_from_stream(st, class_name, loader_data, cl_info, CHECK_NULL);
}
assert(k != NULL, "no klass created");
assert(k != nullptr, "no klass created");
Symbol* h_name = k->name();
assert(class_name == NULL || class_name == h_name, "name mismatch");
assert(class_name == nullptr || class_name == h_name, "name mismatch");
// Add class just loaded
// If a class loader supports parallel classloading, handle parallel define requests.
@ -975,9 +975,9 @@ InstanceKlass* SystemDictionary::resolve_class_from_stream(
// If defining the class throws an exception register 'k' for cleanup.
if (HAS_PENDING_EXCEPTION) {
assert(k != NULL, "Must have an instance klass here!");
assert(k != nullptr, "Must have an instance klass here!");
loader_data->add_to_deallocate_list(k);
return NULL;
return nullptr;
}
}
@ -1012,7 +1012,7 @@ bool SystemDictionary::is_shared_class_visible(Symbol* class_name,
// (1) Check if we are loading into the same loader as in dump time.
if (ik->is_shared_boot_class()) {
if (class_loader() != NULL) {
if (class_loader() != nullptr) {
return false;
}
} else if (ik->is_shared_platform_class()) {
@ -1053,7 +1053,7 @@ bool SystemDictionary::is_shared_class_visible_impl(Symbol* class_name,
assert(scp_index >= 0, "must be");
SharedClassPathEntry* scp_entry = FileMapInfo::shared_path(scp_index);
if (!Universe::is_module_initialized()) {
assert(scp_entry != NULL, "must be");
assert(scp_entry != nullptr, "must be");
// At this point, no modules have been defined yet. KlassSubGraphInfo::check_allowed_klass()
// has restricted the classes can be loaded at this step to be only:
// [1] scp_entry->is_modules_image(): classes in java.base, or,
@ -1064,17 +1064,17 @@ bool SystemDictionary::is_shared_class_visible_impl(Symbol* class_name,
return true;
}
if (pkg_entry == NULL) {
if (pkg_entry == nullptr) {
// We might have looked up pkg_entry before the module system was initialized.
// Need to reload it now.
TempNewSymbol pkg_name = ClassLoader::package_from_class_name(class_name);
if (pkg_name != NULL) {
if (pkg_name != nullptr) {
pkg_entry = class_loader_data(class_loader)->packages()->lookup_only(pkg_name);
}
}
ModuleEntry* mod_entry = (pkg_entry == NULL) ? NULL : pkg_entry->module();
bool should_be_in_named_module = (mod_entry != NULL && mod_entry->is_named());
ModuleEntry* mod_entry = (pkg_entry == nullptr) ? nullptr : pkg_entry->module();
bool should_be_in_named_module = (mod_entry != nullptr && mod_entry->is_named());
bool was_archived_from_named_module = scp_entry->in_named_module();
bool visible;
@ -1111,8 +1111,8 @@ bool SystemDictionary::check_shared_class_super_type(InstanceKlass* klass, Insta
// Quick check if the super type has been already loaded.
// + Don't do it for unregistered classes -- they can be unloaded so
// super_type->class_loader_data() could be stale.
// + Don't check if loader data is NULL, ie. the super_type isn't fully loaded.
if (!super_type->is_shared_unregistered_class() && super_type->class_loader_data() != NULL) {
// + Don't check if loader data is null, ie. the super_type isn't fully loaded.
if (!super_type->is_shared_unregistered_class() && super_type->class_loader_data() != nullptr) {
// Check if the superclass is loaded by the current class_loader
Symbol* name = super_type->name();
InstanceKlass* check = find_instance_klass(THREAD, name, class_loader, protection_domain);
@ -1141,7 +1141,7 @@ bool SystemDictionary::check_shared_class_super_types(InstanceKlass* ik, Handle
// If unexpected superclass or interfaces are found, we cannot
// load <ik> from the shared archive.
if (ik->super() != NULL &&
if (ik->super() != nullptr &&
!check_shared_class_super_type(ik, InstanceKlass::cast(ik->super()),
class_loader, protection_domain, true, THREAD)) {
return false;
@ -1170,14 +1170,14 @@ InstanceKlass* SystemDictionary::load_shared_lambda_proxy_class(InstanceKlass* i
if (s != shared_nest_host) {
// The dynamically resolved nest_host is not the same as the one we used during dump time,
// so we cannot use ik.
return NULL;
return nullptr;
} else {
assert(s->is_shared(), "must be");
}
InstanceKlass* loaded_ik = load_shared_class(ik, class_loader, protection_domain, NULL, pkg_entry, CHECK_NULL);
InstanceKlass* loaded_ik = load_shared_class(ik, class_loader, protection_domain, nullptr, pkg_entry, CHECK_NULL);
if (loaded_ik != NULL) {
if (loaded_ik != nullptr) {
assert(shared_nest_host->is_same_class_package(ik),
"lambda proxy class and its nest host must be in the same package");
}
@ -1197,26 +1197,26 @@ InstanceKlass* SystemDictionary::load_shared_class(InstanceKlass* ik,
const ClassFileStream *cfs,
PackageEntry* pkg_entry,
TRAPS) {
assert(ik != NULL, "sanity");
assert(ik != nullptr, "sanity");
assert(!ik->is_unshareable_info_restored(), "shared class can be loaded only once");
Symbol* class_name = ik->name();
if (!is_shared_class_visible(class_name, ik, pkg_entry, class_loader)) {
return NULL;
return nullptr;
}
if (!check_shared_class_super_types(ik, class_loader, protection_domain, THREAD)) {
return NULL;
return nullptr;
}
InstanceKlass* new_ik = NULL;
InstanceKlass* new_ik = nullptr;
// CFLH check is skipped for VM hidden classes (see KlassFactory::create_from_stream).
// It will be skipped for shared VM hidden lambda proxy classes.
if (!SystemDictionaryShared::is_hidden_lambda_proxy(ik)) {
new_ik = KlassFactory::check_shared_class_file_load_hook(
ik, class_name, class_loader, protection_domain, cfs, CHECK_NULL);
}
if (new_ik != NULL) {
if (new_ik != nullptr) {
// The class is changed by CFLH. Return the new class. The shared class is
// not used.
return new_ik;
@ -1248,7 +1248,7 @@ InstanceKlass* SystemDictionary::load_shared_class(InstanceKlass* ik,
}
void SystemDictionary::load_shared_class_misc(InstanceKlass* ik, ClassLoaderData* loader_data) {
ik->print_class_load_logging(loader_data, NULL, NULL);
ik->print_class_load_logging(loader_data, nullptr, nullptr);
// For boot loader, ensure that GetSystemPackage knows that a class in this
// package was loaded.
@ -1267,12 +1267,12 @@ InstanceKlass* SystemDictionary::load_instance_class_impl(Symbol* class_name, Ha
if (class_loader.is_null()) {
ResourceMark rm(THREAD);
PackageEntry* pkg_entry = NULL;
PackageEntry* pkg_entry = nullptr;
bool search_only_bootloader_append = false;
// Find the package in the boot loader's package entry table.
TempNewSymbol pkg_name = ClassLoader::package_from_class_name(class_name);
if (pkg_name != NULL) {
if (pkg_name != nullptr) {
pkg_entry = class_loader_data(class_loader)->packages()->lookup_only(pkg_name);
}
@ -1284,7 +1284,7 @@ InstanceKlass* SystemDictionary::load_instance_class_impl(Symbol* class_name, Ha
// java.base packages in the boot loader's PackageEntryTable.
// No class outside of java.base is allowed to be loaded during
// this bootstrapping window.
if (pkg_entry == NULL || pkg_entry->in_unnamed_module()) {
if (pkg_entry == nullptr || pkg_entry->in_unnamed_module()) {
// Class is either in the unnamed package or in
// a named package within the unnamed module. Either
// case is outside of java.base, do not attempt to
@ -1293,20 +1293,20 @@ InstanceKlass* SystemDictionary::load_instance_class_impl(Symbol* class_name, Ha
// and its package will be checked later by
// ModuleEntryTable::verify_javabase_packages.
if (ModuleEntryTable::javabase_defined()) {
return NULL;
return nullptr;
}
} else {
// Check that the class' package is defined within java.base.
ModuleEntry* mod_entry = pkg_entry->module();
Symbol* mod_entry_name = mod_entry->name();
if (mod_entry_name->fast_compare(vmSymbols::java_base()) != 0) {
return NULL;
return nullptr;
}
}
} else {
// After the module system has been initialized, check if the class'
// package is in a module defined to the boot loader.
if (pkg_name == NULL || pkg_entry == NULL || pkg_entry->in_unnamed_module()) {
if (pkg_name == nullptr || pkg_entry == nullptr || pkg_entry->in_unnamed_module()) {
// Class is either in the unnamed package, in a named package
// within a module not defined to the boot loader or in a
// a named package within the unnamed module. In all cases,
@ -1315,7 +1315,7 @@ InstanceKlass* SystemDictionary::load_instance_class_impl(Symbol* class_name, Ha
if (!ClassLoader::has_bootclasspath_append()) {
// If there is no bootclasspath append entry, no need to continue
// searching.
return NULL;
return nullptr;
}
search_only_bootloader_append = true;
}
@ -1328,28 +1328,28 @@ InstanceKlass* SystemDictionary::load_instance_class_impl(Symbol* class_name, Ha
"Attempt to load a class outside of boot loader's module path");
// Search for classes in the CDS archive.
InstanceKlass* k = NULL;
InstanceKlass* k = nullptr;
#if INCLUDE_CDS
if (UseSharedSpaces)
{
PerfTraceTime vmtimer(ClassLoader::perf_shared_classload_time());
InstanceKlass* ik = SystemDictionaryShared::find_builtin_class(class_name);
if (ik != NULL && ik->is_shared_boot_class() && !ik->shared_loading_failed()) {
if (ik != nullptr && ik->is_shared_boot_class() && !ik->shared_loading_failed()) {
SharedClassLoadingMark slm(THREAD, ik);
k = load_shared_class(ik, class_loader, Handle(), NULL, pkg_entry, CHECK_NULL);
k = load_shared_class(ik, class_loader, Handle(), nullptr, pkg_entry, CHECK_NULL);
}
}
#endif
if (k == NULL) {
if (k == nullptr) {
// Use VM class loader
PerfTraceTime vmtimer(ClassLoader::perf_sys_classload_time());
k = ClassLoader::load_class(class_name, search_only_bootloader_append, CHECK_NULL);
}
// find_or_define_instance_class may return a different InstanceKlass
if (k != NULL) {
if (k != nullptr) {
CDS_ONLY(SharedClassLoadingMark slm(THREAD, k);)
k = find_or_define_instance_class(class_name, class_loader, k, CHECK_NULL);
}
@ -1391,7 +1391,7 @@ InstanceKlass* SystemDictionary::load_instance_class_impl(Symbol* class_name, Ha
// Primitive classes return null since forName() can not be
// used to obtain any of the Class objects representing primitives or void
if ((obj != NULL) && !(java_lang_Class::is_primitive(obj))) {
if ((obj != nullptr) && !(java_lang_Class::is_primitive(obj))) {
InstanceKlass* k = InstanceKlass::cast(java_lang_Class::as_Klass(obj));
// For user defined Java class loaders, check that the name returned is
// the same as that requested. This check is done for the bootstrap
@ -1400,8 +1400,8 @@ InstanceKlass* SystemDictionary::load_instance_class_impl(Symbol* class_name, Ha
return k;
}
}
// Class is not found or has the wrong name, return NULL
return NULL;
// Class is not found or has the wrong name, return null
return nullptr;
}
}
@ -1413,7 +1413,7 @@ InstanceKlass* SystemDictionary::load_instance_class(Symbol* name,
// If everything was OK (no exceptions, no null return value), and
// class_loader is NOT the defining loader, do a little more bookkeeping.
if (loaded_class != NULL &&
if (loaded_class != nullptr &&
loaded_class->class_loader() != class_loader()) {
ClassLoaderData* loader_data = class_loader_data(class_loader);
@ -1480,7 +1480,7 @@ void SystemDictionary::define_instance_class(InstanceKlass* k, Handle class_load
// fail with an OutOfMemoryError (if it does, we will *not* put this
// class in the dictionary and will not update the class hierarchy).
// JVMTI FollowReferences needs to find the classes this way.
if (k->class_loader() != NULL) {
if (k->class_loader() != nullptr) {
methodHandle m(THREAD, Universe::loader_addClass_method());
JavaValue result(T_VOID);
JavaCallArguments args(class_loader);
@ -1540,31 +1540,31 @@ InstanceKlass* SystemDictionary::find_or_define_helper(Symbol* class_name, Handl
// First check if class already defined
if (is_parallelDefine(class_loader)) {
InstanceKlass* check = dictionary->find_class(THREAD, name_h);
if (check != NULL) {
if (check != nullptr) {
return check;
}
}
// Acquire define token for this class/classloader
PlaceholderEntry* probe = PlaceholderTable::find_and_add(name_h, loader_data,
PlaceholderTable::DEFINE_CLASS, NULL, THREAD);
PlaceholderTable::DEFINE_CLASS, nullptr, THREAD);
// Wait if another thread defining in parallel
// All threads wait - even those that will throw duplicate class: otherwise
// caller is surprised by LinkageError: duplicate, but findLoadedClass fails
// if other thread has not finished updating dictionary
while (probe->definer() != NULL) {
while (probe->definer() != nullptr) {
SystemDictionary_lock->wait();
}
// Only special cases allow parallel defines and can use other thread's results
// Other cases fall through, and may run into duplicate defines
// caught by finding an entry in the SystemDictionary
if (is_parallelDefine(class_loader) && (probe->instance_klass() != NULL)) {
if (is_parallelDefine(class_loader) && (probe->instance_klass() != nullptr)) {
InstanceKlass* ik = probe->instance_klass();
PlaceholderTable::find_and_remove(name_h, loader_data, PlaceholderTable::DEFINE_CLASS, THREAD);
SystemDictionary_lock->notify_all();
#ifdef ASSERT
InstanceKlass* check = dictionary->find_class(THREAD, name_h);
assert(check != NULL, "definer missed recording success");
assert(check != nullptr, "definer missed recording success");
#endif
return ik;
} else {
@ -1579,16 +1579,16 @@ InstanceKlass* SystemDictionary::find_or_define_helper(Symbol* class_name, Handl
{
MutexLocker mu(THREAD, SystemDictionary_lock);
PlaceholderEntry* probe = PlaceholderTable::get_entry(name_h, loader_data);
assert(probe != NULL, "DEFINE_CLASS placeholder lost?");
assert(probe != nullptr, "DEFINE_CLASS placeholder lost?");
if (!HAS_PENDING_EXCEPTION) {
probe->set_instance_klass(k);
}
probe->set_definer(NULL);
probe->set_definer(nullptr);
PlaceholderTable::find_and_remove(name_h, loader_data, PlaceholderTable::DEFINE_CLASS, THREAD);
SystemDictionary_lock->notify_all();
}
return HAS_PENDING_EXCEPTION ? NULL : k;
return HAS_PENDING_EXCEPTION ? nullptr : k;
}
// If a class loader supports parallel classloading handle parallel define requests.
@ -1599,10 +1599,10 @@ InstanceKlass* SystemDictionary::find_or_define_instance_class(Symbol* class_nam
// Clean up original InstanceKlass if duplicate or error
if (!HAS_PENDING_EXCEPTION && defined_k != k) {
// If a parallel capable class loader already defined this class, register 'k' for cleanup.
assert(defined_k != NULL, "Should have a klass if there's no exception");
assert(defined_k != nullptr, "Should have a klass if there's no exception");
k->class_loader_data()->add_to_deallocate_list(k);
} else if (HAS_PENDING_EXCEPTION) {
assert(defined_k == NULL, "Should not have a klass if there's an exception");
assert(defined_k == nullptr, "Should not have a klass if there's an exception");
k->class_loader_data()->add_to_deallocate_list(k);
}
return defined_k;
@ -1615,7 +1615,7 @@ InstanceKlass* SystemDictionary::find_or_define_instance_class(Symbol* class_nam
// before a new class is used.
void SystemDictionary::add_to_hierarchy(InstanceKlass* k) {
assert(k != NULL, "just checking");
assert(k != nullptr, "just checking");
if (Universe::is_fully_initialized()) {
assert_locked_or_safepoint(Compile_lock);
}
@ -1650,10 +1650,10 @@ bool SystemDictionary::do_unloading(GCTimer* gc_timer) {
// First, mark for unload all ClassLoaderData referencing a dead class loader.
unloading_occurred = ClassLoaderDataGraph::do_unloading();
if (unloading_occurred) {
MutexLocker ml2(is_concurrent ? Module_lock : NULL);
MutexLocker ml2(is_concurrent ? Module_lock : nullptr);
JFR_ONLY(Jfr::on_unloading_classes();)
MANAGEMENT_ONLY(FinalizerService::purge_unloaded();)
MutexLocker ml1(is_concurrent ? SystemDictionary_lock : NULL);
MutexLocker ml1(is_concurrent ? SystemDictionary_lock : nullptr);
ClassLoaderDataGraph::clean_module_and_package_info();
LoaderConstraintTable::purge_loader_constraints();
ResolutionErrorTable::purge_resolution_errors();
@ -1676,7 +1676,7 @@ bool SystemDictionary::do_unloading(GCTimer* gc_timer) {
assert(ProtectionDomainCacheTable::number_of_entries() == 0, "should be empty");
}
MutexLocker ml(is_concurrent ? ClassInitError_lock : NULL);
MutexLocker ml(is_concurrent ? ClassInitError_lock : nullptr);
InstanceKlass::clean_initialization_error_table();
}
@ -1740,7 +1740,7 @@ void SystemDictionary::check_constraints(InstanceKlass* k,
MutexLocker mu(THREAD, SystemDictionary_lock);
InstanceKlass* check = loader_data->dictionary()->find_class(THREAD, name);
if (check != NULL) {
if (check != nullptr) {
// If different InstanceKlass - duplicate class definition,
// else - ok, class loaded by a different thread in parallel.
// We should only have found it if it was done loading and ok to use.
@ -1762,7 +1762,7 @@ void SystemDictionary::check_constraints(InstanceKlass* k,
ss.print(" wants to load %s %s.",
k->external_kind(), k->external_name());
Klass *existing_klass = LoaderConstraintTable::find_constrained_klass(name, loader_data);
if (existing_klass != NULL && existing_klass->class_loader_data() != loader_data) {
if (existing_klass != nullptr && existing_klass->class_loader_data() != loader_data) {
ss.print(" A different %s with the same name was previously loaded by %s. (%s)",
existing_klass->external_kind(),
existing_klass->class_loader_data()->loader_name_and_id(),
@ -1795,7 +1795,7 @@ void SystemDictionary::update_dictionary(JavaThread* current,
// Make a new dictionary entry.
Dictionary* dictionary = loader_data->dictionary();
InstanceKlass* sd_check = dictionary->find_class(current, name);
if (sd_check == NULL) {
if (sd_check == nullptr) {
dictionary->add_klass(current, name, k);
}
SystemDictionary_lock->notify_all();
@ -1813,7 +1813,7 @@ Klass* SystemDictionary::find_constrained_instance_or_array_klass(
Handle no_protection_domain;
Klass* klass = find_instance_or_array_klass(current, class_name, class_loader,
no_protection_domain);
if (klass != NULL)
if (klass != nullptr)
return klass;
// Now look to see if it has been loaded elsewhere, and is subject to
@ -1832,7 +1832,7 @@ Klass* SystemDictionary::find_constrained_instance_or_array_klass(
klass = LoaderConstraintTable::find_constrained_klass(ss.as_symbol(), class_loader_data(class_loader));
}
// If element class already loaded, allocate array klass
if (klass != NULL) {
if (klass != nullptr) {
klass = klass->array_klass_or_null(ndims);
}
} else {
@ -1851,7 +1851,7 @@ bool SystemDictionary::add_loader_constraint(Symbol* class_name,
ClassLoaderData* loader_data1 = class_loader_data(class_loader1);
ClassLoaderData* loader_data2 = class_loader_data(class_loader2);
Symbol* constraint_name = NULL;
Symbol* constraint_name = nullptr;
if (!Signature::is_array(class_name)) {
constraint_name = class_name;
@ -1881,7 +1881,7 @@ bool SystemDictionary::add_loader_constraint(Symbol* class_name,
bool result = LoaderConstraintTable::add_entry(constraint_name, klass1, loader_data1,
klass2, loader_data2);
#if INCLUDE_CDS
if (Arguments::is_dumping_archive() && klass_being_linked != NULL &&
if (Arguments::is_dumping_archive() && klass_being_linked != nullptr &&
!klass_being_linked->is_shared()) {
SystemDictionaryShared::record_linking_constraint(constraint_name,
InstanceKlass::cast(klass_being_linked),
@ -1903,7 +1903,7 @@ void SystemDictionary::add_resolution_error(const constantPoolHandle& pool, int
{
MutexLocker ml(Thread::current(), SystemDictionary_lock);
ResolutionErrorEntry* entry = ResolutionErrorTable::find_entry(pool, which);
if (entry == NULL) {
if (entry == nullptr) {
ResolutionErrorTable::add_entry(pool, which, error, message, cause, cause_msg);
}
}
@ -1914,20 +1914,20 @@ void SystemDictionary::delete_resolution_error(ConstantPool* pool) {
ResolutionErrorTable::delete_entry(pool);
}
// Lookup resolution error table. Returns error if found, otherwise NULL.
// Lookup resolution error table. Returns error if found, otherwise null.
Symbol* SystemDictionary::find_resolution_error(const constantPoolHandle& pool, int which,
Symbol** message, Symbol** cause, Symbol** cause_msg) {
{
MutexLocker ml(Thread::current(), SystemDictionary_lock);
ResolutionErrorEntry* entry = ResolutionErrorTable::find_entry(pool, which);
if (entry != NULL) {
if (entry != nullptr) {
*message = entry->message();
*cause = entry->cause();
*cause_msg = entry->cause_msg();
return entry->error();
} else {
return NULL;
return nullptr;
}
}
}
@ -1943,7 +1943,7 @@ void SystemDictionary::add_nest_host_error(const constantPoolHandle& pool,
{
MutexLocker ml(Thread::current(), SystemDictionary_lock);
ResolutionErrorEntry* entry = ResolutionErrorTable::find_entry(pool, which);
if (entry != NULL && entry->nest_host_error() == NULL) {
if (entry != nullptr && entry->nest_host_error() == nullptr) {
// An existing entry means we had a true resolution failure (LinkageError) with our nest host, but we
// still want to add the error message for the higher-level access checks to report. We should
// only reach here under the same error condition, so we can ignore the potential race with setting
@ -1960,10 +1960,10 @@ const char* SystemDictionary::find_nest_host_error(const constantPoolHandle& poo
{
MutexLocker ml(Thread::current(), SystemDictionary_lock);
ResolutionErrorEntry* entry = ResolutionErrorTable::find_entry(pool, which);
if (entry != NULL) {
if (entry != nullptr) {
return entry->nest_host_error();
} else {
return NULL;
return nullptr;
}
}
}
@ -2016,7 +2016,7 @@ const char* SystemDictionary::find_nest_host_error(const constantPoolHandle& poo
// Make sure all class components (including arrays) in the given
// signature will be resolved to the same class in both loaders.
// Returns the name of the type that failed a loader constraint check, or
// NULL if no constraint failed. No exception except OOME is thrown.
// null if no constraint failed. No exception except OOME is thrown.
// Arrays are not added to the loader constraint table, their elements are.
Symbol* SystemDictionary::check_signature_loaders(Symbol* signature,
Klass* klass_being_linked,
@ -2024,7 +2024,7 @@ Symbol* SystemDictionary::check_signature_loaders(Symbol* signature,
bool is_method) {
// Nothing to do if loaders are the same.
if (loader1() == loader2()) {
return NULL;
return nullptr;
}
for (SignatureStream ss(signature, is_method); !ss.is_done(); ss.next()) {
@ -2038,7 +2038,7 @@ Symbol* SystemDictionary::check_signature_loaders(Symbol* signature,
}
}
}
return NULL;
return nullptr;
}
Method* SystemDictionary::find_method_handle_intrinsic(vmIntrinsicID iid,
@ -2095,7 +2095,7 @@ static Method* unpack_method_and_appendix(Handle mname,
TRAPS) {
if (mname.not_null()) {
Method* m = java_lang_invoke_MemberName::vmtarget(mname());
if (m != NULL) {
if (m != nullptr) {
oop appendix = appendix_box->obj_at(0);
LogTarget(Info, methodhandles) lt;
if (lt.develop_is_enabled()) {
@ -2103,7 +2103,7 @@ static Method* unpack_method_and_appendix(Handle mname,
LogStream ls(lt);
ls.print("Linked method=" INTPTR_FORMAT ": ", p2i(m));
m->print_on(&ls);
if (appendix != NULL) { ls.print("appendix = "); appendix->print_on(&ls); }
if (appendix != nullptr) { ls.print("appendix = "); appendix->print_on(&ls); }
ls.cr();
}
@ -2134,10 +2134,10 @@ Method* SystemDictionary::find_method_handle_invoker(Klass* klass,
oop name_oop = StringTable::intern(name, CHECK_NULL);
Handle name_str (THREAD, name_oop);
objArrayHandle appendix_box = oopFactory::new_objArray_handle(vmClasses::Object_klass(), 1, CHECK_NULL);
assert(appendix_box->obj_at(0) == NULL, "");
assert(appendix_box->obj_at(0) == nullptr, "");
// This should not happen. JDK code should take care of that.
if (accessing_klass == NULL || method_type.is_null()) {
if (accessing_klass == nullptr || method_type.is_null()) {
THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), "bad invokehandle");
}
@ -2189,27 +2189,27 @@ Handle SystemDictionary::find_java_mirror_for_type(Symbol* signature,
Handle protection_domain,
SignatureStream::FailureMode failure_mode,
TRAPS) {
assert(accessing_klass == NULL || (class_loader.is_null() && protection_domain.is_null()),
assert(accessing_klass == nullptr || (class_loader.is_null() && protection_domain.is_null()),
"one or the other, or perhaps neither");
// What we have here must be a valid field descriptor,
// and all valid field descriptors are supported.
// Produce the same java.lang.Class that reflection reports.
if (accessing_klass != NULL) {
if (accessing_klass != nullptr) {
class_loader = Handle(THREAD, accessing_klass->class_loader());
protection_domain = Handle(THREAD, accessing_klass->protection_domain());
}
ResolvingSignatureStream ss(signature, class_loader, protection_domain, false);
oop mirror_oop = ss.as_java_mirror(failure_mode, CHECK_NH);
if (mirror_oop == NULL) {
if (mirror_oop == nullptr) {
return Handle(); // report failure this way
}
Handle mirror(THREAD, mirror_oop);
if (accessing_klass != NULL) {
if (accessing_klass != nullptr) {
// Check accessibility, emulating ConstantPool::verify_constant_pool_resolve.
Klass* sel_klass = java_lang_Class::as_Klass(mirror());
if (sel_klass != NULL) {
if (sel_klass != nullptr) {
LinkResolver::check_klass_accessibility(accessing_klass, sel_klass, CHECK_NH);
}
}
@ -2241,7 +2241,7 @@ Handle SystemDictionary::find_method_handle_type(Symbol* signature,
}
Handle class_loader, protection_domain;
if (accessing_klass != NULL) {
if (accessing_klass != nullptr) {
class_loader = Handle(THREAD, accessing_klass->class_loader());
protection_domain = Handle(THREAD, accessing_klass->protection_domain());
}
@ -2252,12 +2252,12 @@ Handle SystemDictionary::find_method_handle_type(Symbol* signature,
Handle rt; // the return type from the signature
ResourceMark rm(THREAD);
for (SignatureStream ss(signature); !ss.is_done(); ss.next()) {
oop mirror = NULL;
oop mirror = nullptr;
if (can_be_cached) {
// Use neutral class loader to lookup candidate classes to be placed in the cache.
mirror = ss.as_java_mirror(Handle(), Handle(),
SignatureStream::ReturnNull, CHECK_(empty));
if (mirror == NULL || (ss.is_reference() && !is_always_visible_class(mirror))) {
if (mirror == nullptr || (ss.is_reference() && !is_always_visible_class(mirror))) {
// Fall back to accessing_klass context.
can_be_cached = false;
}
@ -2267,16 +2267,16 @@ Handle SystemDictionary::find_method_handle_type(Symbol* signature,
mirror = ss.as_java_mirror(class_loader, protection_domain,
SignatureStream::NCDFError, CHECK_(empty));
}
assert(mirror != NULL, "%s", ss.as_symbol()->as_C_string());
assert(mirror != nullptr, "%s", ss.as_symbol()->as_C_string());
if (ss.at_return_type())
rt = Handle(THREAD, mirror);
else
pts->obj_at_put(arg++, mirror);
// Check accessibility.
if (!java_lang_Class::is_primitive(mirror) && accessing_klass != NULL) {
if (!java_lang_Class::is_primitive(mirror) && accessing_klass != nullptr) {
Klass* sel_klass = java_lang_Class::as_Klass(mirror);
mirror = NULL; // safety
mirror = nullptr; // safety
// Emulate ConstantPool::verify_constant_pool_resolve.
LinkResolver::check_klass_accessibility(accessing_klass, sel_klass, CHECK_(empty));
}
@ -2298,7 +2298,7 @@ Handle SystemDictionary::find_method_handle_type(Symbol* signature,
// We can cache this MethodType inside the JVM.
MutexLocker ml(THREAD, InvokeMethodTable_lock);
bool created = false;
assert(method_type != NULL, "unexpected null");
assert(method_type != nullptr, "unexpected null");
OopHandle* h = _invoke_method_type_table.get(signature);
if (h == nullptr) {
signature->make_permanent(); // The signature is never unloaded.
@ -2319,7 +2319,7 @@ Handle SystemDictionary::find_field_handle_type(Symbol* signature,
SignatureStream ss(signature, /*is_method=*/ false);
if (!ss.is_done()) {
Handle class_loader, protection_domain;
if (accessing_klass != NULL) {
if (accessing_klass != nullptr) {
class_loader = Handle(THREAD, accessing_klass->class_loader());
protection_domain = Handle(THREAD, accessing_klass->protection_domain());
}
@ -2340,7 +2340,7 @@ Handle SystemDictionary::link_method_handle_constant(Klass* caller,
Symbol* signature,
TRAPS) {
Handle empty;
if (caller == NULL) {
if (caller == nullptr) {
THROW_MSG_(vmSymbols::java_lang_InternalError(), "bad MH constant", empty);
}
Handle name_str = java_lang_String::create_from_symbol(name, CHECK_(empty));
@ -2391,7 +2391,7 @@ void SystemDictionary::invoke_bootstrap_method(BootstrapInfo& bootstrap_specifie
bootstrap_specifier.resolve_bsm(CHECK);
// This should not happen. JDK code should take care of that.
if (bootstrap_specifier.caller() == NULL || bootstrap_specifier.type_arg().is_null()) {
if (bootstrap_specifier.caller() == nullptr || bootstrap_specifier.type_arg().is_null()) {
THROW_MSG(vmSymbols::java_lang_InternalError(), "Invalid bootstrap method invocation with no caller or type argument");
}
@ -2400,7 +2400,7 @@ void SystemDictionary::invoke_bootstrap_method(BootstrapInfo& bootstrap_specifie
if (is_indy) {
// Some method calls may require an appendix argument. Arrange to receive it.
appendix_box = oopFactory::new_objArray_handle(vmClasses::Object_klass(), 1, CHECK);
assert(appendix_box->obj_at(0) == NULL, "");
assert(appendix_box->obj_at(0) == nullptr, "");
}
// call condy: java.lang.invoke.MethodHandleNatives::linkDynamicConstant(caller, bsm, type, info)
@ -2442,7 +2442,7 @@ void SystemDictionary::invoke_bootstrap_method(BootstrapInfo& bootstrap_specifie
bool SystemDictionary::is_nonpublic_Object_method(Method* m) {
assert(m != NULL, "Unexpected NULL Method*");
assert(m != nullptr, "Unexpected nullptr Method*");
return !m->is_public() && m->method_holder() == vmClasses::Object_klass();
}

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
@ -36,7 +36,7 @@
// class loader -> ClassLoaderData -> [class, protection domain set]
//
// Classes are loaded lazily. The default VM class loader is
// represented as NULL.
// represented as null.
// The underlying data structure is an open hash table (Dictionary) per
// ClassLoaderData with a fixed number of buckets. During loading the
@ -95,7 +95,7 @@ class SystemDictionary : AllStatic {
}
// Returns a class with a given class name and class loader.
// Loads the class if needed. If not found NULL is returned.
// Loads the class if needed. If not found null is returned.
static Klass* resolve_or_null(Symbol* class_name, Handle class_loader, Handle protection_domain, TRAPS);
// Version with null loader and protection domain
static Klass* resolve_or_null(Symbol* class_name, TRAPS) {
@ -139,13 +139,13 @@ class SystemDictionary : AllStatic {
const ClassLoadInfo& cl_info,
TRAPS);
// Lookup an already loaded class. If not found NULL is returned.
// Lookup an already loaded class. If not found null is returned.
static InstanceKlass* find_instance_klass(Thread* current, Symbol* class_name,
Handle class_loader, Handle protection_domain);
// Lookup an already loaded instance or array class.
// Do not make any queries to class loaders; consult only the cache.
// If not found NULL is returned.
// If not found null is returned.
static Klass* find_instance_or_array_klass(Thread* current, Symbol* class_name,
Handle class_loader,
Handle protection_domain);
@ -155,7 +155,7 @@ class SystemDictionary : AllStatic {
// loader that is constrained (via loader constraints) to produce
// a consistent class. Do not take protection domains into account.
// Do not make any queries to class loaders; consult only the cache.
// Return NULL if the class is not found.
// Return null if the class is not found.
//
// This function is a strict superset of find_instance_or_array_klass.
// This function (the unchecked version) makes a conservative prediction
@ -273,7 +273,7 @@ public:
// Record the error when the first attempt to resolve a reference from a constant
// pool entry to a class fails.
static void add_resolution_error(const constantPoolHandle& pool, int which, Symbol* error,
Symbol* message, Symbol* cause = NULL, Symbol* cause_msg = NULL);
Symbol* message, Symbol* cause = nullptr, Symbol* cause_msg = nullptr);
static void delete_resolution_error(ConstantPool* pool);
static Symbol* find_resolution_error(const constantPoolHandle& pool, int which,
Symbol** message, Symbol** cause, Symbol** cause_msg);
@ -354,7 +354,7 @@ protected:
public:
static bool is_system_class_loader(oop class_loader);
static bool is_platform_class_loader(oop class_loader);
static bool is_boot_class_loader(oop class_loader) { return class_loader == NULL; }
static bool is_boot_class_loader(oop class_loader) { return class_loader == nullptr; }
static bool is_builtin_class_loader(oop class_loader) {
return is_boot_class_loader(class_loader) ||
is_platform_class_loader(class_loader) ||

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
@ -76,10 +76,10 @@
SystemDictionaryShared::ArchiveInfo SystemDictionaryShared::_static_archive;
SystemDictionaryShared::ArchiveInfo SystemDictionaryShared::_dynamic_archive;
DumpTimeSharedClassTable* SystemDictionaryShared::_dumptime_table = NULL;
DumpTimeSharedClassTable* SystemDictionaryShared::_cloned_dumptime_table = NULL;
DumpTimeLambdaProxyClassDictionary* SystemDictionaryShared::_dumptime_lambda_proxy_class_dictionary = NULL;
DumpTimeLambdaProxyClassDictionary* SystemDictionaryShared::_cloned_dumptime_lambda_proxy_class_dictionary = NULL;
DumpTimeSharedClassTable* SystemDictionaryShared::_dumptime_table = nullptr;
DumpTimeSharedClassTable* SystemDictionaryShared::_cloned_dumptime_table = nullptr;
DumpTimeLambdaProxyClassDictionary* SystemDictionaryShared::_dumptime_lambda_proxy_class_dictionary = nullptr;
DumpTimeLambdaProxyClassDictionary* SystemDictionaryShared::_cloned_dumptime_lambda_proxy_class_dictionary = nullptr;
// Used by NoClassLoadingMark
DEBUG_ONLY(bool SystemDictionaryShared::_class_loading_may_happen = true;)
@ -89,17 +89,17 @@ InstanceKlass* SystemDictionaryShared::load_shared_class_for_builtin_loader(
assert(UseSharedSpaces, "must be");
InstanceKlass* ik = find_builtin_class(class_name);
if (ik != NULL && !ik->shared_loading_failed()) {
if (ik != nullptr && !ik->shared_loading_failed()) {
if ((SystemDictionary::is_system_class_loader(class_loader()) && ik->is_shared_app_class()) ||
(SystemDictionary::is_platform_class_loader(class_loader()) && ik->is_shared_platform_class())) {
SharedClassLoadingMark slm(THREAD, ik);
PackageEntry* pkg_entry = CDSProtectionDomain::get_package_entry_from_class(ik, class_loader);
Handle protection_domain =
CDSProtectionDomain::init_security_info(class_loader, ik, pkg_entry, CHECK_NULL);
return load_shared_class(ik, class_loader, protection_domain, NULL, pkg_entry, THREAD);
return load_shared_class(ik, class_loader, protection_domain, nullptr, pkg_entry, THREAD);
}
}
return NULL;
return nullptr;
}
// This function is called for loading only UNREGISTERED classes
@ -109,30 +109,30 @@ InstanceKlass* SystemDictionaryShared::lookup_from_stream(Symbol* class_name,
const ClassFileStream* cfs,
TRAPS) {
if (!UseSharedSpaces) {
return NULL;
return nullptr;
}
if (class_name == NULL) { // don't do this for hidden classes
return NULL;
if (class_name == nullptr) { // don't do this for hidden classes
return nullptr;
}
if (class_loader.is_null() ||
SystemDictionary::is_system_class_loader(class_loader()) ||
SystemDictionary::is_platform_class_loader(class_loader())) {
// Do nothing for the BUILTIN loaders.
return NULL;
return nullptr;
}
const RunTimeClassInfo* record = find_record(&_static_archive._unregistered_dictionary,
&_dynamic_archive._unregistered_dictionary,
class_name);
if (record == NULL) {
return NULL;
if (record == nullptr) {
return nullptr;
}
int clsfile_size = cfs->length();
int clsfile_crc32 = ClassLoader::crc32(0, (const char*)cfs->buffer(), cfs->length());
if (!record->matches(clsfile_size, clsfile_crc32)) {
return NULL;
return nullptr;
}
return acquire_class_for_current_thread(record->_klass, class_loader,
@ -150,10 +150,10 @@ InstanceKlass* SystemDictionaryShared::acquire_class_for_current_thread(
{
MutexLocker mu(THREAD, SharedDictionary_lock);
if (ik->class_loader_data() != NULL) {
if (ik->class_loader_data() != nullptr) {
// ik is already loaded (by this loader or by a different loader)
// or ik is being loaded by a different thread (by this loader or by a different loader)
return NULL;
return nullptr;
}
// No other thread has acquired this yet, so give it to *this thread*
@ -170,15 +170,15 @@ InstanceKlass* SystemDictionaryShared::acquire_class_for_current_thread(
// Load and check super/interfaces, restore unshareable info
InstanceKlass* shared_klass = load_shared_class(ik, class_loader, protection_domain,
cfs, pkg_entry, THREAD);
if (shared_klass == NULL || HAS_PENDING_EXCEPTION) {
if (shared_klass == nullptr || HAS_PENDING_EXCEPTION) {
// TODO: clean up <ik> so it can be used again
return NULL;
return nullptr;
}
return shared_klass;
}
// Guaranteed to return non-NULL value for non-shared classes.
// Guaranteed to return non-null value for non-shared classes.
// k must not be a shared class.
DumpTimeClassInfo* SystemDictionaryShared::get_info(InstanceKlass* k) {
MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
@ -190,7 +190,7 @@ DumpTimeClassInfo* SystemDictionaryShared::get_info_locked(InstanceKlass* k) {
assert_lock_strong(DumpTimeTable_lock);
assert(!k->is_shared(), "sanity");
DumpTimeClassInfo* info = _dumptime_table->get_info(k);
assert(info != NULL, "must be");
assert(info != nullptr, "must be");
return info;
}
@ -202,9 +202,9 @@ bool SystemDictionaryShared::check_for_exclusion(InstanceKlass* k, DumpTimeClass
return false;
}
if (info == NULL) {
if (info == nullptr) {
info = _dumptime_table->get(k);
assert(info != NULL, "supertypes of any classes in _dumptime_table must either be shared, or must also be in _dumptime_table");
assert(info != nullptr, "supertypes of any classes in _dumptime_table must either be shared, or must also be in _dumptime_table");
}
if (!info->has_checked_exclusion()) {
@ -236,12 +236,12 @@ bool SystemDictionaryShared::is_jfr_event_class(InstanceKlass *k) {
bool SystemDictionaryShared::is_registered_lambda_proxy_class(InstanceKlass* ik) {
DumpTimeClassInfo* info = _dumptime_table->get(ik);
return (info != NULL) ? info->_is_archived_lambda_proxy : false;
return (info != nullptr) ? info->_is_archived_lambda_proxy : false;
}
void SystemDictionaryShared::reset_registered_lambda_proxy_class(InstanceKlass* ik) {
DumpTimeClassInfo* info = _dumptime_table->get(ik);
if (info != NULL) {
if (info != nullptr) {
info->_is_archived_lambda_proxy = false;
info->set_excluded();
}
@ -249,7 +249,7 @@ void SystemDictionaryShared::reset_registered_lambda_proxy_class(InstanceKlass*
bool SystemDictionaryShared::is_early_klass(InstanceKlass* ik) {
DumpTimeClassInfo* info = _dumptime_table->get(ik);
return (info != NULL) ? info->is_early_klass() : false;
return (info != nullptr) ? info->is_early_klass() : false;
}
bool SystemDictionaryShared::is_hidden_lambda_proxy(InstanceKlass* ik) {
@ -279,7 +279,7 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) {
// agent during dump time).
return warn_excluded(k, "Unsupported location");
}
if (k->signers() != NULL) {
if (k->signers() != nullptr) {
// We cannot include signed classes in the archive because the certificates
// used during dump time may be different than those used during
// runtime (due to expiration, etc).
@ -316,7 +316,7 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) {
}
InstanceKlass* super = k->java_super();
if (super != NULL && check_for_exclusion(super, NULL)) {
if (super != nullptr && check_for_exclusion(super, nullptr)) {
ResourceMark rm;
log_warning(cds)("Skipping %s: super class %s is excluded", k->name()->as_C_string(), super->name()->as_C_string());
return true;
@ -326,7 +326,7 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) {
int len = interfaces->length();
for (int i = 0; i < len; i++) {
InstanceKlass* intf = interfaces->at(i);
if (check_for_exclusion(intf, NULL)) {
if (check_for_exclusion(intf, nullptr)) {
ResourceMark rm;
log_warning(cds)("Skipping %s: interface %s is excluded", k->name()->as_C_string(), intf->name()->as_C_string());
return true;
@ -338,7 +338,7 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) {
bool SystemDictionaryShared::is_builtin_loader(ClassLoaderData* loader_data) {
oop class_loader = loader_data->class_loader();
return (class_loader == NULL ||
return (class_loader == nullptr ||
SystemDictionary::is_system_class_loader(class_loader) ||
SystemDictionary::is_platform_class_loader(class_loader));
}
@ -389,10 +389,10 @@ bool SystemDictionaryShared::has_platform_or_app_classes() {
InstanceKlass* SystemDictionaryShared::find_or_load_shared_class(
Symbol* name, Handle class_loader, TRAPS) {
InstanceKlass* k = NULL;
InstanceKlass* k = nullptr;
if (UseSharedSpaces) {
if (!has_platform_or_app_classes()) {
return NULL;
return nullptr;
}
if (SystemDictionary::is_system_class_loader(class_loader()) ||
@ -406,17 +406,17 @@ InstanceKlass* SystemDictionaryShared::find_or_load_shared_class(
// Note: currently, find_or_load_shared_class is called only from
// JVM_FindLoadedClass and used for PlatformClassLoader and AppClassLoader,
// which are parallel-capable loaders, so a lock here is NOT taken.
assert(get_loader_lock_or_null(class_loader) == NULL, "ObjectLocker not required");
assert(get_loader_lock_or_null(class_loader) == nullptr, "ObjectLocker not required");
{
MutexLocker mu(THREAD, SystemDictionary_lock);
InstanceKlass* check = dictionary->find_class(THREAD, name);
if (check != NULL) {
if (check != nullptr) {
return check;
}
}
k = load_shared_class_for_builtin_loader(name, class_loader, THREAD);
if (k != NULL) {
if (k != nullptr) {
SharedClassLoadingMark slm(THREAD, k);
k = find_or_define_instance_class(name, class_loader, k, CHECK_NULL);
}
@ -430,7 +430,7 @@ class UnregisteredClassesTable : public ResourceHashtable<
15889, // prime number
AnyObj::C_HEAP> {};
static UnregisteredClassesTable* _unregistered_classes_table = NULL;
static UnregisteredClassesTable* _unregistered_classes_table = nullptr;
// true == class was successfully added; false == a duplicated class (with the same name) already exists.
bool SystemDictionaryShared::add_unregistered_class(Thread* current, InstanceKlass* klass) {
@ -440,7 +440,7 @@ bool SystemDictionaryShared::add_unregistered_class(Thread* current, InstanceKla
assert(Arguments::is_dumping_archive() || ClassListWriter::is_enabled(), "sanity");
MutexLocker ml(current, UnregisteredClassesTable_lock);
Symbol* name = klass->name();
if (_unregistered_classes_table == NULL) {
if (_unregistered_classes_table == nullptr) {
_unregistered_classes_table = new (mtClass)UnregisteredClassesTable();
}
bool created;
@ -466,13 +466,13 @@ InstanceKlass* SystemDictionaryShared::lookup_super_for_unregistered_class(
if (!ClassListParser::is_parsing_thread()) {
// Unregistered classes can be created only by ClassListParser::_parsing_thread.
return NULL;
return nullptr;
}
ClassListParser* parser = ClassListParser::instance();
if (parser == NULL) {
if (parser == nullptr) {
// We're still loading the well-known classes, before the ClassListParser is created.
return NULL;
return nullptr;
}
if (class_name->equals(parser->current_class_name())) {
// When this function is called, all the numbered super and interface types
@ -486,7 +486,7 @@ InstanceKlass* SystemDictionaryShared::lookup_super_for_unregistered_class(
// The VM is not trying to resolve a super type of parser->current_class_name().
// Instead, it's resolving an error class (because parser->current_class_name() has
// failed parsing or verification). Don't do anything here.
return NULL;
return nullptr;
}
}
@ -522,14 +522,14 @@ void SystemDictionaryShared::handle_class_unloading(InstanceKlass* klass) {
remove_dumptime_info(klass);
}
if (_unregistered_classes_table != NULL) {
if (_unregistered_classes_table != nullptr) {
// Remove the class from _unregistered_classes_table: keep the entry but
// set it to NULL. This ensure no classes with the same name can be
// set it to null. This ensure no classes with the same name can be
// added again.
MutexLocker ml(Thread::current(), UnregisteredClassesTable_lock);
InstanceKlass** v = _unregistered_classes_table->get(klass->name());
if (v != NULL) {
*v = NULL;
if (v != nullptr) {
*v = nullptr;
}
}
@ -544,7 +544,7 @@ bool SystemDictionaryShared::has_been_redefined(InstanceKlass* k) {
if (k->has_been_redefined()) {
return true;
}
if (k->java_super() != NULL && has_been_redefined(k->java_super())) {
if (k->java_super() != nullptr && has_been_redefined(k->java_super())) {
return true;
}
Array<InstanceKlass*>* interfaces = k->local_interfaces();
@ -563,7 +563,7 @@ void SystemDictionaryShared::validate_before_archiving(InstanceKlass* k) {
const char* name = k->name()->as_C_string();
DumpTimeClassInfo* info = _dumptime_table->get(k);
assert(!class_loading_may_happen(), "class loading must be disabled");
guarantee(info != NULL, "Class %s must be entered into _dumptime_table", name);
guarantee(info != nullptr, "Class %s must be entered into _dumptime_table", name);
guarantee(!info->is_excluded(), "Should not attempt to archive excluded class %s", name);
if (is_builtin(k)) {
if (k->is_hidden()) {
@ -671,7 +671,7 @@ void SystemDictionaryShared::set_class_has_failed_verification(InstanceKlass* ik
bool SystemDictionaryShared::has_class_failed_verification(InstanceKlass* ik) {
Arguments::assert_is_dumping_archive();
DumpTimeClassInfo* p = _dumptime_table->get(ik);
return (p == NULL) ? false : p->failed_verification();
return (p == nullptr) ? false : p->failed_verification();
}
void SystemDictionaryShared::dumptime_classes_do(class MetaspaceClosure* it) {
@ -748,17 +748,17 @@ void SystemDictionaryShared::add_lambda_proxy_class(InstanceKlass* caller_ik,
assert(caller_ik->class_loader() == lambda_ik->class_loader(), "mismatched class loader");
assert(caller_ik->class_loader_data() == lambda_ik->class_loader_data(), "mismatched class loader data");
assert(java_lang_Class::class_data(lambda_ik->java_mirror()) == NULL, "must not have class data");
assert(java_lang_Class::class_data(lambda_ik->java_mirror()) == nullptr, "must not have class data");
MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
lambda_ik->assign_class_loader_type();
lambda_ik->set_shared_classpath_index(caller_ik->shared_classpath_index());
InstanceKlass* nest_host = caller_ik->nest_host(CHECK);
assert(nest_host != NULL, "unexpected NULL nest_host");
assert(nest_host != nullptr, "unexpected nullptr nest_host");
DumpTimeClassInfo* info = _dumptime_table->get(lambda_ik);
if (info != NULL && !lambda_ik->is_non_strong_hidden() && is_builtin(lambda_ik) && is_builtin(caller_ik)
if (info != nullptr && !lambda_ik->is_non_strong_hidden() && is_builtin(lambda_ik) && is_builtin(caller_ik)
// Don't include the lambda proxy if its nest host is not in the "linked" state.
&& nest_host->is_linked()) {
// Set _is_archived_lambda_proxy in DumpTimeClassInfo so that the lambda_ik
@ -786,22 +786,22 @@ InstanceKlass* SystemDictionaryShared::get_shared_lambda_proxy_class(InstanceKla
LambdaProxyClassKey key(caller_ik, invoked_name, invoked_type,
method_type, member_method, instantiated_method_type);
const RunTimeLambdaProxyClassInfo* info = _static_archive.lookup_lambda_proxy_class(&key);
if (info == NULL) {
if (info == nullptr) {
info = _dynamic_archive.lookup_lambda_proxy_class(&key);
}
InstanceKlass* proxy_klass = NULL;
if (info != NULL) {
InstanceKlass* proxy_klass = nullptr;
if (info != nullptr) {
InstanceKlass* curr_klass = info->proxy_klass_head();
InstanceKlass* prev_klass = curr_klass;
if (curr_klass->lambda_proxy_is_available()) {
while (curr_klass->next_link() != NULL) {
while (curr_klass->next_link() != nullptr) {
prev_klass = curr_klass;
curr_klass = InstanceKlass::cast(curr_klass->next_link());
}
assert(curr_klass->is_hidden(), "must be");
assert(curr_klass->lambda_proxy_is_available(), "must be");
prev_klass->set_next_link(NULL);
prev_klass->set_next_link(nullptr);
proxy_klass = curr_klass;
proxy_klass->clear_lambda_proxy_is_available();
if (log_is_enabled(Debug, cds)) {
@ -830,18 +830,18 @@ InstanceKlass* SystemDictionaryShared::prepare_shared_lambda_proxy_class(Instanc
Handle class_loader(THREAD, caller_ik->class_loader());
Handle protection_domain;
PackageEntry* pkg_entry = caller_ik->package();
if (caller_ik->class_loader() != NULL) {
if (caller_ik->class_loader() != nullptr) {
protection_domain = CDSProtectionDomain::init_security_info(class_loader, caller_ik, pkg_entry, CHECK_NULL);
}
InstanceKlass* shared_nest_host = get_shared_nest_host(lambda_ik);
assert(shared_nest_host != NULL, "unexpected NULL _nest_host");
assert(shared_nest_host != nullptr, "unexpected nullptr _nest_host");
InstanceKlass* loaded_lambda =
SystemDictionary::load_shared_lambda_proxy_class(lambda_ik, class_loader, protection_domain, pkg_entry, CHECK_NULL);
if (loaded_lambda == NULL) {
return NULL;
if (loaded_lambda == nullptr) {
return nullptr;
}
// Ensures the nest host is the same as the lambda proxy's
@ -914,7 +914,7 @@ void SystemDictionaryShared::check_verification_constraints(InstanceKlass* klass
static oop get_class_loader_by(char type) {
if (type == (char)ClassLoader::BOOT_LOADER) {
return (oop)NULL;
return (oop)nullptr;
} else if (type == (char)ClassLoader::PLATFORM_LOADER) {
return SystemDictionary::java_platform_loader();
} else {
@ -964,7 +964,7 @@ void SystemDictionaryShared::record_linking_constraint(Symbol* name, InstanceKla
}
assert(is_builtin(klass), "must be");
assert(klass_loader != NULL, "should not be called for boot loader");
assert(klass_loader != nullptr, "should not be called for boot loader");
assert(loader1 != loader2, "must be");
if (DynamicDumpSharedSpaces && Thread::current()->is_VM_thread()) {
@ -991,7 +991,7 @@ bool SystemDictionaryShared::check_linking_constraints(Thread* current, Instance
}
if (klass->is_shared_platform_class() || klass->is_shared_app_class()) {
RunTimeClassInfo* info = RunTimeClassInfo::get_for(klass);
assert(info != NULL, "Sanity");
assert(info != nullptr, "Sanity");
if (info->_num_loader_constraints > 0) {
HandleMark hm(current);
for (int i = 0; i < info->_num_loader_constraints; i++) {
@ -1031,7 +1031,7 @@ bool SystemDictionaryShared::check_linking_constraints(Thread* current, Instance
bool SystemDictionaryShared::is_supported_invokedynamic(BootstrapInfo* bsi) {
LogTarget(Debug, cds, lambda) log;
if (bsi->arg_values() == NULL || !bsi->arg_values()->is_objArray()) {
if (bsi->arg_values() == nullptr || !bsi->arg_values()->is_objArray()) {
if (log.is_enabled()) {
LogStream log_stream(log);
log.print("bsi check failed");
@ -1274,11 +1274,11 @@ const RunTimeClassInfo*
SystemDictionaryShared::find_record(RunTimeSharedDictionary* static_dict, RunTimeSharedDictionary* dynamic_dict, Symbol* name) {
if (!UseSharedSpaces || !name->is_shared()) {
// The names of all shared classes must also be a shared Symbol.
return NULL;
return nullptr;
}
unsigned int hash = SystemDictionaryShared::hash_for_shared_dictionary_quick(name);
const RunTimeClassInfo* record = NULL;
const RunTimeClassInfo* record = nullptr;
if (DynamicArchive::is_mapped()) {
// Use the regenerated holder classes in the dynamic archive as they
// have more methods than those in the base archive.
@ -1299,7 +1299,7 @@ SystemDictionaryShared::find_record(RunTimeSharedDictionary* static_dict, RunTim
record = static_dict->lookup(name, hash, 0);
}
if (record == NULL && DynamicArchive::is_mapped()) {
if (record == nullptr && DynamicArchive::is_mapped()) {
record = dynamic_dict->lookup(name, hash, 0);
}
@ -1310,17 +1310,17 @@ InstanceKlass* SystemDictionaryShared::find_builtin_class(Symbol* name) {
const RunTimeClassInfo* record = find_record(&_static_archive._builtin_dictionary,
&_dynamic_archive._builtin_dictionary,
name);
if (record != NULL) {
if (record != nullptr) {
assert(!record->_klass->is_hidden(), "hidden class cannot be looked up by name");
assert(check_alignment(record->_klass), "Address not aligned");
// We did not save the classfile data of the generated LambdaForm invoker classes,
// so we cannot support CLFH for such classes.
if (record->_klass->is_generated_shared_class() && JvmtiExport::should_post_class_file_load_hook()) {
return NULL;
return nullptr;
}
return record->_klass;
} else {
return NULL;
return nullptr;
}
}
@ -1445,8 +1445,8 @@ class CloneDumpTimeClassTable: public StackObj {
public:
CloneDumpTimeClassTable(DumpTimeSharedClassTable* table, DumpTimeSharedClassTable* clone) :
_table(table), _cloned_table(clone) {
assert(_table != NULL, "_dumptime_table is NULL");
assert(_cloned_table != NULL, "_cloned_table is NULL");
assert(_table != nullptr, "_dumptime_table is nullptr");
assert(_cloned_table != nullptr, "_cloned_table is nullptr");
}
void do_entry(InstanceKlass* k, DumpTimeClassInfo& info) {
if (!info.is_excluded()) {
@ -1464,8 +1464,8 @@ class CloneDumpTimeLambdaProxyClassTable: StackObj {
CloneDumpTimeLambdaProxyClassTable(DumpTimeLambdaProxyClassDictionary* table,
DumpTimeLambdaProxyClassDictionary* clone) :
_table(table), _cloned_table(clone) {
assert(_table != NULL, "_dumptime_table is NULL");
assert(_cloned_table != NULL, "_cloned_table is NULL");
assert(_table != nullptr, "_dumptime_table is nullptr");
assert(_cloned_table != nullptr, "_cloned_table is nullptr");
}
bool do_entry(LambdaProxyClassKey& key, DumpTimeLambdaProxyClassInfo& info) {
@ -1496,13 +1496,13 @@ void SystemDictionaryShared::clone_dumptime_tables() {
Arguments::assert_is_dumping_archive();
assert_lock_strong(DumpTimeTable_lock);
assert(_cloned_dumptime_table == NULL, "_cloned_dumptime_table must be cleaned");
assert(_cloned_dumptime_table == nullptr, "_cloned_dumptime_table must be cleaned");
_cloned_dumptime_table = new (mtClass) DumpTimeSharedClassTable;
CloneDumpTimeClassTable copy_classes(_dumptime_table, _cloned_dumptime_table);
_dumptime_table->iterate_all_live_classes(&copy_classes);
_cloned_dumptime_table->update_counts();
assert(_cloned_dumptime_lambda_proxy_class_dictionary == NULL,
assert(_cloned_dumptime_lambda_proxy_class_dictionary == nullptr,
"_cloned_dumptime_lambda_proxy_class_dictionary must be cleaned");
_cloned_dumptime_lambda_proxy_class_dictionary =
new (mtClass) DumpTimeLambdaProxyClassDictionary;
@ -1515,11 +1515,11 @@ void SystemDictionaryShared::restore_dumptime_tables() {
assert_lock_strong(DumpTimeTable_lock);
delete _dumptime_table;
_dumptime_table = _cloned_dumptime_table;
_cloned_dumptime_table = NULL;
_cloned_dumptime_table = nullptr;
delete _dumptime_lambda_proxy_class_dictionary;
_dumptime_lambda_proxy_class_dictionary = _cloned_dumptime_lambda_proxy_class_dictionary;
_cloned_dumptime_lambda_proxy_class_dictionary = NULL;
_cloned_dumptime_lambda_proxy_class_dictionary = nullptr;
}
class CleanupDumpTimeLambdaProxyClassTable: StackObj {
@ -1531,12 +1531,12 @@ class CleanupDumpTimeLambdaProxyClassTable: StackObj {
// If the caller class and/or nest_host are excluded, the associated lambda proxy
// must also be excluded.
bool always_exclude = SystemDictionaryShared::check_for_exclusion(caller_ik, NULL) ||
SystemDictionaryShared::check_for_exclusion(nest_host, NULL);
bool always_exclude = SystemDictionaryShared::check_for_exclusion(caller_ik, nullptr) ||
SystemDictionaryShared::check_for_exclusion(nest_host, nullptr);
for (int i = info._proxy_klasses->length() - 1; i >= 0; i--) {
InstanceKlass* ik = info._proxy_klasses->at(i);
if (always_exclude || SystemDictionaryShared::check_for_exclusion(ik, NULL)) {
if (always_exclude || SystemDictionaryShared::check_for_exclusion(ik, nullptr)) {
SystemDictionaryShared::reset_registered_lambda_proxy_class(ik);
info._proxy_klasses->remove_at(i);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
@ -127,8 +127,8 @@ class SharedClassLoadingMark {
public:
SharedClassLoadingMark(Thread* current, InstanceKlass* ik) : THREAD(current), _klass(ik) {}
~SharedClassLoadingMark() {
assert(THREAD != NULL, "Current thread is NULL");
assert(_klass != NULL, "InstanceKlass is NULL");
assert(THREAD != nullptr, "Current thread is nullptr");
assert(_klass != nullptr, "InstanceKlass is nullptr");
if (HAS_PENDING_EXCEPTION) {
if (_klass->is_shared()) {
_klass->set_shared_loading_failed();
@ -186,7 +186,7 @@ private:
const ClassFileStream* cfs,
TRAPS);
// Guaranteed to return non-NULL value for non-shared classes.
// Guaranteed to return non-null value for non-shared classes.
// k must not be a shared class.
static DumpTimeClassInfo* get_info(InstanceKlass* k);
static DumpTimeClassInfo* get_info_locked(InstanceKlass* k);
@ -278,10 +278,10 @@ public:
Symbol* invoked_type,
Symbol* method_type,
Method* member_method,
Symbol* instantiated_method_type) NOT_CDS_RETURN_(NULL);
static InstanceKlass* get_shared_nest_host(InstanceKlass* lambda_ik) NOT_CDS_RETURN_(NULL);
Symbol* instantiated_method_type) NOT_CDS_RETURN_(nullptr);
static InstanceKlass* get_shared_nest_host(InstanceKlass* lambda_ik) NOT_CDS_RETURN_(nullptr);
static InstanceKlass* prepare_shared_lambda_proxy_class(InstanceKlass* lambda_ik,
InstanceKlass* caller_ik, TRAPS) NOT_CDS_RETURN_(NULL);
InstanceKlass* caller_ik, TRAPS) NOT_CDS_RETURN_(nullptr);
static bool check_linking_constraints(Thread* current, InstanceKlass* klass) NOT_CDS_RETURN_(false);
static void record_linking_constraint(Symbol* name, InstanceKlass* klass,
Handle loader1, Handle loader2) NOT_CDS_RETURN;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, 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
@ -187,10 +187,10 @@ void VerificationType::print_on(outputStream* st) const {
} else if (is_uninitialized()) {
st->print("uninitialized %d", bci());
} else {
if (name() != NULL) {
if (name() != nullptr) {
name()->print_value_on(st);
} else {
st->print_cr("NULL");
st->print_cr("null");
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -71,31 +71,31 @@ extern "C" {
typedef jboolean (*verify_byte_codes_fn_t)(JNIEnv *, jclass, char *, jint, jint);
}
static verify_byte_codes_fn_t volatile _verify_byte_codes_fn = NULL;
static verify_byte_codes_fn_t volatile _verify_byte_codes_fn = nullptr;
static verify_byte_codes_fn_t verify_byte_codes_fn() {
if (_verify_byte_codes_fn != NULL)
if (_verify_byte_codes_fn != nullptr)
return _verify_byte_codes_fn;
MutexLocker locker(Verify_lock);
if (_verify_byte_codes_fn != NULL)
if (_verify_byte_codes_fn != nullptr)
return _verify_byte_codes_fn;
// Load verify dll
char buffer[JVM_MAXPATHLEN];
char ebuf[1024];
if (!os::dll_locate_lib(buffer, sizeof(buffer), Arguments::get_dll_dir(), "verify"))
return NULL; // Caller will throw VerifyError
return nullptr; // Caller will throw VerifyError
void *lib_handle = os::dll_load(buffer, ebuf, sizeof(ebuf));
if (lib_handle == NULL)
return NULL; // Caller will throw VerifyError
if (lib_handle == nullptr)
return nullptr; // Caller will throw VerifyError
void *fn = os::dll_lookup(lib_handle, "VerifyClassForMajorVersion");
if (fn == NULL)
return NULL; // Caller will throw VerifyError
if (fn == nullptr)
return nullptr; // Caller will throw VerifyError
return _verify_byte_codes_fn = CAST_TO_FN_PTR(verify_byte_codes_fn_t, fn);
}
@ -104,7 +104,7 @@ static verify_byte_codes_fn_t verify_byte_codes_fn() {
// Methods in Verifier
bool Verifier::should_verify_for(oop class_loader, bool should_verify_class) {
return (class_loader == NULL || !should_verify_class) ?
return (class_loader == nullptr || !should_verify_class) ?
BytecodeVerificationLocal : BytecodeVerificationRemote;
}
@ -119,14 +119,14 @@ bool Verifier::relax_access_for(oop loader) {
}
void Verifier::trace_class_resolution(Klass* resolve_class, InstanceKlass* verify_class) {
assert(verify_class != NULL, "Unexpected null verify_class");
assert(verify_class != nullptr, "Unexpected null verify_class");
ResourceMark rm;
Symbol* s = verify_class->source_file_name();
const char* source_file = (s != NULL ? s->as_C_string() : NULL);
const char* source_file = (s != nullptr ? s->as_C_string() : nullptr);
const char* verify = verify_class->external_name();
const char* resolve = resolve_class->external_name();
// print in a single call to reduce interleaving between threads
if (source_file != NULL) {
if (source_file != nullptr) {
log_debug(class, resolve)("%s %s %s (verification)", verify, resolve, source_file);
} else {
log_debug(class, resolve)("%s %s (verification)", verify, resolve);
@ -135,10 +135,10 @@ void Verifier::trace_class_resolution(Klass* resolve_class, InstanceKlass* verif
// Prints the end-verification message to the appropriate output.
void Verifier::log_end_verification(outputStream* st, const char* klassName, Symbol* exception_name, oop pending_exception) {
if (pending_exception != NULL) {
if (pending_exception != nullptr) {
st->print("Verification for %s has", klassName);
oop message = java_lang_Throwable::message(pending_exception);
if (message != NULL) {
if (message != nullptr) {
char* ex_msg = java_lang_String::as_utf8_string(message);
st->print_cr(" exception pending '%s %s'",
pending_exception->klass()->external_name(), ex_msg);
@ -146,7 +146,7 @@ void Verifier::log_end_verification(outputStream* st, const char* klassName, Sym
st->print_cr(" exception pending %s ",
pending_exception->klass()->external_name());
}
} else if (exception_name != NULL) {
} else if (exception_name != nullptr) {
st->print_cr("Verification for %s failed", klassName);
}
st->print_cr("End class verification for: %s", klassName);
@ -165,7 +165,7 @@ bool Verifier::verify(InstanceKlass* klass, bool should_verify_class, TRAPS) {
// effect (sic!) for external_name(), but instead of doing that, we opt to
// explicitly push the hashcode in here. This is signify the following block
// is IMPORTANT:
if (klass->java_mirror() != NULL) {
if (klass->java_mirror() != nullptr) {
klass->java_mirror()->identity_hash();
}
@ -186,10 +186,10 @@ bool Verifier::verify(InstanceKlass* klass, bool should_verify_class, TRAPS) {
// If the class should be verified, first see if we can use the split
// verifier. If not, or if verification fails and can failover, then
// call the inference verifier.
Symbol* exception_name = NULL;
Symbol* exception_name = nullptr;
const size_t message_buffer_len = klass->name()->utf8_length() + 1024;
char* message_buffer = NULL;
char* exception_message = NULL;
char* message_buffer = nullptr;
char* exception_message = nullptr;
log_info(class, init)("Start class verification for: %s", klass->external_name());
if (klass->major_version() >= STACKMAP_ATTRIBUTE_MAJOR_VERSION) {
@ -216,7 +216,7 @@ bool Verifier::verify(InstanceKlass* klass, bool should_verify_class, TRAPS) {
exception_name = inference_verify(
klass, message_buffer, message_buffer_len, THREAD);
}
if (exception_name != NULL) {
if (exception_name != nullptr) {
exception_message = split_verifier.exception_message();
}
} else {
@ -239,7 +239,7 @@ bool Verifier::verify(InstanceKlass* klass, bool should_verify_class, TRAPS) {
if (HAS_PENDING_EXCEPTION) {
return false; // use the existing exception
} else if (exception_name == NULL) {
} else if (exception_name == nullptr) {
return true; // verification succeeded
} else { // VerifyError or ClassFormatError to be created and thrown
Klass* kls =
@ -248,7 +248,7 @@ bool Verifier::verify(InstanceKlass* klass, bool should_verify_class, TRAPS) {
Verifier::trace_class_resolution(kls, klass);
}
while (kls != NULL) {
while (kls != nullptr) {
if (kls == klass) {
// If the class being verified is the exception we're creating
// or one of it's superclasses, we're in trouble and are going
@ -258,10 +258,10 @@ bool Verifier::verify(InstanceKlass* klass, bool should_verify_class, TRAPS) {
}
kls = kls->super();
}
if (message_buffer != NULL) {
if (message_buffer != nullptr) {
message_buffer[message_buffer_len - 1] = '\0'; // just to be sure
}
assert(exception_message != NULL, "");
assert(exception_message != nullptr, "");
THROW_MSG_(exception_name, exception_message, false);
}
}
@ -270,7 +270,7 @@ bool Verifier::is_eligible_for_verification(InstanceKlass* klass, bool should_ve
Symbol* name = klass->name();
Klass* refl_magic_klass = vmClasses::reflect_MagicAccessorImpl_klass();
bool is_reflect = refl_magic_klass != NULL && klass->is_subtype_of(refl_magic_klass);
bool is_reflect = refl_magic_klass != nullptr && klass->is_subtype_of(refl_magic_klass);
return (should_verify_for(klass->class_loader(), should_verify_class) &&
// return if the class is a bootstrapping class
@ -305,7 +305,7 @@ Symbol* Verifier::inference_verify(
verify_byte_codes_fn_t verify_func = verify_byte_codes_fn();
if (verify_func == NULL) {
if (verify_func == nullptr) {
jio_snprintf(message, message_len, "Could not link verifier");
return vmSymbols::java_lang_VerifyError();
}
@ -333,14 +333,14 @@ Symbol* Verifier::inference_verify(
if (result == 0) {
return vmSymbols::java_lang_VerifyError();
} else if (result == 1) {
return NULL; // verified.
return nullptr; // verified.
} else if (result == 2) {
THROW_MSG_(vmSymbols::java_lang_OutOfMemoryError(), message, NULL);
THROW_MSG_(vmSymbols::java_lang_OutOfMemoryError(), message, nullptr);
} else if (result == 3) {
return vmSymbols::java_lang_ClassFormatError();
} else {
ShouldNotReachHere();
return NULL;
return nullptr;
}
}
@ -348,36 +348,36 @@ TypeOrigin TypeOrigin::null() {
return TypeOrigin();
}
TypeOrigin TypeOrigin::local(u2 index, StackMapFrame* frame) {
assert(frame != NULL, "Must have a frame");
assert(frame != nullptr, "Must have a frame");
return TypeOrigin(CF_LOCALS, index, StackMapFrame::copy(frame),
frame->local_at(index));
}
TypeOrigin TypeOrigin::stack(u2 index, StackMapFrame* frame) {
assert(frame != NULL, "Must have a frame");
assert(frame != nullptr, "Must have a frame");
return TypeOrigin(CF_STACK, index, StackMapFrame::copy(frame),
frame->stack_at(index));
}
TypeOrigin TypeOrigin::sm_local(u2 index, StackMapFrame* frame) {
assert(frame != NULL, "Must have a frame");
assert(frame != nullptr, "Must have a frame");
return TypeOrigin(SM_LOCALS, index, StackMapFrame::copy(frame),
frame->local_at(index));
}
TypeOrigin TypeOrigin::sm_stack(u2 index, StackMapFrame* frame) {
assert(frame != NULL, "Must have a frame");
assert(frame != nullptr, "Must have a frame");
return TypeOrigin(SM_STACK, index, StackMapFrame::copy(frame),
frame->stack_at(index));
}
TypeOrigin TypeOrigin::bad_index(u2 index) {
return TypeOrigin(BAD_INDEX, index, NULL, VerificationType::bogus_type());
return TypeOrigin(BAD_INDEX, index, nullptr, VerificationType::bogus_type());
}
TypeOrigin TypeOrigin::cp(u2 index, VerificationType vt) {
return TypeOrigin(CONST_POOL, index, NULL, vt);
return TypeOrigin(CONST_POOL, index, nullptr, vt);
}
TypeOrigin TypeOrigin::signature(VerificationType vt) {
return TypeOrigin(SIG, 0, NULL, vt);
return TypeOrigin(SIG, 0, nullptr, vt);
}
TypeOrigin TypeOrigin::implicit(VerificationType t) {
return TypeOrigin(IMPLICIT, 0, NULL, t);
return TypeOrigin(IMPLICIT, 0, nullptr, t);
}
TypeOrigin TypeOrigin::frame(StackMapFrame* frame) {
return TypeOrigin(FRAME_ONLY, 0, StackMapFrame::copy(frame),
@ -385,7 +385,7 @@ TypeOrigin TypeOrigin::frame(StackMapFrame* frame) {
}
void TypeOrigin::reset_frame() {
if (_frame != NULL) {
if (_frame != nullptr) {
_frame->restore();
}
}
@ -422,7 +422,7 @@ void TypeOrigin::details(outputStream* ss) const {
#ifdef ASSERT
void TypeOrigin::print_on(outputStream* str) const {
str->print("{%d,%d,%p:", _origin, _index, _frame);
if (_frame != NULL) {
if (_frame != nullptr) {
_frame->print_on(str);
} else {
str->print("null");
@ -507,7 +507,7 @@ void ErrorContext::reason_details(outputStream* ss) const {
}
void ErrorContext::location_details(outputStream* ss, const Method* method) const {
if (_bci != -1 && method != NULL) {
if (_bci != -1 && method != nullptr) {
streamIndentor si(ss);
const char* bytecode_name = "<invalid>";
if (method->validate_bci(_bci) != -1) {
@ -529,12 +529,12 @@ void ErrorContext::location_details(outputStream* ss, const Method* method) cons
void ErrorContext::frame_details(outputStream* ss) const {
streamIndentor si(ss);
if (_type.is_valid() && _type.frame() != NULL) {
if (_type.is_valid() && _type.frame() != nullptr) {
ss->indent().print_cr("Current Frame:");
streamIndentor si2(ss);
_type.frame()->print_on(ss);
}
if (_expected.is_valid() && _expected.frame() != NULL) {
if (_expected.is_valid() && _expected.frame() != nullptr) {
ss->indent().print_cr("Stackmap Frame:");
streamIndentor si2(ss);
_expected.frame()->print_on(ss);
@ -542,7 +542,7 @@ void ErrorContext::frame_details(outputStream* ss) const {
}
void ErrorContext::bytecode_details(outputStream* ss, const Method* method) const {
if (method != NULL) {
if (method != nullptr) {
streamIndentor si(ss);
ss->indent().print_cr("Bytecode:");
streamIndentor si2(ss);
@ -551,7 +551,7 @@ void ErrorContext::bytecode_details(outputStream* ss, const Method* method) cons
}
void ErrorContext::handler_details(outputStream* ss, const Method* method) const {
if (method != NULL) {
if (method != nullptr) {
streamIndentor si(ss);
ExceptionTable table(method);
if (table.length() > 0) {
@ -566,7 +566,7 @@ void ErrorContext::handler_details(outputStream* ss, const Method* method) const
}
void ErrorContext::stackmap_details(outputStream* ss, const Method* method) const {
if (method != NULL && method->has_stackmap_table()) {
if (method != nullptr && method->has_stackmap_table()) {
streamIndentor si(ss);
ss->indent().print_cr("Stackmap Table:");
Array<u1>* data = method->stackmap_data();
@ -593,14 +593,14 @@ void ErrorContext::stackmap_details(outputStream* ss, const Method* method) cons
// Methods in ClassVerifier
ClassVerifier::ClassVerifier(JavaThread* current, InstanceKlass* klass)
: _thread(current), _previous_symbol(NULL), _symbols(NULL), _exception_type(NULL),
_message(NULL), _klass(klass) {
: _thread(current), _previous_symbol(nullptr), _symbols(nullptr), _exception_type(nullptr),
_message(nullptr), _klass(klass) {
_this_type = VerificationType::reference_type(klass->name());
}
ClassVerifier::~ClassVerifier() {
// Decrement the reference count for any symbols created.
if (_symbols != NULL) {
if (_symbols != nullptr) {
for (int i = 0; i < _symbols->length(); i++) {
Symbol* s = _symbols->at(i);
s->decrement_refcount();
@ -1847,7 +1847,7 @@ char* ClassVerifier::generate_code_data(const methodHandle& m, u4 code_length, T
}
} else {
verify_error(ErrorContext::bad_code(bcs.bci()), "Bad instruction");
return NULL;
return nullptr;
}
}
@ -2029,7 +2029,7 @@ void ClassVerifier::verify_cp_type(
// In this case, a constant pool cache exists and some indices refer to that
// instead. Be sure we don't pick up such indices by accident.
// We must check was_recursively_verified() before we get here.
guarantee(cp->cache() == NULL, "not rewritten yet");
guarantee(cp->cache() == nullptr, "not rewritten yet");
verify_cp_index(bci, cp, index, CHECK_VERIFY(this));
unsigned int tag = cp->tag_at(index).value();
@ -2067,7 +2067,7 @@ void ClassVerifier::verify_error(ErrorContext ctx, const char* msg, ...) {
#ifdef ASSERT
ResourceMark rm;
const char* exception_name = _exception_type->as_C_string();
Exceptions::debug_check_abort(exception_name, NULL);
Exceptions::debug_check_abort(exception_name, nullptr);
#endif // ndef ASSERT
}
@ -2098,7 +2098,7 @@ Klass* ClassVerifier::load_class(Symbol* name, TRAPS) {
name, Handle(THREAD, loader), Handle(THREAD, protection_domain),
true, THREAD);
if (kls != NULL) {
if (kls != nullptr) {
if (log_is_enabled(Debug, class, resolve)) {
Verifier::trace_class_resolution(kls, current_class());
}
@ -2122,14 +2122,14 @@ bool ClassVerifier::is_protected_access(InstanceKlass* this_class,
fieldDescriptor fd;
if (is_method) {
Method* m = target_instance->uncached_lookup_method(field_name, field_sig, Klass::OverpassLookupMode::find);
if (m != NULL && m->is_protected()) {
if (m != nullptr && m->is_protected()) {
if (!this_class->is_same_class_package(m->method_holder())) {
return true;
}
}
} else {
Klass* member_klass = target_instance->find_field(field_name, field_sig, &fd);
if (member_klass != NULL && fd.is_protected()) {
if (member_klass != nullptr && fd.is_protected()) {
if (!this_class->is_same_class_package(member_klass)) {
return true;
}
@ -2285,13 +2285,13 @@ void ClassVerifier::verify_switch(
stackmap_table->check_jump_target(
current_frame, target, CHECK_VERIFY(this));
}
NOT_PRODUCT(aligned_bcp = NULL); // no longer valid at this point
NOT_PRODUCT(aligned_bcp = nullptr); // no longer valid at this point
}
bool ClassVerifier::name_in_supers(
Symbol* ref_name, InstanceKlass* current) {
Klass* super = current->super();
while (super != NULL) {
while (super != nullptr) {
if (super->name() == ref_name) {
return true;
}
@ -2728,7 +2728,7 @@ void ClassVerifier::verify_invoke_init(
cp->signature_ref_at(bcs->get_index_u2()),
Klass::OverpassLookupMode::find);
// Do nothing if method is not found. Let resolution detect the error.
if (m != NULL) {
if (m != nullptr) {
InstanceKlass* mh = m->method_holder();
if (m->is_protected() && !mh->is_same_class_package(_klass)) {
bool assignable = current_type().is_assignable_from(
@ -2765,10 +2765,10 @@ bool ClassVerifier::is_same_or_direct_interface(
VerificationType ref_class_type) {
if (ref_class_type.equals(klass_type)) return true;
Array<InstanceKlass*>* local_interfaces = klass->local_interfaces();
if (local_interfaces != NULL) {
if (local_interfaces != nullptr) {
for (int x = 0; x < local_interfaces->length(); x++) {
InstanceKlass* k = local_interfaces->at(x);
assert (k != NULL && k->is_interface(), "invalid interface");
assert (k != nullptr && k->is_interface(), "invalid interface");
if (ref_class_type.equals(VerificationType::reference_type(k->name()))) {
return true;
}
@ -2833,10 +2833,10 @@ void ClassVerifier::verify_invoke_instructions(
// Get the signature's verification types.
sig_as_verification_types* mth_sig_verif_types;
sig_as_verification_types** mth_sig_verif_types_ptr = method_signatures_table()->get(sig_index);
if (mth_sig_verif_types_ptr != NULL) {
if (mth_sig_verif_types_ptr != nullptr) {
// Found the entry for the signature's verification types in the hash table.
mth_sig_verif_types = *mth_sig_verif_types_ptr;
assert(mth_sig_verif_types != NULL, "Unexpected NULL sig_as_verification_types value");
assert(mth_sig_verif_types != nullptr, "Unexpected null sig_as_verification_types value");
} else {
// Not found, add the entry to the table.
GrowableArray<VerificationType>* verif_types = new GrowableArray<VerificationType>(10);
@ -2908,7 +2908,7 @@ void ClassVerifier::verify_invoke_instructions(
// Get the verification types for the method's arguments.
GrowableArray<VerificationType>* sig_verif_types = mth_sig_verif_types->sig_verif_types();
assert(sig_verif_types != NULL, "Missing signature's array of verification types");
assert(sig_verif_types != nullptr, "Missing signature's array of verification types");
// Match method descriptor with operand stack
// The arguments are on the stack in descending order.
for (int i = nargs - 1; i >= 0; i--) { // Run backwards
@ -2932,7 +2932,7 @@ void ClassVerifier::verify_invoke_instructions(
current_frame->pop_stack(ref_class_type, CHECK_VERIFY(this));
if (current_type() != stack_object_type) {
if (was_recursively_verified()) return;
assert(cp->cache() == NULL, "not rewritten yet");
assert(cp->cache() == nullptr, "not rewritten yet");
Symbol* ref_class_name =
cp->klass_name_at(cp->klass_ref_index_at(index));
// See the comments in verify_field_instructions() for
@ -2993,7 +2993,7 @@ void ClassVerifier::verify_invoke_instructions(
VerificationType ClassVerifier::get_newarray_type(
u2 index, u2 bci, TRAPS) {
const char* from_bt[] = {
NULL, NULL, NULL, NULL, "[Z", "[C", "[F", "[D", "[B", "[S", "[I", "[J",
nullptr, nullptr, nullptr, nullptr, "[Z", "[C", "[F", "[D", "[B", "[S", "[I", "[J",
};
if (index < T_BOOLEAN || index > T_LONG) {
verify_error(ErrorContext::bad_code(bci), "Illegal newarray instruction");
@ -3150,13 +3150,13 @@ void ClassVerifier::verify_return_value(
// they can be reference counted.
Symbol* ClassVerifier::create_temporary_symbol(const char *name, int length) {
// Quick deduplication check
if (_previous_symbol != NULL && _previous_symbol->equals(name, length)) {
if (_previous_symbol != nullptr && _previous_symbol->equals(name, length)) {
return _previous_symbol;
}
Symbol* sym = SymbolTable::new_symbol(name, length);
if (!sym->is_permanent()) {
if (_symbols == NULL) {
_symbols = new GrowableArray<Symbol*>(50, 0, NULL);
if (_symbols == nullptr) {
_symbols = new GrowableArray<Symbol*>(50, 0, nullptr);
}
_symbols->push(sym);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -116,7 +116,7 @@ class TypeOrigin {
: _origin(origin), _index(index), _frame(frame), _type(type) {}
public:
TypeOrigin() : _origin(NONE), _index(0), _frame(NULL) {}
TypeOrigin() : _origin(NONE), _index(0), _frame(nullptr) {}
static TypeOrigin null();
static TypeOrigin local(u2 index, StackMapFrame* frame);
@ -422,7 +422,7 @@ class ClassVerifier : public StackObj {
// Return status modes
Symbol* result() const { return _exception_type; }
bool has_error() const { return result() != NULL; }
bool has_error() const { return result() != nullptr; }
char* exception_message() {
stringStream ss;
ss.print("%s", _message);
@ -459,8 +459,8 @@ class ClassVerifier : public StackObj {
}
if (!s->is_permanent()) {
s->increment_refcount();
if (_symbols == NULL) {
_symbols = new GrowableArray<Symbol*>(50, 0, NULL);
if (_symbols == nullptr) {
_symbols = new GrowableArray<Symbol*>(50, 0, nullptr);
}
_symbols->push(s);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 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
@ -41,8 +41,8 @@
#include "runtime/globals.hpp"
InstanceKlass* vmClasses::_klasses[static_cast<int>(vmClassID::LIMIT)]
= { NULL /*, NULL...*/ };
InstanceKlass* vmClasses::_box_klasses[T_VOID+1] = { NULL /*, NULL...*/ };
= { nullptr /*, nullptr...*/ };
InstanceKlass* vmClasses::_box_klasses[T_VOID+1] = { nullptr /*, nullptr...*/ };
// CDS: scan and relocate all classes referenced by _klasses[].
@ -53,7 +53,7 @@ void vmClasses::metaspace_pointers_do(MetaspaceClosure* it) {
}
bool vmClasses::is_loaded(InstanceKlass* klass) {
return klass != NULL && klass->is_loaded();
return klass != nullptr && klass->is_loaded();
}
// Compact table of the vmSymbolIDs of all the VM classes (stored as short to save space)
@ -102,7 +102,7 @@ bool vmClasses::resolve(vmClassID id, TRAPS) {
Klass* k = SystemDictionary::resolve_or_fail(symbol, true, CHECK_false);
(*klassp) = InstanceKlass::cast(k);
}
return ((*klassp) != NULL);
return ((*klassp) != nullptr);
}
void vmClasses::resolve_until(vmClassID limit_id, vmClassID &start_id, TRAPS) {
@ -154,7 +154,7 @@ void vmClasses::resolve_all(TRAPS) {
resolve_through(VM_CLASS_ID(Class_klass), scan, CHECK);
}
assert(vmClasses::Object_klass() != NULL, "well-known classes should now be initialized");
assert(vmClasses::Object_klass() != nullptr, "well-known classes should now be initialized");
java_lang_Object::register_natives(CHECK);
@ -226,13 +226,13 @@ void vmClasses::resolve_all(TRAPS) {
void vmClasses::resolve_shared_class(InstanceKlass* klass, ClassLoaderData* loader_data, Handle domain, TRAPS) {
assert(!Universe::is_fully_initialized(), "We can make short cuts only during VM initialization");
assert(klass->is_shared(), "Must be shared class");
if (klass->class_loader_data() != NULL) {
if (klass->class_loader_data() != nullptr) {
return;
}
// add super and interfaces first
Klass* super = klass->super();
if (super != NULL && super->class_loader_data() == NULL) {
if (super != nullptr && super->class_loader_data() == nullptr) {
assert(super->is_instance_klass(), "Super should be instance klass");
resolve_shared_class(InstanceKlass::cast(super), loader_data, domain, CHECK);
}
@ -240,12 +240,12 @@ void vmClasses::resolve_shared_class(InstanceKlass* klass, ClassLoaderData* load
Array<InstanceKlass*>* ifs = klass->local_interfaces();
for (int i = 0; i < ifs->length(); i++) {
InstanceKlass* ik = ifs->at(i);
if (ik->class_loader_data() == NULL) {
if (ik->class_loader_data() == nullptr) {
resolve_shared_class(ik, loader_data, domain, CHECK);
}
}
klass->restore_unshareable_info(loader_data, domain, NULL, THREAD);
klass->restore_unshareable_info(loader_data, domain, nullptr, THREAD);
SystemDictionary::load_shared_class_misc(klass, loader_data);
Dictionary* dictionary = loader_data->dictionary();
dictionary->add_klass(THREAD, klass->name(), klass);
@ -258,7 +258,7 @@ void vmClasses::resolve_shared_class(InstanceKlass* klass, ClassLoaderData* load
// Tells if a given klass is a box (wrapper class, such as java.lang.Integer).
// If so, returns the basic type it holds. If not, returns T_OBJECT.
BasicType vmClasses::box_klass_type(Klass* k) {
assert(k != NULL, "");
assert(k != nullptr, "");
for (int i = T_BOOLEAN; i < T_VOID+1; i++) {
if (_box_klasses[i] == k)
return (BasicType)i;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 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
@ -52,7 +52,7 @@ class vmClasses : AllStatic {
}
static InstanceKlass* check_klass(InstanceKlass* k) {
assert(k != NULL, "klass not loaded");
assert(k != nullptr, "klass not loaded");
return k;
}

View File

@ -620,7 +620,7 @@ void vmIntrinsics::init_vm_intrinsic_name_table() {
const char* vmIntrinsics::name_at(vmIntrinsics::ID id) {
const char** nt = &vm_intrinsic_name_table[0];
if (nt[as_int(_none)] == NULL) {
if (nt[as_int(_none)] == nullptr) {
init_vm_intrinsic_name_table();
}
@ -632,7 +632,7 @@ const char* vmIntrinsics::name_at(vmIntrinsics::ID id) {
vmIntrinsics::ID vmIntrinsics::find_id(const char* name) {
const char** nt = &vm_intrinsic_name_table[0];
if (nt[as_int(_none)] == NULL) {
if (nt[as_int(_none)] == nullptr) {
init_vm_intrinsic_name_table();
}
@ -655,7 +655,7 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
// not initialized yet, process Control/DisableIntrinsic
if (vm_intrinsic_control_words[as_int(_none)].is_default()) {
for (ControlIntrinsicIter iter(ControlIntrinsic); *iter != NULL; ++iter) {
for (ControlIntrinsicIter iter(ControlIntrinsic); *iter != nullptr; ++iter) {
vmIntrinsics::ID id = vmIntrinsics::find_id(*iter);
if (id != vmIntrinsics::_none) {
@ -664,7 +664,7 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
}
// Order matters, DisableIntrinsic can overwrite ControlIntrinsic
for (ControlIntrinsicIter iter(DisableIntrinsic, true/*disable_all*/); *iter != NULL; ++iter) {
for (ControlIntrinsicIter iter(DisableIntrinsic, true/*disable_all*/); *iter != nullptr; ++iter) {
vmIntrinsics::ID id = vmIntrinsics::find_id(*iter);
if (id != vmIntrinsics::_none) {
@ -768,7 +768,7 @@ const char* vmIntrinsics::short_name_as_C_string(vmIntrinsics::ID id, char* buf,
default: break;
}
const char* kptr = strrchr(kname, JVM_SIGNATURE_SLASH);
if (kptr != NULL) kname = kptr + 1;
if (kptr != nullptr) kname = kptr + 1;
int len = jio_snprintf(buf, buflen, "%s: %s%s.%s%s",
str, fname, kname, mname, sname);
if (len < buflen)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, 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
@ -37,7 +37,7 @@
#include "utilities/xmlstream.hpp"
Symbol* vmSymbols::_type_signatures[T_VOID+1] = { NULL /*, NULL...*/ };
Symbol* vmSymbols::_type_signatures[T_VOID+1] = { nullptr /*, nullptr...*/ };
inline int compare_symbol(const Symbol* a, const Symbol* b) {
if (a == b) return 0;
@ -102,7 +102,7 @@ void vmSymbols::initialize() {
#ifdef ASSERT
for (int i = (int)T_BOOLEAN; i < (int)T_VOID+1; i++) {
Symbol* s = _type_signatures[i];
if (s == NULL) continue;
if (s == nullptr) continue;
SignatureStream ss(s, false);
assert(ss.type() == i, "matching signature");
assert(!ss.is_reference(), "no single-char signature for T_OBJECT, etc.");
@ -140,7 +140,7 @@ void vmSymbols::initialize() {
#ifdef ASSERT
{
// Spot-check correspondence between strings, symbols, and enums:
assert(Symbol::_vm_symbols[NO_SID] == NULL, "must be");
assert(Symbol::_vm_symbols[NO_SID] == nullptr, "must be");
const char* str = "java/lang/Object";
TempNewSymbol jlo = SymbolTable::new_permanent_symbol(str);
assert(strncmp(str, (char*)jlo->base(), jlo->utf8_length()) == 0, "");
@ -293,6 +293,6 @@ vmSymbolID vmSymbols::find_sid(const Symbol* symbol) {
vmSymbolID vmSymbols::find_sid(const char* symbol_name) {
Symbol* symbol = SymbolTable::probe(symbol_name, (int) strlen(symbol_name));
if (symbol == NULL) return vmSymbolID::NO_SID;
if (symbol == nullptr) return vmSymbolID::NO_SID;
return find_sid(symbol);
}

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
@ -869,7 +869,7 @@ class vmSymbols: AllStatic {
static Symbol* type_signature(BasicType t) {
assert((uint)t < T_VOID+1, "range check");
assert(_type_signatures[t] != NULL, "domain check");
assert(_type_signatures[t] != nullptr, "domain check");
return _type_signatures[t];
}