8318484: Initial version of cdsConfig.hpp

Reviewed-by: dholmes, ccheung, sspitsyn
This commit is contained in:
Ioi Lam 2023-10-21 15:43:36 +00:00
parent a876beb63d
commit ecd25e7d6f
36 changed files with 220 additions and 111 deletions

@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "cds/archiveHeapWriter.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/filemap.hpp"
#include "cds/heapShared.hpp"
#include "classfile/systemDictionary.hpp"
@ -138,7 +139,7 @@ oop ArchiveHeapWriter::requested_obj_from_buffer_offset(size_t offset) {
}
oop ArchiveHeapWriter::source_obj_to_requested_obj(oop src_obj) {
assert(DumpSharedSpaces, "dump-time only");
assert(CDSConfig::is_dumping_heap(), "dump-time only");
HeapShared::CachedOopInfo* p = HeapShared::archived_object_cache()->get(src_obj);
if (p != nullptr) {
return requested_obj_from_buffer_offset(p->buffer_offset());

@ -26,6 +26,7 @@
#include "cds/archiveBuilder.hpp"
#include "cds/archiveHeapLoader.inline.hpp"
#include "cds/archiveUtils.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/classListParser.hpp"
#include "cds/classListWriter.hpp"
#include "cds/dynamicArchive.hpp"
@ -173,7 +174,7 @@ char* DumpRegion::expand_top_to(char* newtop) {
}
void DumpRegion::commit_to(char* newtop) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
char* base = _rs->base();
size_t need_committed_size = newtop - base;
size_t has_committed_size = _vs->committed_size();

@ -0,0 +1,46 @@
/*
* Copyright (c) 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/heapShared.hpp"
bool CDSConfig::is_dumping_archive() {
return is_dumping_static_archive() || is_dumping_dynamic_archive();
}
bool CDSConfig::is_dumping_static_archive() {
return DumpSharedSpaces;
}
bool CDSConfig::is_dumping_dynamic_archive() {
return DynamicDumpSharedSpaces;
}
#if INCLUDE_CDS_JAVA_HEAP
bool CDSConfig::is_dumping_heap() {
// heap dump is not supported in dynamic dump
return is_dumping_static_archive() && HeapShared::can_write();
}
#endif // INCLUDE_CDS_JAVA_HEAP

@ -0,0 +1,42 @@
/*
* Copyright (c) 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_CDS_CDSCONFIG_HPP
#define SHARE_CDS_CDSCONFIG_HPP
#include "memory/allStatic.hpp"
#include "utilities/macros.hpp"
class CDSConfig : public AllStatic {
public:
// Basic CDS features
static bool is_dumping_archive() NOT_CDS_RETURN_(false);
static bool is_dumping_static_archive() NOT_CDS_RETURN_(false);
static bool is_dumping_dynamic_archive() NOT_CDS_RETURN_(false);
// CDS archived heap
static bool is_dumping_heap() NOT_CDS_JAVA_HEAP_RETURN_(false);
};
#endif // SHARE_CDS_CDSCONFIG_HPP

@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "cds/archiveUtils.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/cppVtables.hpp"
#include "cds/metaspaceShared.hpp"
#include "logging/log.hpp"
@ -240,7 +241,7 @@ intptr_t* CppVtables::get_archived_vtable(MetaspaceObj::Type msotype, address ob
_orig_cpp_vtptrs_inited = true;
}
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
int kind = -1;
switch (msotype) {
case MetaspaceObj::SymbolType:

@ -28,6 +28,7 @@
#include "cds/archiveHeapWriter.hpp"
#include "cds/archiveUtils.inline.hpp"
#include "cds/cds_globals.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/dynamicArchive.hpp"
#include "cds/filemap.hpp"
#include "cds/heapShared.hpp"
@ -203,7 +204,7 @@ void FileMapHeader::populate(FileMapInfo *info, size_t core_region_alignment,
_core_region_alignment = core_region_alignment;
_obj_alignment = ObjectAlignmentInBytes;
_compact_strings = CompactStrings;
if (DumpSharedSpaces && HeapShared::can_write()) {
if (CDSConfig::is_dumping_heap()) {
_narrow_oop_mode = CompressedOops::mode();
_narrow_oop_base = CompressedOops::base();
_narrow_oop_shift = CompressedOops::shift();
@ -302,7 +303,7 @@ void SharedClassPathEntry::init_as_non_existent(const char* path, TRAPS) {
void SharedClassPathEntry::init(bool is_modules_image,
bool is_module_path,
ClassPathEntry* cpe, TRAPS) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
_timestamp = 0;
_filesize = 0;
_from_class_path_attr = false;
@ -462,7 +463,7 @@ void SharedPathTable::dumptime_init(ClassLoaderData* loader_data, TRAPS) {
}
void FileMapInfo::allocate_shared_path_table(TRAPS) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
ClassPathEntry* jrt = ClassLoader::get_jrt_entry();
@ -509,7 +510,7 @@ int FileMapInfo::add_shared_classpaths(int i, const char* which, ClassPathEntry
}
void FileMapInfo::check_nonempty_dir_in_shared_path_table() {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
bool has_nonempty_dir = false;
@ -536,7 +537,7 @@ void FileMapInfo::check_nonempty_dir_in_shared_path_table() {
}
void FileMapInfo::record_non_existent_class_path_entry(const char* path) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
log_info(class, path)("non-existent Class-Path entry %s", path);
if (_non_existent_class_paths == nullptr) {
_non_existent_class_paths = new (mtClass) GrowableArray<const char*>(10, mtClass);
@ -545,7 +546,7 @@ void FileMapInfo::record_non_existent_class_path_entry(const char* path) {
}
int FileMapInfo::num_non_existent_class_paths() {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
if (_non_existent_class_paths != nullptr) {
return _non_existent_class_paths->length();
} else {
@ -686,7 +687,7 @@ bool FileMapInfo::check_paths_existence(const char* paths) {
}
GrowableArray<const char*>* FileMapInfo::create_dumptime_app_classpath_array() {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
GrowableArray<const char*>* path_array = new GrowableArray<const char*>(10);
ClassPathEntry* cpe = ClassLoader::app_classpath_entries();
while (cpe != nullptr) {
@ -1508,7 +1509,7 @@ void FileMapRegion::print(outputStream* st, int region_index) {
void FileMapInfo::write_region(int region, char* base, size_t size,
bool read_only, bool allow_exec) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
FileMapRegion* r = region_at(region);
char* requested_base;

@ -27,6 +27,7 @@
#include "cds/archiveHeapLoader.hpp"
#include "cds/archiveHeapWriter.hpp"
#include "cds/archiveUtils.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/cdsHeapVerifier.hpp"
#include "cds/heapShared.hpp"
#include "cds/metaspaceShared.hpp"
@ -179,7 +180,7 @@ static void reset_states(oop obj, TRAPS) {
}
void HeapShared::reset_archived_object_states(TRAPS) {
assert(DumpSharedSpaces, "dump-time only");
assert(CDSConfig::is_dumping_heap(), "dump-time only");
log_debug(cds)("Resetting platform loader");
reset_states(SystemDictionary::java_platform_loader(), CHECK);
log_debug(cds)("Resetting system loader");
@ -206,12 +207,12 @@ void HeapShared::reset_archived_object_states(TRAPS) {
HeapShared::ArchivedObjectCache* HeapShared::_archived_object_cache = nullptr;
bool HeapShared::has_been_archived(oop obj) {
assert(DumpSharedSpaces, "dump-time only");
assert(CDSConfig::is_dumping_heap(), "dump-time only");
return archived_object_cache()->get(obj) != nullptr;
}
int HeapShared::append_root(oop obj) {
assert(DumpSharedSpaces, "dump-time only");
assert(CDSConfig::is_dumping_heap(), "dump-time only");
// No GC should happen since we aren't scanning _pending_roots.
assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread");
@ -224,7 +225,7 @@ int HeapShared::append_root(oop obj) {
}
objArrayOop HeapShared::roots() {
if (DumpSharedSpaces) {
if (CDSConfig::is_dumping_heap()) {
assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread");
if (!HeapShared::can_write()) {
return nullptr;
@ -241,7 +242,7 @@ objArrayOop HeapShared::roots() {
// Returns an objArray that contains all the roots of the archived objects
oop HeapShared::get_root(int index, bool clear) {
assert(index >= 0, "sanity");
assert(!DumpSharedSpaces && UseSharedSpaces, "runtime only");
assert(!CDSConfig::is_dumping_heap() && UseSharedSpaces, "runtime only");
assert(!_roots.is_empty(), "must have loaded shared heap");
oop result = roots()->obj_at(index);
if (clear) {
@ -263,7 +264,7 @@ void HeapShared::clear_root(int index) {
}
bool HeapShared::archive_object(oop obj) {
assert(DumpSharedSpaces, "dump-time only");
assert(CDSConfig::is_dumping_heap(), "dump-time only");
assert(!obj->is_stackChunk(), "do not archive stack chunks");
if (has_been_archived(obj)) {
@ -599,7 +600,7 @@ HeapShared::RunTimeKlassSubGraphInfoTable HeapShared::_run_time_subgraph_info_
// there is no existing one for k. The subgraph_info records the "buffered"
// address of the class.
KlassSubGraphInfo* HeapShared::init_subgraph_info(Klass* k, bool is_full_module_graph) {
assert(DumpSharedSpaces, "dump time only");
assert(CDSConfig::is_dumping_heap(), "dump time only");
bool created;
Klass* buffered_k = ArchiveBuilder::get_buffered_klass(k);
KlassSubGraphInfo* info =
@ -610,7 +611,7 @@ KlassSubGraphInfo* HeapShared::init_subgraph_info(Klass* k, bool is_full_module_
}
KlassSubGraphInfo* HeapShared::get_subgraph_info(Klass* k) {
assert(DumpSharedSpaces, "dump time only");
assert(CDSConfig::is_dumping_heap(), "dump time only");
KlassSubGraphInfo* info = _dump_time_subgraph_info_table->get(k);
assert(info != nullptr, "must have been initialized");
return info;
@ -618,7 +619,7 @@ KlassSubGraphInfo* HeapShared::get_subgraph_info(Klass* k) {
// Add an entry field to the current KlassSubGraphInfo.
void KlassSubGraphInfo::add_subgraph_entry_field(int static_field_offset, oop v) {
assert(DumpSharedSpaces, "dump time only");
assert(CDSConfig::is_dumping_heap(), "dump time only");
if (_subgraph_entry_fields == nullptr) {
_subgraph_entry_fields =
new (mtClass) GrowableArray<int>(10, mtClass);
@ -630,7 +631,7 @@ void KlassSubGraphInfo::add_subgraph_entry_field(int static_field_offset, oop v)
// Add the Klass* for an object in the current KlassSubGraphInfo's subgraphs.
// Only objects of boot classes can be included in sub-graph.
void KlassSubGraphInfo::add_subgraph_object_klass(Klass* orig_k) {
assert(DumpSharedSpaces, "dump time only");
assert(CDSConfig::is_dumping_heap(), "dump time only");
Klass* buffered_k = ArchiveBuilder::get_buffered_klass(orig_k);
if (_subgraph_object_klasses == nullptr) {
@ -946,7 +947,7 @@ void HeapShared::initialize_from_archived_subgraph(JavaThread* current, Klass* k
const ArchivedKlassSubGraphInfoRecord*
HeapShared::resolve_or_init_classes_for_subgraph_of(Klass* k, bool do_init, TRAPS) {
assert(!DumpSharedSpaces, "Should not be called with DumpSharedSpaces");
assert(!CDSConfig::is_dumping_heap(), "Should not be called when dumping heap");
if (!k->is_shared()) {
return nullptr;
@ -1243,7 +1244,7 @@ void HeapShared::archive_reachable_objects_from_static_field(InstanceKlass *k,
const char* klass_name,
int field_offset,
const char* field_name) {
assert(DumpSharedSpaces, "dump time only");
assert(CDSConfig::is_dumping_heap(), "dump time only");
assert(k->is_shared_boot_class(), "must be boot class");
oop m = k->java_mirror();
@ -1294,7 +1295,7 @@ class VerifySharedOopClosure: public BasicOopIterateClosure {
};
void HeapShared::verify_subgraph_from_static_field(InstanceKlass* k, int field_offset) {
assert(DumpSharedSpaces, "dump time only");
assert(CDSConfig::is_dumping_heap(), "dump time only");
assert(k->is_shared_boot_class(), "must be boot class");
oop m = k->java_mirror();

@ -27,6 +27,7 @@
#include "cds/archiveHeapLoader.hpp"
#include "cds/archiveHeapWriter.hpp"
#include "cds/cds_globals.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/cdsProtectionDomain.hpp"
#include "cds/classListWriter.hpp"
#include "cds/classListParser.hpp"
@ -640,7 +641,7 @@ void MetaspaceShared::link_shared_classes(bool jcmd_request, TRAPS) {
}
void MetaspaceShared::prepare_for_dumping() {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
Arguments::check_unsupported_dumping_properties();
ClassLoader::initialize_shared_path(JavaThread::current());
@ -667,7 +668,7 @@ void MetaspaceShared::preload_and_dump() {
#if INCLUDE_CDS_JAVA_HEAP && defined(_LP64)
void MetaspaceShared::adjust_heap_sizes_for_dumping() {
if (!DumpSharedSpaces || UseCompressedOops) {
if (!CDSConfig::is_dumping_heap() || UseCompressedOops) {
return;
}
// CDS heap dumping requires all string oops to have an offset
@ -774,10 +775,12 @@ void MetaspaceShared::preload_and_dump_impl(TRAPS) {
log_info(cds)("Rewriting and linking classes: done");
#if INCLUDE_CDS_JAVA_HEAP
StringTable::allocate_shared_strings_array(CHECK);
ArchiveHeapWriter::init();
if (use_full_module_graph()) {
HeapShared::reset_archived_object_states(CHECK);
if (CDSConfig::is_dumping_heap()) {
StringTable::allocate_shared_strings_array(CHECK);
ArchiveHeapWriter::init();
if (use_full_module_graph()) {
HeapShared::reset_archived_object_states(CHECK);
}
}
#endif
@ -789,7 +792,7 @@ void MetaspaceShared::preload_and_dump_impl(TRAPS) {
bool MetaspaceShared::try_link_class(JavaThread* current, InstanceKlass* ik) {
ExceptionMark em(current);
JavaThread* THREAD = current; // For exception macros.
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
if (!ik->is_shared() && ik->is_loaded() && !ik->is_linked() && ik->can_be_verified_at_dumptime() &&
!SystemDictionaryShared::has_class_failed_verification(ik)) {
bool saved = BytecodeVerificationLocal;

@ -22,6 +22,7 @@
*
*/
#include "precompiled.hpp"
#include "cds/cdsConfig.hpp"
#include "classfile/classFileParser.hpp"
#include "classfile/classFileStream.hpp"
#include "classfile/classLoader.hpp"
@ -2852,7 +2853,7 @@ static const intArray* sort_methods(Array<Method*>* methods) {
// We temporarily use the vtable_index field in the Method* to store the
// class file index, so we can read in after calling qsort.
// Put the method ordering in the shared archive.
if (JvmtiExport::can_maintain_original_method_order() || Arguments::is_dumping_archive()) {
if (JvmtiExport::can_maintain_original_method_order() || CDSConfig::is_dumping_archive()) {
for (int index = 0; index < length; index++) {
Method* const m = methods->at(index);
assert(!m->valid_vtable_index(), "vtable index should not be set");
@ -2866,7 +2867,7 @@ static const intArray* sort_methods(Array<Method*>* methods) {
intArray* method_ordering = nullptr;
// If JVMTI original method ordering or sharing is enabled construct int
// array remembering the original ordering
if (JvmtiExport::can_maintain_original_method_order() || Arguments::is_dumping_archive()) {
if (JvmtiExport::can_maintain_original_method_order() || CDSConfig::is_dumping_archive()) {
method_ordering = new intArray(length, length, -1);
for (int index = 0; index < length; index++) {
Method* const m = methods->at(index);

@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "cds/cds_globals.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/filemap.hpp"
#include "classfile/classFileStream.hpp"
#include "classfile/classLoader.inline.hpp"
@ -446,7 +447,7 @@ bool ClassPathImageEntry::is_modules_image() const {
#if INCLUDE_CDS
void ClassLoader::exit_with_path_failure(const char* error, const char* message) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
tty->print_cr("Hint: enable -Xlog:class+path=info to diagnose the failure");
vm_exit_during_initialization(error, message);
}
@ -516,7 +517,7 @@ void ClassLoader::setup_bootstrap_search_path(JavaThread* current) {
#if INCLUDE_CDS
void ClassLoader::setup_app_search_path(JavaThread* current, const char *class_path) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
ResourceMark rm(current);
ClasspathStream cp_stream(class_path);
@ -531,7 +532,7 @@ 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 != nullptr, "ClassPathEntry should not be nullptr");
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
// The entry does not exist, add to the list
if (_module_path_entries == nullptr) {
@ -545,7 +546,7 @@ void ClassLoader::add_to_module_path_entries(const char* path,
// Add a module path to the _module_path_entries list.
void ClassLoader::setup_module_search_path(JavaThread* current, const char* path) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
struct stat st;
if (os::stat(path, &st) != 0) {
tty->print_cr("os::stat error %d (%s). CDS dump aborted (path was \"%s\").",
@ -633,7 +634,7 @@ void ClassLoader::setup_bootstrap_search_path_impl(JavaThread* current, const ch
bool set_base_piece = true;
#if INCLUDE_CDS
if (Arguments::is_dumping_archive()) {
if (CDSConfig::is_dumping_archive()) {
if (!Arguments::has_jimage()) {
vm_exit_during_initialization("CDS is not supported in exploded JDK build", nullptr);
}
@ -1249,7 +1250,7 @@ char* ClassLoader::skip_uri_protocol(char* source) {
// by the builtin loaders at dump time.
void ClassLoader::record_result(JavaThread* current, InstanceKlass* ik,
const ClassFileStream* stream, bool redefined) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
assert(stream != nullptr, "sanity");
if (ik->is_hidden()) {
@ -1443,13 +1444,13 @@ bool ClassLoader::is_module_observable(const char* module_name) {
#if INCLUDE_CDS
void ClassLoader::initialize_shared_path(JavaThread* current) {
if (Arguments::is_dumping_archive()) {
if (CDSConfig::is_dumping_archive()) {
ClassLoaderExt::setup_search_paths(current);
}
}
void ClassLoader::initialize_module_path(TRAPS) {
if (Arguments::is_dumping_archive()) {
if (CDSConfig::is_dumping_archive()) {
ClassLoaderExt::setup_module_paths(THREAD);
FileMapInfo::allocate_shared_path_table(CHECK);
}
@ -1458,7 +1459,7 @@ void ClassLoader::initialize_module_path(TRAPS) {
// Helper function used by CDS code to get the number of module path
// entries during shared classpath setup time.
int ClassLoader::num_module_path_entries() {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
int num_entries = 0;
ClassPathEntry* e= ClassLoader::_module_path_entries;
while (e != nullptr) {

@ -27,8 +27,8 @@
#include "classfile/classLoader.hpp"
#include "cds/cdsConfig.hpp"
#include "runtime/atomic.hpp"
#include "runtime/arguments.hpp"
// Next entry in class path
inline ClassPathEntry* ClassPathEntry::next() const { return Atomic::load_acquire(&_next); }
@ -70,7 +70,7 @@ inline void ClassLoader::load_zip_library_if_needed() {
// entries during shared classpath setup time.
inline int ClassLoader::num_boot_classpath_entries() {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
assert(has_jrt_entry(), "must have a java runtime image");
int num_entries = 1; // count the runtime image
ClassPathEntry* e = first_append_entry();
@ -92,7 +92,7 @@ inline ClassPathEntry* ClassLoader::get_next_boot_classpath_entry(ClassPathEntry
// Helper function used by CDS code to get the number of app classpath
// entries during shared classpath setup time.
inline int ClassLoader::num_app_classpath_entries() {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
int num_entries = 0;
ClassPathEntry* e= ClassLoader::_app_classpath_entries;
while (e != nullptr) {

@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "cds/cds_globals.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/dynamicArchive.hpp"
#include "cds/filemap.hpp"
#include "cds/heapShared.hpp"
@ -70,7 +71,7 @@ void ClassLoaderExt::append_boot_classpath(ClassPathEntry* new_entry) {
}
void ClassLoaderExt::setup_app_search_path(JavaThread* current) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
int start_index = ClassLoader::num_boot_classpath_entries();
_app_class_paths_start_index = checked_cast<jshort>(start_index);
char* app_class_path = os::strdup_check_oom(Arguments::get_appclasspath(), mtClass);
@ -121,7 +122,7 @@ void ClassLoaderExt::process_module_table(JavaThread* current, ModuleEntryTable*
}
void ClassLoaderExt::setup_module_paths(JavaThread* current) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
int start_index = ClassLoader::num_boot_classpath_entries() +
ClassLoader::num_app_classpath_entries();
_app_module_paths_start_index = checked_cast<jshort>(start_index);
@ -257,7 +258,7 @@ void ClassLoaderExt::setup_search_paths(JavaThread* current) {
}
void ClassLoaderExt::record_result(const s2 classpath_index, InstanceKlass* result, bool redefined) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
// We need to remember where the class comes from during dumping.
oop loader = result->class_loader();

@ -25,13 +25,14 @@
#include "precompiled.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/cds_globals.hpp"
#include "cds/cdsConfig.hpp"
#include "classfile/compactHashtable.hpp"
#include "classfile/javaClasses.hpp"
#include "jvm.h"
#include "logging/logMessage.hpp"
#include "memory/metadataFactory.hpp"
#include "runtime/arguments.hpp"
#include "runtime/globals.hpp"
#include "runtime/java.hpp"
#include "runtime/vmThread.hpp"
#include "utilities/numberSeq.hpp"
@ -44,7 +45,7 @@
//
CompactHashtableWriter::CompactHashtableWriter(int num_entries,
CompactHashtableStats* stats) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
assert(num_entries >= 0, "sanity");
_num_buckets = calculate_num_buckets(num_entries);
assert(_num_buckets > 0, "no buckets");

@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "cds/cdsConfig.hpp"
#include "classfile/bytecodeAssembler.hpp"
#include "classfile/defaultMethods.hpp"
#include "classfile/symbolTable.hpp"
@ -36,7 +37,6 @@
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/arguments.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/javaThread.hpp"
#include "runtime/signature.hpp"
@ -1069,7 +1069,7 @@ static void merge_in_new_methods(InstanceKlass* klass,
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()) {
if (JvmtiExport::can_maintain_original_method_order() || CDSConfig::is_dumping_archive()) {
merged_ordering = MetadataFactory::new_array<int>(
klass->class_loader_data(), new_size, CHECK);
}

@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "cds/cdsConfig.hpp"
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/dictionary.hpp"
#include "classfile/javaClasses.hpp"
@ -39,7 +40,6 @@
#include "oops/method.hpp"
#include "oops/oop.inline.hpp"
#include "oops/oopHandle.inline.hpp"
#include "runtime/arguments.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/javaCalls.hpp"
#include "runtime/mutexLocker.hpp"
@ -211,7 +211,7 @@ void Dictionary::all_entries_do(KlassClosure* closure) {
// Used to scan and relocate the classes during CDS archive dump.
void Dictionary::classes_do(MetaspaceClosure* it) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
auto push = [&] (DictionaryEntry** value) {
InstanceKlass** k = (*value)->instance_klass_addr();

@ -25,6 +25,7 @@
#include "precompiled.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/archiveHeapLoader.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/heapShared.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/altHashing.hpp"
@ -1064,7 +1065,7 @@ void java_lang_Class::create_mirror(Klass* k, Handle class_loader,
// concurrently doesn't expect a k to have a null java_mirror.
release_set_array_klass(comp_mirror(), k);
}
if (DumpSharedSpaces) {
if (CDSConfig::is_dumping_heap()) {
create_scratch_mirror(k, CHECK);
}
} else {
@ -1366,7 +1367,7 @@ BasicType java_lang_Class::primitive_type(oop java_class) {
assert(java_class == Universe::void_mirror(), "only valid non-array primitive");
}
#ifdef ASSERT
if (DumpSharedSpaces) {
if (CDSConfig::is_dumping_heap()) {
oop mirror = Universe::java_mirror(type);
oop scratch_mirror = HeapShared::scratch_java_mirror(type);
assert(java_class == mirror || java_class == scratch_mirror, "must be consistent");

@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/filemap.hpp"
#include "classfile/classFileParser.hpp"
#include "classfile/classFileStream.hpp"
@ -34,7 +35,6 @@
#include "memory/resourceArea.hpp"
#include "prims/jvmtiEnvBase.hpp"
#include "prims/jvmtiRedefineClasses.hpp"
#include "runtime/arguments.hpp"
#include "runtime/handles.inline.hpp"
#include "utilities/macros.hpp"
#if INCLUDE_JFR
@ -212,7 +212,7 @@ InstanceKlass* KlassFactory::create_from_stream(ClassFileStream* stream,
JFR_ONLY(ON_KLASS_CREATION(result, parser, THREAD);)
#if INCLUDE_CDS
if (Arguments::is_dumping_archive()) {
if (CDSConfig::is_dumping_archive()) {
ClassLoader::record_result(THREAD, result, stream, old_stream != stream);
}
#endif // INCLUDE_CDS

@ -26,6 +26,7 @@
#include "cds/archiveBuilder.hpp"
#include "cds/archiveHeapLoader.inline.hpp"
#include "cds/archiveHeapWriter.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/filemap.hpp"
#include "cds/heapShared.hpp"
#include "classfile/altHashing.hpp"
@ -805,7 +806,7 @@ oop StringTable::lookup_shared(const jchar* name, int len) {
// This should be called when we know no more strings will be added (which will be easy
// to guarantee because CDS runs with a single Java thread. See JDK-8253495.)
void StringTable::allocate_shared_strings_array(TRAPS) {
assert(DumpSharedSpaces, "must be");
assert(CDSConfig::is_dumping_heap(), "must be");
if (_items_count > (size_t)max_jint) {
fatal("Too many strings to be archived: %zu", _items_count);
}

@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/heapShared.hpp"
#include "classfile/classFileParser.hpp"
#include "classfile/classFileStream.hpp"
@ -1782,7 +1783,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 != nullptr &&
if (CDSConfig::is_dumping_archive() && klass_being_linked != nullptr &&
!klass_being_linked->is_shared()) {
SystemDictionaryShared::record_linking_constraint(constraint_name,
InstanceKlass::cast(klass_being_linked),

@ -26,6 +26,7 @@
#include "cds/archiveBuilder.hpp"
#include "cds/archiveHeapLoader.hpp"
#include "cds/archiveUtils.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/classListParser.hpp"
#include "cds/classListWriter.hpp"
#include "cds/dynamicArchive.hpp"
@ -196,7 +197,7 @@ bool SystemDictionaryShared::check_for_exclusion(InstanceKlass* k, DumpTimeClass
if (MetaspaceShared::is_in_shared_metaspace(k)) {
// We have reached a super type that's already in the base archive. Treat it
// as "not excluded".
assert(DynamicDumpSharedSpaces, "must be");
assert(CDSConfig::is_dumping_dynamic_archive(), "must be");
return false;
}
@ -435,7 +436,7 @@ bool SystemDictionaryShared::add_unregistered_class(Thread* current, InstanceKla
// We don't allow duplicated unregistered classes with the same name.
// We only archive the first class with that name that succeeds putting
// itself into the table.
assert(Arguments::is_dumping_archive() || ClassListWriter::is_enabled(), "sanity");
assert(CDSConfig::is_dumping_archive() || ClassListWriter::is_enabled(), "sanity");
MutexLocker ml(current, UnregisteredClassesTable_lock, Mutex::_no_safepoint_check_flag);
Symbol* name = klass->name();
if (_unregistered_classes_table == nullptr) {
@ -489,7 +490,7 @@ InstanceKlass* SystemDictionaryShared::lookup_super_for_unregistered_class(
}
void SystemDictionaryShared::set_shared_class_misc_info(InstanceKlass* k, ClassFileStream* cfs) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
assert(!is_builtin(k), "must be unregistered class");
DumpTimeClassInfo* info = get_info(k);
info->_clsfile_size = cfs->length();
@ -497,7 +498,7 @@ void SystemDictionaryShared::set_shared_class_misc_info(InstanceKlass* k, ClassF
}
void SystemDictionaryShared::initialize() {
if (Arguments::is_dumping_archive()) {
if (CDSConfig::is_dumping_archive()) {
_dumptime_table = new (mtClass) DumpTimeSharedClassTable;
_dumptime_lambda_proxy_class_dictionary =
new (mtClass) DumpTimeLambdaProxyClassDictionary;
@ -516,11 +517,11 @@ void SystemDictionaryShared::remove_dumptime_info(InstanceKlass* k) {
}
void SystemDictionaryShared::handle_class_unloading(InstanceKlass* klass) {
if (Arguments::is_dumping_archive()) {
if (CDSConfig::is_dumping_archive()) {
remove_dumptime_info(klass);
}
if (Arguments::is_dumping_archive() || ClassListWriter::is_enabled()) {
if (CDSConfig::is_dumping_archive() || ClassListWriter::is_enabled()) {
MutexLocker ml(Thread::current(), UnregisteredClassesTable_lock, Mutex::_no_safepoint_check_flag);
if (_unregistered_classes_table != nullptr) {
// Remove the class from _unregistered_classes_table: keep the entry but
@ -625,7 +626,7 @@ void SystemDictionaryShared::check_excluded_classes() {
assert(!class_loading_may_happen(), "class loading must be disabled");
assert_lock_strong(DumpTimeTable_lock);
if (DynamicDumpSharedSpaces) {
if (CDSConfig::is_dumping_dynamic_archive()) {
// Do this first -- if a base class is excluded due to duplication,
// all of its subclasses will also be excluded.
ResourceMark rm;
@ -646,32 +647,32 @@ void SystemDictionaryShared::check_excluded_classes() {
bool SystemDictionaryShared::is_excluded_class(InstanceKlass* k) {
assert(!class_loading_may_happen(), "class loading must be disabled");
assert_lock_strong(DumpTimeTable_lock);
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
DumpTimeClassInfo* p = get_info_locked(k);
return p->is_excluded();
}
void SystemDictionaryShared::set_excluded_locked(InstanceKlass* k) {
assert_lock_strong(DumpTimeTable_lock);
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
DumpTimeClassInfo* info = get_info_locked(k);
info->set_excluded();
}
void SystemDictionaryShared::set_excluded(InstanceKlass* k) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
DumpTimeClassInfo* info = get_info(k);
info->set_excluded();
}
void SystemDictionaryShared::set_class_has_failed_verification(InstanceKlass* ik) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
DumpTimeClassInfo* p = get_info(ik);
p->set_failed_verification();
}
bool SystemDictionaryShared::has_class_failed_verification(InstanceKlass* ik) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
DumpTimeClassInfo* p = _dumptime_table->get(ik);
return (p == nullptr) ? false : p->failed_verification();
}
@ -697,12 +698,12 @@ void SystemDictionaryShared::dumptime_classes_do(class MetaspaceClosure* it) {
bool SystemDictionaryShared::add_verification_constraint(InstanceKlass* k, Symbol* name,
Symbol* from_name, bool from_field_is_protected, bool from_is_array, bool from_is_object) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
DumpTimeClassInfo* info = get_info(k);
info->add_verification_constraint(k, name, from_name, from_field_is_protected,
from_is_array, from_is_object);
if (DynamicDumpSharedSpaces) {
if (CDSConfig::is_dumping_dynamic_archive()) {
// For dynamic dumping, we can resolve all the constraint classes for all class loaders during
// the initial run prior to creating the archive before vm exit. We will also perform verification
// check when running with the archive.
@ -993,7 +994,7 @@ void SystemDictionaryShared::record_linking_constraint(Symbol* name, InstanceKla
}
assert(!Thread::current()->is_VM_thread(), "must be");
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
DumpTimeClassInfo* info = get_info(klass);
info->record_linking_constraint(name, loader1, loader2);
}

@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "cds/cdsConfig.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "classfile/systemDictionaryShared.hpp"
@ -32,7 +33,6 @@
#include "classfile/vmSymbols.hpp"
#include "logging/log.hpp"
#include "oops/klass.inline.hpp"
#include "runtime/arguments.hpp"
#include "runtime/handles.inline.hpp"
VerificationType VerificationType::from_tag(u1 tag) {
@ -109,7 +109,7 @@ bool VerificationType::is_reference_assignable_from(
return true;
}
if (Arguments::is_dumping_archive()) {
if (CDSConfig::is_dumping_archive()) {
if (SystemDictionaryShared::add_verification_constraint(klass,
name(), from.name(), from_field_is_protected, from.is_array(),
from.is_object())) {

@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "cds/cdsConfig.hpp"
#include "classfile/classLoaderData.hpp"
#include "classfile/vmClasses.hpp"
#include "gc/shared/allocTracer.hpp"
@ -455,7 +456,7 @@ CollectedHeap::fill_with_array(HeapWord* start, size_t words, bool zap)
ObjArrayAllocator allocator(Universe::fillerArrayKlassObj(), words, (int)len, /* do_zero */ false);
allocator.initialize(start);
if (DumpSharedSpaces) {
if (CDSConfig::is_dumping_heap()) {
// This array is written into the CDS archive. Make sure it
// has deterministic contents.
zap_filler_array_with(start, words, 0);

@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/vmClasses.hpp"
#include "interpreter/bytecodes.hpp"
@ -35,7 +36,6 @@
#include "oops/resolvedFieldEntry.hpp"
#include "oops/resolvedIndyEntry.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/arguments.hpp"
#include "runtime/fieldDescriptor.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "utilities/checkedCast.hpp"
@ -118,7 +118,7 @@ void Rewriter::make_constant_pool_cache(TRAPS) {
_resolved_reference_limit,
THREAD);
#if INCLUDE_CDS
if (!HAS_PENDING_EXCEPTION && Arguments::is_dumping_archive()) {
if (!HAS_PENDING_EXCEPTION && CDSConfig::is_dumping_archive()) {
if (_pool->pool_holder()->is_shared()) {
assert(DynamicDumpSharedSpaces, "must be");
// We are linking a shared class from the base archive. This

@ -23,6 +23,7 @@
*/
// no precompiled headers
#include "cds/cdsConfig.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/vmSymbols.hpp"
#include "gc/shared/collectedHeap.hpp"
@ -50,7 +51,6 @@
#include "oops/typeArrayOop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/jvmtiThreadState.hpp"
#include "runtime/arguments.hpp"
#include "runtime/atomic.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/handles.inline.hpp"
@ -2445,7 +2445,7 @@ run:
CHECK_NULL(STACK_OBJECT(-(cache->parameter_size())));
if (cache->is_vfinal()) {
callee = cache->f2_as_vfinal_method();
if (REWRITE_BYTECODES && !UseSharedSpaces && !Arguments::is_dumping_archive()) {
if (REWRITE_BYTECODES && !UseSharedSpaces && !CDSConfig::is_dumping_archive()) {
// Rewrite to _fast_invokevfinal.
REWRITE_AT_PC(Bytecodes::_fast_invokevfinal);
}

@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "cds/cdsConfig.hpp"
#include "classfile/javaClasses.hpp"
#include "jfr/dcmd/jfrDcmds.hpp"
#include "jfr/instrumentation/jfrJvmtiAgent.hpp"
@ -185,7 +186,7 @@ static void log_jdk_jfr_module_resolution_error(TRAPS) {
static bool is_cds_dump_requested() {
// we will not be able to launch recordings on startup if a cds dump is being requested
if (Arguments::is_dumping_archive() && JfrOptionSet::start_flight_recording_options() != nullptr) {
if (CDSConfig::is_dumping_archive() && JfrOptionSet::start_flight_recording_options() != nullptr) {
warning("JFR will be disabled during CDS dumping");
teardown_startup_support();
return true;
@ -227,7 +228,7 @@ bool JfrRecorder::on_create_vm_2() {
bool JfrRecorder::on_create_vm_3() {
assert(JvmtiEnvBase::get_phase() == JVMTI_PHASE_LIVE, "invalid init sequence");
return Arguments::is_dumping_archive() || launch_command_line_recordings(JavaThread::current());
return CDSConfig::is_dumping_archive() || launch_command_line_recordings(JavaThread::current());
}
static bool _created = false;

@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "cds/archiveHeapLoader.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/dynamicArchive.hpp"
#include "cds/heapShared.hpp"
#include "cds/metaspaceShared.hpp"
@ -822,7 +823,7 @@ jint universe_init() {
// system dictionary, symbol table, etc.)
MetaspaceShared::initialize_shared_spaces();
}
if (Arguments::is_dumping_archive()) {
if (CDSConfig::is_dumping_archive()) {
MetaspaceShared::prepare_for_dumping();
}
#endif

@ -26,6 +26,7 @@
#include "cds/archiveHeapWriter.hpp"
#include "cds/archiveHeapLoader.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/classPrelinker.hpp"
#include "cds/heapShared.hpp"
#include "classfile/classLoaderData.hpp"
@ -219,7 +220,7 @@ void ConstantPool::initialize_resolved_references(ClassLoaderData* loader_data,
set_resolved_references(loader_data->add_handle(refs_handle));
// Create a "scratch" copy of the resolved references array to archive
if (DumpSharedSpaces) {
if (CDSConfig::is_dumping_heap()) {
objArrayOop scratch_references = oopFactory::new_objArray(vmClasses::Object_klass(), map_length, CHECK);
HeapShared::add_scratch_resolved_references(this, scratch_references);
}

@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/heapShared.hpp"
#include "classfile/resolutionErrors.hpp"
#include "classfile/systemDictionary.hpp"
@ -704,7 +705,7 @@ void ConstantPoolCache::save_for_archive(TRAPS) {
}
void ConstantPoolCache::remove_unshareable_info() {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
// <this> is the copy to be written into the archive. It's in the ArchiveBuilder's "buffer space".
// However, this->_initial_entries was not copied/relocated by the ArchiveBuilder, so it's
// still pointing to the array allocated inside save_for_archive().
@ -738,7 +739,7 @@ void ConstantPoolCache::deallocate_contents(ClassLoaderData* data) {
set_reference_map(nullptr);
#if INCLUDE_CDS
if (_initial_entries != nullptr) {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
MetadataFactory::free_array<ConstantPoolCacheEntry>(data, _initial_entries);
if (_resolved_indy_entries) {
MetadataFactory::free_array<ResolvedIndyEntry>(data, _resolved_indy_entries);

@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "cds/archiveUtils.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/classListWriter.hpp"
#include "cds/heapShared.hpp"
#include "cds/metaspaceShared.hpp"
@ -702,7 +703,7 @@ void InstanceKlass::deallocate_contents(ClassLoaderData* loader_data) {
SystemDictionaryShared::handle_class_unloading(this);
#if INCLUDE_CDS_JAVA_HEAP
if (DumpSharedSpaces) {
if (CDSConfig::is_dumping_heap()) {
HeapShared::remove_scratch_objects(this);
}
#endif
@ -4087,7 +4088,7 @@ void InstanceKlass::verify_on(outputStream* st) {
Array<int>* method_ordering = this->method_ordering();
int length = method_ordering->length();
if (JvmtiExport::can_maintain_original_method_order() ||
((UseSharedSpaces || Arguments::is_dumping_archive()) && length != 0)) {
((UseSharedSpaces || CDSConfig::is_dumping_archive()) && length != 0)) {
guarantee(length == methods()->length(), "invalid method ordering length");
jlong sum = 0;
for (int j = 0; j < length; j++) {

@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "cds/archiveHeapLoader.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/heapShared.hpp"
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/classLoaderDataGraph.inline.hpp"
@ -48,7 +49,6 @@
#include "oops/oop.inline.hpp"
#include "oops/oopHandle.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "runtime/arguments.hpp"
#include "runtime/atomic.hpp"
#include "runtime/handles.inline.hpp"
#include "utilities/macros.hpp"
@ -85,7 +85,7 @@ void Klass::set_name(Symbol* n) {
_name = n;
if (_name != nullptr) _name->increment_refcount();
if (Arguments::is_dumping_archive() && is_instance_klass()) {
if (CDSConfig::is_dumping_archive() && is_instance_klass()) {
SystemDictionaryShared::init_dumptime_info(InstanceKlass::cast(this));
}
}
@ -520,7 +520,7 @@ void Klass::metaspace_pointers_do(MetaspaceClosure* it) {
it->push(&_primary_supers[i]);
}
it->push(&_super);
if (!Arguments::is_dumping_archive()) {
if (!CDSConfig::is_dumping_archive()) {
// If dumping archive, these may point to excluded classes. There's no need
// to follow these pointers anyway, as they will be set to null in
// remove_unshareable_info().
@ -537,7 +537,7 @@ void Klass::metaspace_pointers_do(MetaspaceClosure* it) {
#if INCLUDE_CDS
void Klass::remove_unshareable_info() {
assert (Arguments::is_dumping_archive(),
assert(CDSConfig::is_dumping_archive(),
"only called during CDS dump time");
JFR_ONLY(REMOVE_ID(this);)
if (log_is_enabled(Trace, cds, unshareable)) {
@ -555,7 +555,7 @@ void Klass::remove_unshareable_info() {
}
void Klass::remove_java_mirror() {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
if (log_is_enabled(Trace, cds, unshareable)) {
ResourceMark rm;
log_trace(cds, unshareable)("remove java_mirror: %s", external_name());
@ -645,7 +645,7 @@ void Klass::clear_archived_mirror_index() {
// No GC barrier
void Klass::set_archived_java_mirror(int mirror_index) {
assert(DumpSharedSpaces, "called only during dumptime");
assert(CDSConfig::is_dumping_heap(), "sanity");
_archived_mirror_index = mirror_index;
}
#endif // INCLUDE_CDS_JAVA_HEAP

@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/cppVtables.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/classLoaderDataGraph.hpp"
@ -59,12 +60,12 @@
#include "oops/symbol.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/arguments.hpp"
#include "runtime/atomic.hpp"
#include "runtime/continuationEntry.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/init.hpp"
#include "runtime/java.hpp"
#include "runtime/orderAccess.hpp"
#include "runtime/relocator.hpp"
#include "runtime/safepointVerifiers.hpp"
@ -1166,7 +1167,7 @@ void Method::unlink_code() {
#if INCLUDE_CDS
// Called by class data sharing to remove any entry points (which are not shared)
void Method::unlink_method() {
Arguments::assert_is_dumping_archive();
assert(CDSConfig::is_dumping_archive(), "sanity");
_code = nullptr;
_adapter = nullptr;
_i2i_entry = nullptr;

@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "cds/cdsConfig.hpp"
#include "classfile/altHashing.hpp"
#include "classfile/javaClasses.inline.hpp"
#include "gc/shared/collectedHeap.inline.hpp"
@ -162,7 +163,7 @@ bool oopDesc::has_klass_gap() {
#if INCLUDE_CDS_JAVA_HEAP
void oopDesc::set_narrow_klass(narrowKlass nk) {
assert(DumpSharedSpaces, "Used by CDS only. Do not abuse!");
assert(CDSConfig::is_dumping_heap(), "Used by CDS only. Do not abuse!");
assert(UseCompressedClassPointers, "must be");
_metadata._compressed_klass = nk;
}

@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/classListParser.hpp"
#include "cds/classListWriter.hpp"
#include "cds/dynamicArchive.hpp"
@ -3606,7 +3607,7 @@ JVM_ENTRY(void, JVM_RegisterLambdaProxyClassForArchiving(JNIEnv* env,
jobject dynamicMethodType,
jclass lambdaProxyClass))
#if INCLUDE_CDS
if (!Arguments::is_dumping_archive()) {
if (!CDSConfig::is_dumping_archive()) {
return;
}
@ -3694,7 +3695,7 @@ JVM_ENTRY(jclass, JVM_LookupLambdaProxyClassFromArchive(JNIEnv* env,
JVM_END
JVM_LEAF(jboolean, JVM_IsCDSDumpingEnabled(JNIEnv* env))
return Arguments::is_dumping_archive();
return CDSConfig::is_dumping_archive();
JVM_END
JVM_LEAF(jboolean, JVM_IsSharingEnabled(JNIEnv* env))

@ -25,6 +25,7 @@
#include "prims/jvmtiAgent.hpp"
#include "cds/cds_globals.hpp"
#include "cds/cdsConfig.hpp"
#include "jni.h"
#include "jvm_io.h"
#include "jvmtifiles/jvmtiEnv.hpp"
@ -623,7 +624,7 @@ static bool invoke_Agent_OnAttach(JvmtiAgent* agent, outputStream* st) {
// CDS dumping supports Java agent if the AllowArchivingWithJavaAgent diagnostic option is specified.
static void check_cds_dump(JvmtiAgent* agent) {
assert(agent != nullptr, "invariant");
assert(Arguments::is_dumping_archive(), "invariant");
assert(CDSConfig::is_dumping_archive(), "invariant");
if (!agent->is_instrument_lib()) {
vm_exit_during_cds_dumping("CDS dumping does not support native JVMTI agent, name", agent->name());
}
@ -639,7 +640,7 @@ static bool invoke_Agent_OnLoad(JvmtiAgent* agent) {
assert(!agent->is_xrun(), "invariant");
assert(!agent->is_dynamic(), "invariant");
assert(JvmtiEnvBase::get_phase() == JVMTI_PHASE_ONLOAD, "invariant");
if (Arguments::is_dumping_archive()) {
if (CDSConfig::is_dumping_archive()) {
check_cds_dump(agent);
}
OnLoadEntry_t on_load_entry = lookup_Agent_OnLoad_entry_point(agent);

@ -24,6 +24,7 @@
#include "precompiled.hpp"
#include "cds/cds_globals.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/filemap.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/javaAssertions.hpp"
@ -1332,7 +1333,7 @@ const char* unsupported_options[] = { "--limit-modules",
"--patch-module"
};
void Arguments::check_unsupported_dumping_properties() {
assert(is_dumping_archive(),
assert(CDSConfig::is_dumping_archive(),
"this function is only used with CDS dump time");
assert(ARRAY_SIZE(unsupported_properties) == ARRAY_SIZE(unsupported_options), "must be");
// If a vm option is found in the unsupported_options array, vm will exit with an error message.
@ -3451,7 +3452,7 @@ void Arguments::init_shared_archive_paths() {
int archives = num_archives(SharedArchiveFile);
assert(archives > 0, "must be");
if (is_dumping_archive() && archives > 1) {
if (CDSConfig::is_dumping_archive() && archives > 1) {
vm_exit_during_initialization(
"Cannot have more than 1 archive file specified in -XX:SharedArchiveFile during CDS dumping");
}

@ -525,12 +525,6 @@ class Arguments : AllStatic {
static bool has_jfr_option() NOT_JFR_RETURN_(false);
static bool is_dumping_archive() { return DumpSharedSpaces || DynamicDumpSharedSpaces; }
static void assert_is_dumping_archive() {
assert(Arguments::is_dumping_archive(), "dump time only");
}
DEBUG_ONLY(static bool verify_special_jvm_flags(bool check_globals);)
};