8366475: Rename MetaspaceShared class to AOTMetaspace

Reviewed-by: kvn, asmehra
This commit is contained in:
Ioi Lam 2025-09-04 16:23:46 +00:00
parent 79a1a98cab
commit f90d520308
60 changed files with 332 additions and 332 deletions

View File

@ -23,8 +23,8 @@
*
*/
#include "cds/aotMetaspace.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/metaspaceShared.hpp"
#include "os_posix.hpp"
#include "runtime/javaThread.hpp"
#include "runtime/os.hpp"
@ -117,7 +117,7 @@ void VMError::check_failing_cds_access(outputStream* st, const void* siginfo) {
if (si->si_signo == SIGBUS || si->si_signo == SIGSEGV) {
const void* const fault_addr = si->si_addr;
if (fault_addr != nullptr) {
if (MetaspaceShared::in_aot_cache(fault_addr)) {
if (AOTMetaspace::in_aot_cache(fault_addr)) {
st->print("Error accessing class data sharing archive. "
"Mapped file inaccessible during execution, possible disk/network problem.");
}

View File

@ -22,8 +22,8 @@
*
*/
#include "cds/aotMetaspace.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/metaspaceShared.hpp"
#include "runtime/arguments.hpp"
#include "runtime/javaThread.hpp"
#include "runtime/os.hpp"
@ -51,7 +51,7 @@ void VMError::check_failing_cds_access(outputStream* st, const void* siginfo) {
er->NumberParameters >= 2) {
const void* const fault_addr = (const void*) er->ExceptionInformation[1];
if (fault_addr != nullptr) {
if (MetaspaceShared::in_aot_cache(fault_addr)) {
if (AOTMetaspace::in_aot_cache(fault_addr)) {
st->print("Error accessing class data sharing archive. "
"Mapped file inaccessible during execution, possible disk/network problem.");
}

View File

@ -24,7 +24,7 @@
*
*/
#include "cds/metaspaceShared.hpp"
#include "cds/aotMetaspace.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/javaThread.hpp"

View File

@ -23,11 +23,11 @@
*/
#include "cds/aotCacheAccess.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/filemap.hpp"
#include "cds/heapShared.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/stringTable.hpp"
#include "logging/log.hpp"
#include "logging/logStream.hpp"
@ -45,7 +45,7 @@ size_t AOTCacheAccess::get_aot_code_region_size() {
assert(CDSConfig::is_using_archive(), "must be");
FileMapInfo* mapinfo = FileMapInfo::current_info();
assert(mapinfo != nullptr, "must be");
return mapinfo->region_at(MetaspaceShared::ac)->used_aligned();
return mapinfo->region_at(AOTMetaspace::ac)->used_aligned();
}
bool AOTCacheAccess::map_aot_code_region(ReservedSpace rs) {

View File

@ -24,11 +24,11 @@
#include "cds/aotClassLocation.hpp"
#include "cds/aotLogging.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/dynamicArchive.hpp"
#include "cds/filemap.hpp"
#include "cds/metaspaceShared.hpp"
#include "cds/serializeClosure.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderData.hpp"
@ -246,7 +246,7 @@ AOTClassLocation* AOTClassLocation::allocate(JavaThread* current, const char* pa
type = FileType::NOT_EXIST;
} else {
aot_log_error(aot)("Unable to open file %s.", path);
MetaspaceShared::unrecoverable_loading_error();
AOTMetaspace::unrecoverable_loading_error();
}
ResourceMark rm(current);
@ -1028,10 +1028,10 @@ bool AOTClassLocationConfig::validate(const char* cache_filename, bool has_aot_l
vm_exit_during_initialization("Unable to use create AOT cache.", nullptr);
} else {
aot_log_error(aot)("%s%s", mismatch_msg, hint_msg);
MetaspaceShared::unrecoverable_loading_error();
AOTMetaspace::unrecoverable_loading_error();
}
} else {
MetaspaceShared::report_loading_error("%s%s", mismatch_msg, hint_msg);
AOTMetaspace::report_loading_error("%s%s", mismatch_msg, hint_msg);
}
}
return success;

View File

@ -221,7 +221,7 @@ void AOTLinkedClassBulkLoader::load_classes_impl(AOTLinkedClassCategory class_ca
log_error(aot)("Unable to resolve %s class from %s: %s", category_name, CDSConfig::type_of_archive_being_loaded(), ik->external_name());
log_error(aot)("Expected: " INTPTR_FORMAT ", actual: " INTPTR_FORMAT, p2i(ik), p2i(actual));
log_error(aot)("JVMTI class retransformation is not supported when archive was generated with -XX:+AOTClassLinking.");
MetaspaceShared::unrecoverable_loading_error();
AOTMetaspace::unrecoverable_loading_error();
}
assert(actual->is_loaded(), "must be");
}

View File

@ -218,8 +218,8 @@ void AOTMapLogger::dumptime_log_metaspace_region(const char* name, DumpRegion* r
}
void AOTMapLogger::runtime_log_metaspace_regions(FileMapInfo* mapinfo, GrowableArrayCHeap<ArchivedObjInfo, mtClass>* objs) {
FileMapRegion* rw = mapinfo->region_at(MetaspaceShared::rw);
FileMapRegion* ro = mapinfo->region_at(MetaspaceShared::ro);
FileMapRegion* rw = mapinfo->region_at(AOTMetaspace::rw);
FileMapRegion* ro = mapinfo->region_at(AOTMetaspace::ro);
address rw_base = address(rw->mapped_base());
address rw_end = address(rw->mapped_end());
@ -782,7 +782,7 @@ void AOTMapLogger::dumptime_log_heap_region(ArchiveHeapInfo* heap_info) {
void AOTMapLogger::runtime_log_heap_region(FileMapInfo* mapinfo) {
ResourceMark rm;
int heap_region_index = MetaspaceShared::hp;
int heap_region_index = AOTMetaspace::hp;
FileMapRegion* r = mapinfo->region_at(heap_region_index);
size_t alignment = ObjectAlignmentInBytes;

View File

@ -30,6 +30,7 @@
#include "cds/aotLinkedClassBulkLoader.hpp"
#include "cds/aotLogging.hpp"
#include "cds/aotMapLogger.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/aotReferenceObjSupport.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/archiveHeapLoader.hpp"
@ -47,7 +48,6 @@
#include "cds/heapShared.hpp"
#include "cds/lambdaFormInvokers.hpp"
#include "cds/lambdaProxyClassDictionary.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/classLoaderDataShared.hpp"
#include "classfile/javaClasses.inline.hpp"
@ -104,15 +104,15 @@
#include <sys/stat.h>
ReservedSpace MetaspaceShared::_symbol_rs;
VirtualSpace MetaspaceShared::_symbol_vs;
bool MetaspaceShared::_archive_loading_failed = false;
bool MetaspaceShared::_remapped_readwrite = false;
void* MetaspaceShared::_aot_metaspace_static_top = nullptr;
intx MetaspaceShared::_relocation_delta;
char* MetaspaceShared::_requested_base_address;
Array<Method*>* MetaspaceShared::_archived_method_handle_intrinsics = nullptr;
bool MetaspaceShared::_use_optimized_module_handling = true;
ReservedSpace AOTMetaspace::_symbol_rs;
VirtualSpace AOTMetaspace::_symbol_vs;
bool AOTMetaspace::_archive_loading_failed = false;
bool AOTMetaspace::_remapped_readwrite = false;
void* AOTMetaspace::_aot_metaspace_static_top = nullptr;
intx AOTMetaspace::_relocation_delta;
char* AOTMetaspace::_requested_base_address;
Array<Method*>* AOTMetaspace::_archived_method_handle_intrinsics = nullptr;
bool AOTMetaspace::_use_optimized_module_handling = true;
// The CDS archive is divided into the following regions:
// rw - read-write metadata
@ -121,10 +121,10 @@ bool MetaspaceShared::_use_optimized_module_handling = true;
// bm - bitmap for relocating the above 7 regions.
//
// The rw and ro regions are linearly allocated, in the order of rw->ro.
// These regions are aligned with MetaspaceShared::core_region_alignment().
// These regions are aligned with AOTMetaspace::core_region_alignment().
//
// These 2 regions are populated in the following steps:
// [0] All classes are loaded in MetaspaceShared::preload_classes(). All metadata are
// [0] All classes are loaded in AOTMetaspace::preload_classes(). All metadata are
// temporarily allocated outside of the shared regions.
// [1] We enter a safepoint and allocate a buffer for the rw/ro regions.
// [2] C++ vtables are copied into the rw region.
@ -139,7 +139,7 @@ bool MetaspaceShared::_use_optimized_module_handling = true;
static DumpRegion _symbol_region("symbols");
char* MetaspaceShared::symbol_space_alloc(size_t num_bytes) {
char* AOTMetaspace::symbol_space_alloc(size_t num_bytes) {
return _symbol_region.allocate(num_bytes);
}
@ -152,11 +152,11 @@ char* MetaspaceShared::symbol_space_alloc(size_t num_bytes) {
// Upon successful configuration, the compactible alignment then can be defined in:
// os_linux_aarch64.cpp
// os_bsd_x86.cpp
size_t MetaspaceShared::core_region_alignment() {
size_t AOTMetaspace::core_region_alignment() {
return os::cds_core_region_alignment();
}
size_t MetaspaceShared::protection_zone_size() {
size_t AOTMetaspace::protection_zone_size() {
return os::cds_core_region_alignment();
}
@ -217,7 +217,7 @@ public:
}
};
void MetaspaceShared::dump_loaded_classes(const char* file_name, TRAPS) {
void AOTMetaspace::dump_loaded_classes(const char* file_name, TRAPS) {
fileStream stream(file_name, "w");
if (stream.is_open()) {
MutexLocker lock(ClassLoaderDataGraph_lock);
@ -245,7 +245,7 @@ static bool shared_base_too_high(char* specified_base, char* aligned_base, size_
static char* compute_shared_base(size_t cds_max) {
char* specified_base = (char*)SharedBaseAddress;
size_t alignment = MetaspaceShared::core_region_alignment();
size_t alignment = AOTMetaspace::core_region_alignment();
if (UseCompressedClassPointers && CompressedKlassPointers::needs_class_space()) {
alignment = MAX2(alignment, Metaspace::reserve_alignment());
}
@ -291,7 +291,7 @@ static char* compute_shared_base(size_t cds_max) {
return aligned_base;
}
void MetaspaceShared::initialize_for_static_dump() {
void AOTMetaspace::initialize_for_static_dump() {
assert(CDSConfig::is_dumping_static_archive(), "sanity");
aot_log_info(aot)("Core region alignment: %zu", core_region_alignment());
// The max allowed size for CDS archive. We use this to limit SharedBaseAddress
@ -318,13 +318,13 @@ void MetaspaceShared::initialize_for_static_dump() {
mtClassShared);
if (!_symbol_rs.is_reserved()) {
aot_log_error(aot)("Unable to reserve memory for symbols: %zu bytes.", symbol_rs_size);
MetaspaceShared::unrecoverable_writing_error();
AOTMetaspace::unrecoverable_writing_error();
}
_symbol_region.init(&_symbol_rs, &_symbol_vs);
}
// Called by universe_post_init()
void MetaspaceShared::post_initialize(TRAPS) {
void AOTMetaspace::post_initialize(TRAPS) {
if (CDSConfig::is_using_archive()) {
FileMapInfo *static_mapinfo = FileMapInfo::current_info();
FileMapInfo *dynamic_mapinfo = FileMapInfo::dynamic_info();
@ -337,11 +337,11 @@ void MetaspaceShared::post_initialize(TRAPS) {
// Close any open file descriptors. However, mmap'ed pages will remain in memory.
static_mapinfo->close();
static_mapinfo->unmap_region(MetaspaceShared::bm);
static_mapinfo->unmap_region(AOTMetaspace::bm);
if (dynamic_mapinfo != nullptr) {
dynamic_mapinfo->close();
dynamic_mapinfo->unmap_region(MetaspaceShared::bm);
dynamic_mapinfo->unmap_region(AOTMetaspace::bm);
}
int size = AOTClassLocationConfig::runtime()->length();
@ -358,7 +358,7 @@ static GrowableArrayCHeap<Symbol*, mtClassShared>* _extra_symbols = nullptr;
// Methods managed by SystemDictionary::find_method_handle_intrinsic() to be added to the archive
static GrowableArray<Method*>* _pending_method_handle_intrinsics = nullptr;
void MetaspaceShared::read_extra_data(JavaThread* current, const char* filename) {
void AOTMetaspace::read_extra_data(JavaThread* current, const char* filename) {
_extra_interned_strings = new GrowableArrayCHeap<OopHandle, mtClassShared>(10000);
_extra_symbols = new GrowableArrayCHeap<Symbol*, mtClassShared>(1000);
@ -372,7 +372,7 @@ void MetaspaceShared::read_extra_data(JavaThread* current, const char* filename)
if (utf8_length == 0x7fffffff) {
// buf_len will overflown 32-bit value.
aot_log_error(aot)("string length too large: %d", utf8_length);
MetaspaceShared::unrecoverable_loading_error();
AOTMetaspace::unrecoverable_loading_error();
}
int buf_len = utf8_length+1;
char* utf8_buffer = NEW_RESOURCE_ARRAY(char, buf_len);
@ -407,7 +407,7 @@ void MetaspaceShared::read_extra_data(JavaThread* current, const char* filename)
}
}
void MetaspaceShared::make_method_handle_intrinsics_shareable() {
void AOTMetaspace::make_method_handle_intrinsics_shareable() {
for (int i = 0; i < _pending_method_handle_intrinsics->length(); i++) {
Method* m = ArchiveBuilder::current()->get_buffered_addr(_pending_method_handle_intrinsics->at(i));
m->remove_unshareable_info();
@ -416,7 +416,7 @@ void MetaspaceShared::make_method_handle_intrinsics_shareable() {
}
}
void MetaspaceShared::write_method_handle_intrinsics() {
void AOTMetaspace::write_method_handle_intrinsics() {
int len = _pending_method_handle_intrinsics->length();
_archived_method_handle_intrinsics = ArchiveBuilder::new_ro_array<Method*>(len);
int word_size = _archived_method_handle_intrinsics->size();
@ -452,23 +452,23 @@ void MetaspaceShared::write_method_handle_intrinsics() {
// Some of the xxx::serialize() functions may have side effects and assume that
// the archive is already mapped. For example, SymbolTable::serialize_shared_table_header()
// unconditionally makes the set of archived symbols available. Therefore, we put most
// of these xxx::serialize() functions inside MetaspaceShared::serialize(), which
// of these xxx::serialize() functions inside AOTMetaspace::serialize(), which
// is called AFTER we made the decision to map the archive.
//
// However, some of the "serialized" data are used to decide whether an archive should
// be mapped or not (e.g., for checking if the -Djdk.module.main property is compatible
// with the archive). The xxx::serialize() functions for these data must be put inside
// MetaspaceShared::early_serialize(). Such functions must not produce side effects that
// AOTMetaspace::early_serialize(). Such functions must not produce side effects that
// assume we will always decides to map the archive.
void MetaspaceShared::early_serialize(SerializeClosure* soc) {
void AOTMetaspace::early_serialize(SerializeClosure* soc) {
int tag = 0;
soc->do_tag(--tag);
CDS_JAVA_HEAP_ONLY(Modules::serialize_archived_module_info(soc);)
soc->do_tag(666);
}
void MetaspaceShared::serialize(SerializeClosure* soc) {
void AOTMetaspace::serialize(SerializeClosure* soc) {
int tag = 0;
soc->do_tag(--tag);
@ -541,7 +541,7 @@ static void rewrite_nofast_bytecode(const methodHandle& method) {
// [1] Rewrite all bytecodes as needed, so that the ConstMethod* will not be modified
// at run time by RewriteBytecodes/RewriteFrequentPairs
// [2] Assign a fingerprint, so one doesn't need to be assigned at run-time.
void MetaspaceShared::rewrite_nofast_bytecodes_and_calculate_fingerprints(Thread* thread, InstanceKlass* ik) {
void AOTMetaspace::rewrite_nofast_bytecodes_and_calculate_fingerprints(Thread* thread, InstanceKlass* ik) {
for (int i = 0; i < ik->methods()->length(); i++) {
methodHandle m(thread, ik->methods()->at(i));
if (ik->can_be_verified_at_dumptime() && ik->is_linked()) {
@ -617,7 +617,7 @@ char* VM_PopulateDumpSharedSpace::dump_early_read_only_tables() {
DumpRegion* ro_region = ArchiveBuilder::current()->ro_region();
char* start = ro_region->top();
WriteClosure wc(ro_region);
MetaspaceShared::early_serialize(&wc);
AOTMetaspace::early_serialize(&wc);
return start;
}
@ -633,7 +633,7 @@ char* VM_PopulateDumpSharedSpace::dump_read_only_tables(AOTClassLocationConfig*&
TrainingData::dump_training_data();
MetaspaceShared::write_method_handle_intrinsics();
AOTMetaspace::write_method_handle_intrinsics();
// Write lambform lines into archive
LambdaFormInvokers::dump_static_archive_invokers();
@ -646,7 +646,7 @@ char* VM_PopulateDumpSharedSpace::dump_read_only_tables(AOTClassLocationConfig*&
DumpRegion* ro_region = ArchiveBuilder::current()->ro_region();
char* start = ro_region->top();
WriteClosure wc(ro_region);
MetaspaceShared::serialize(&wc);
AOTMetaspace::serialize(&wc);
return start;
}
@ -684,7 +684,7 @@ void VM_PopulateDumpSharedSpace::doit() {
log_info(aot)("Make classes shareable");
_builder.make_klasses_shareable();
MetaspaceShared::make_method_handle_intrinsics_shareable();
AOTMetaspace::make_method_handle_intrinsics_shareable();
dump_java_heap_objects();
dump_shared_symbol_table(_builder.symbols());
@ -712,7 +712,7 @@ void VM_PopulateDumpSharedSpace::doit() {
const char* static_archive = CDSConfig::output_archive_path();
assert(static_archive != nullptr, "sanity");
_map_info = new FileMapInfo(static_archive, true);
_map_info->populate_header(MetaspaceShared::core_region_alignment());
_map_info->populate_header(AOTMetaspace::core_region_alignment());
_map_info->set_early_serialized_data(early_serialized_data);
_map_info->set_serialized_data(serialized_data);
_map_info->set_cloned_vtables(CppVtables::vtables_serialized_base());
@ -754,7 +754,7 @@ public:
// Check if we can eagerly link this class at dump time, so we can avoid the
// runtime linking overhead (especially verification)
bool MetaspaceShared::may_be_eagerly_linked(InstanceKlass* ik) {
bool AOTMetaspace::may_be_eagerly_linked(InstanceKlass* ik) {
if (!ik->can_be_verified_at_dumptime()) {
// For old classes, try to leave them in the unlinked state, so
// we can still store them in the archive. They must be
@ -773,7 +773,7 @@ bool MetaspaceShared::may_be_eagerly_linked(InstanceKlass* ik) {
return true;
}
void MetaspaceShared::link_shared_classes(TRAPS) {
void AOTMetaspace::link_shared_classes(TRAPS) {
AOTClassLinker::initialize();
AOTClassInitializer::init_test_class(CHECK);
@ -816,7 +816,7 @@ void MetaspaceShared::link_shared_classes(TRAPS) {
// Preload classes from a list, populate the shared spaces and dump to a
// file.
void MetaspaceShared::preload_and_dump(TRAPS) {
void AOTMetaspace::preload_and_dump(TRAPS) {
CDSConfig::DumperThreadMark dumper_thread_mark(THREAD);
ResourceMark rm(THREAD);
HandleMark hm(THREAD);
@ -832,12 +832,12 @@ void MetaspaceShared::preload_and_dump(TRAPS) {
if (PENDING_EXCEPTION->is_a(vmClasses::OutOfMemoryError_klass())) {
aot_log_error(aot)("Out of memory. Please run with a larger Java heap, current MaxHeapSize = "
"%zuM", MaxHeapSize/M);
MetaspaceShared::writing_error();
AOTMetaspace::writing_error();
} else {
oop message = java_lang_Throwable::message(PENDING_EXCEPTION);
aot_log_error(aot)("%s: %s", PENDING_EXCEPTION->klass()->external_name(),
message == nullptr ? "(null)" : java_lang_String::as_utf8_string(message));
MetaspaceShared::writing_error(err_msg("Unexpected exception, use -Xlog:aot%s,exceptions=trace for detail",
AOTMetaspace::writing_error(err_msg("Unexpected exception, use -Xlog:aot%s,exceptions=trace for detail",
CDSConfig::new_aot_flags_used() ? "" : ",cds"));
}
}
@ -864,7 +864,7 @@ void MetaspaceShared::preload_and_dump(TRAPS) {
}
#if INCLUDE_CDS_JAVA_HEAP && defined(_LP64)
void MetaspaceShared::adjust_heap_sizes_for_dumping() {
void AOTMetaspace::adjust_heap_sizes_for_dumping() {
if (!CDSConfig::is_dumping_heap() || UseCompressedOops) {
return;
}
@ -887,13 +887,13 @@ void MetaspaceShared::adjust_heap_sizes_for_dumping() {
}
#endif // INCLUDE_CDS_JAVA_HEAP && _LP64
void MetaspaceShared::get_default_classlist(char* default_classlist, const size_t buf_size) {
void AOTMetaspace::get_default_classlist(char* default_classlist, const size_t buf_size) {
const char* filesep = os::file_separator();
jio_snprintf(default_classlist, buf_size, "%s%slib%sclasslist",
Arguments::get_java_home(), filesep, filesep);
}
void MetaspaceShared::preload_classes(TRAPS) {
void AOTMetaspace::preload_classes(TRAPS) {
char default_classlist[JVM_MAXPATHLEN];
const char* classlist_path;
@ -928,7 +928,7 @@ void MetaspaceShared::preload_classes(TRAPS) {
aot_log_info(aot)("Loading classes to share: done.");
}
void MetaspaceShared::exercise_runtime_cds_code(TRAPS) {
void AOTMetaspace::exercise_runtime_cds_code(TRAPS) {
// Exercise the manifest processing code
const char* dummy = "Manifest-Version: 1.0\n";
CDSProtectionDomain::create_jar_manifest(dummy, strlen(dummy), CHECK);
@ -937,7 +937,7 @@ void MetaspaceShared::exercise_runtime_cds_code(TRAPS) {
CDSProtectionDomain::to_file_URL("dummy.jar", Handle(), CHECK);
}
void MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder& builder, TRAPS) {
void AOTMetaspace::preload_and_dump_impl(StaticArchiveBuilder& builder, TRAPS) {
if (CDSConfig::is_dumping_classic_static_archive()) {
// We are running with -Xshare:dump
preload_classes(CHECK);
@ -1058,8 +1058,8 @@ void MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder& builder, TRAPS
}
}
bool MetaspaceShared::write_static_archive(ArchiveBuilder* builder, FileMapInfo* map_info, ArchiveHeapInfo* heap_info) {
// relocate the data so that it can be mapped to MetaspaceShared::requested_base_address()
bool AOTMetaspace::write_static_archive(ArchiveBuilder* builder, FileMapInfo* map_info, ArchiveHeapInfo* heap_info) {
// relocate the data so that it can be mapped to AOTMetaspace::requested_base_address()
// without runtime relocation.
builder->relocate_to_requested();
@ -1177,7 +1177,7 @@ static int exec_jvm_with_java_tool_options(const char* java_launcher_path, TRAPS
return result.get_jint();
}
void MetaspaceShared::fork_and_dump_final_static_archive(TRAPS) {
void AOTMetaspace::fork_and_dump_final_static_archive(TRAPS) {
assert(CDSConfig::is_dumping_preimage_static_archive(), "sanity");
ResourceMark rm;
@ -1203,7 +1203,7 @@ void MetaspaceShared::fork_and_dump_final_static_archive(TRAPS) {
}
// Returns true if the class's status has changed.
bool MetaspaceShared::try_link_class(JavaThread* current, InstanceKlass* ik) {
bool AOTMetaspace::try_link_class(JavaThread* current, InstanceKlass* ik) {
ExceptionMark em(current);
JavaThread* THREAD = current; // For exception macros.
assert(CDSConfig::is_dumping_archive(), "sanity");
@ -1252,13 +1252,13 @@ void VM_PopulateDumpSharedSpace::dump_java_heap_objects() {
}
}
void MetaspaceShared::set_aot_metaspace_range(void* base, void *static_top, void* top) {
void AOTMetaspace::set_aot_metaspace_range(void* base, void *static_top, void* top) {
assert(base <= static_top && static_top <= top, "must be");
_aot_metaspace_static_top = static_top;
MetaspaceObj::set_aot_metaspace_range(base, top);
}
bool MetaspaceShared::in_aot_cache_dynamic_region(void* p) {
bool AOTMetaspace::in_aot_cache_dynamic_region(void* p) {
if ((p < MetaspaceObj::aot_metaspace_top()) &&
(p >= _aot_metaspace_static_top)) {
return true;
@ -1267,7 +1267,7 @@ bool MetaspaceShared::in_aot_cache_dynamic_region(void* p) {
}
}
bool MetaspaceShared::in_aot_cache_static_region(void* p) {
bool AOTMetaspace::in_aot_cache_static_region(void* p) {
if (in_aot_cache(p) && !in_aot_cache_dynamic_region(p)) {
return true;
} else {
@ -1280,7 +1280,7 @@ bool MetaspaceShared::in_aot_cache_static_region(void* p) {
// - There's an error that indicates that the archive(s) files were corrupt or otherwise damaged.
// - When -XX:+RequireSharedSpaces is specified, AND the JVM cannot load the archive(s) due
// to version or classpath mismatch.
void MetaspaceShared::unrecoverable_loading_error(const char* message) {
void AOTMetaspace::unrecoverable_loading_error(const char* message) {
report_loading_error("%s", message);
if (CDSConfig::is_dumping_final_static_archive()) {
@ -1292,7 +1292,7 @@ void MetaspaceShared::unrecoverable_loading_error(const char* message) {
}
}
void MetaspaceShared::report_loading_error(const char* format, ...) {
void AOTMetaspace::report_loading_error(const char* format, ...) {
// When using AOT cache, errors messages are always printed on the error channel.
LogStream ls_aot(LogLevel::Error, LogTagSetMapping<LOG_TAGS(aot)>::tagset());
@ -1325,21 +1325,21 @@ void MetaspaceShared::report_loading_error(const char* format, ...) {
// This function is called when the JVM is unable to write the specified CDS archive due to an
// unrecoverable error.
void MetaspaceShared::unrecoverable_writing_error(const char* message) {
void AOTMetaspace::unrecoverable_writing_error(const char* message) {
writing_error(message);
vm_direct_exit(1);
}
// This function is called when the JVM is unable to write the specified CDS archive due to a
// an error. The error will be propagated
void MetaspaceShared::writing_error(const char* message) {
void AOTMetaspace::writing_error(const char* message) {
aot_log_error(aot)("An error has occurred while writing the shared archive file.");
if (message != nullptr) {
aot_log_error(aot)("%s", message);
}
}
void MetaspaceShared::initialize_runtime_shared_and_meta_spaces() {
void AOTMetaspace::initialize_runtime_shared_and_meta_spaces() {
assert(CDSConfig::is_using_archive(), "Must be called when UseSharedSpaces is enabled");
MapArchiveResult result = MAP_ARCHIVE_OTHER_FAILURE;
@ -1385,10 +1385,10 @@ void MetaspaceShared::initialize_runtime_shared_and_meta_spaces() {
AutoCreateSharedArchive = false;
CDSConfig::disable_dumping_dynamic_archive();
if (PrintSharedArchiveAndExit) {
MetaspaceShared::unrecoverable_loading_error("Unable to use shared archive.");
AOTMetaspace::unrecoverable_loading_error("Unable to use shared archive.");
} else {
if (RequireSharedSpaces) {
MetaspaceShared::unrecoverable_loading_error("Unable to map shared spaces");
AOTMetaspace::unrecoverable_loading_error("Unable to map shared spaces");
} else {
report_loading_error("Unable to map shared spaces");
}
@ -1406,11 +1406,11 @@ void MetaspaceShared::initialize_runtime_shared_and_meta_spaces() {
delete dynamic_mapinfo;
}
if (RequireSharedSpaces && has_failed) {
MetaspaceShared::unrecoverable_loading_error("Unable to map shared spaces");
AOTMetaspace::unrecoverable_loading_error("Unable to map shared spaces");
}
}
FileMapInfo* MetaspaceShared::open_static_archive() {
FileMapInfo* AOTMetaspace::open_static_archive() {
const char* static_archive = CDSConfig::input_static_archive_path();
assert(static_archive != nullptr, "sanity");
FileMapInfo* mapinfo = new FileMapInfo(static_archive, true);
@ -1421,7 +1421,7 @@ FileMapInfo* MetaspaceShared::open_static_archive() {
return mapinfo;
}
FileMapInfo* MetaspaceShared::open_dynamic_archive() {
FileMapInfo* AOTMetaspace::open_dynamic_archive() {
if (CDSConfig::is_dumping_dynamic_archive()) {
return nullptr;
}
@ -1434,7 +1434,7 @@ FileMapInfo* MetaspaceShared::open_dynamic_archive() {
if (!mapinfo->open_as_input()) {
delete(mapinfo);
if (RequireSharedSpaces) {
MetaspaceShared::unrecoverable_loading_error("Failed to initialize dynamic archive");
AOTMetaspace::unrecoverable_loading_error("Failed to initialize dynamic archive");
}
return nullptr;
}
@ -1444,8 +1444,8 @@ FileMapInfo* MetaspaceShared::open_dynamic_archive() {
// use_requested_addr:
// true = map at FileMapHeader::_requested_base_address
// false = map at an alternative address picked by OS.
MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, FileMapInfo* dynamic_mapinfo,
bool use_requested_addr) {
MapArchiveResult AOTMetaspace::map_archives(FileMapInfo* static_mapinfo, FileMapInfo* dynamic_mapinfo,
bool use_requested_addr) {
if (use_requested_addr && static_mapinfo->requested_base_address() == nullptr) {
aot_log_info(aot)("Archive(s) were created with -XX:SharedBaseAddress=0. Always map at os-selected address.");
return MAP_ARCHIVE_MMAP_FAILURE;
@ -1517,7 +1517,7 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File
aot_log_info(aot)("Reserved class_space_rs [" INTPTR_FORMAT " - " INTPTR_FORMAT "] (%zu) bytes",
p2i(class_space_rs.base()), p2i(class_space_rs.end()), class_space_rs.size());
if (MetaspaceShared::use_windows_memory_mapping()) {
if (AOTMetaspace::use_windows_memory_mapping()) {
// We have now reserved address space for the archives, and will map in
// the archive files into this space.
//
@ -1721,12 +1721,12 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File
// covers both spaces.
// If UseCompressedClassPointers=0, class_space_rs remains unreserved.
// - On error: null is returned and the spaces remain unreserved.
char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_mapinfo,
FileMapInfo* dynamic_mapinfo,
bool use_archive_base_addr,
ReservedSpace& total_space_rs,
ReservedSpace& archive_space_rs,
ReservedSpace& class_space_rs) {
char* AOTMetaspace::reserve_address_space_for_archives(FileMapInfo* static_mapinfo,
FileMapInfo* dynamic_mapinfo,
bool use_archive_base_addr,
ReservedSpace& total_space_rs,
ReservedSpace& archive_space_rs,
ReservedSpace& class_space_rs) {
address const base_address = (address) (use_archive_base_addr ? static_mapinfo->requested_base_address() : nullptr);
const size_t archive_space_alignment = core_region_alignment();
@ -1879,9 +1879,9 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma
}
void MetaspaceShared::release_reserved_spaces(ReservedSpace& total_space_rs,
ReservedSpace& archive_space_rs,
ReservedSpace& class_space_rs) {
void AOTMetaspace::release_reserved_spaces(ReservedSpace& total_space_rs,
ReservedSpace& archive_space_rs,
ReservedSpace& class_space_rs) {
if (total_space_rs.is_reserved()) {
aot_log_debug(aot)("Released shared space (archive + class) " INTPTR_FORMAT, p2i(total_space_rs.base()));
MemoryReserver::release(total_space_rs);
@ -1900,10 +1900,10 @@ void MetaspaceShared::release_reserved_spaces(ReservedSpace& total_space_rs,
}
}
static int archive_regions[] = { MetaspaceShared::rw, MetaspaceShared::ro };
static int archive_regions[] = { AOTMetaspace::rw, AOTMetaspace::ro };
static int archive_regions_count = 2;
MapArchiveResult MetaspaceShared::map_archive(FileMapInfo* mapinfo, char* mapped_base_address, ReservedSpace rs) {
MapArchiveResult AOTMetaspace::map_archive(FileMapInfo* mapinfo, char* mapped_base_address, ReservedSpace rs) {
assert(CDSConfig::is_using_archive(), "must be runtime");
if (mapinfo == nullptr) {
return MAP_ARCHIVE_SUCCESS; // The dynamic archive has not been specified. No error has happened -- trivially succeeded.
@ -1946,11 +1946,11 @@ MapArchiveResult MetaspaceShared::map_archive(FileMapInfo* mapinfo, char* mapped
return MAP_ARCHIVE_SUCCESS;
}
void MetaspaceShared::unmap_archive(FileMapInfo* mapinfo) {
void AOTMetaspace::unmap_archive(FileMapInfo* mapinfo) {
assert(CDSConfig::is_using_archive(), "must be runtime");
if (mapinfo != nullptr) {
mapinfo->unmap_regions(archive_regions, archive_regions_count);
mapinfo->unmap_region(MetaspaceShared::bm);
mapinfo->unmap_region(AOTMetaspace::bm);
mapinfo->set_is_mapped(false);
}
}
@ -1971,7 +1971,7 @@ class CountSharedSymbols : public SymbolClosure {
// Read the miscellaneous data from the shared file, and
// serialize it out to its various destinations.
void MetaspaceShared::initialize_shared_spaces() {
void AOTMetaspace::initialize_shared_spaces() {
FileMapInfo *static_mapinfo = FileMapInfo::current_info();
FileMapInfo *dynamic_mapinfo = FileMapInfo::dynamic_info();
@ -2052,7 +2052,7 @@ void MetaspaceShared::initialize_shared_spaces() {
}
// JVM/TI RedefineClasses() support:
bool MetaspaceShared::remap_shared_readonly_as_readwrite() {
bool AOTMetaspace::remap_shared_readonly_as_readwrite() {
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
if (CDSConfig::is_using_archive()) {
@ -2072,7 +2072,7 @@ bool MetaspaceShared::remap_shared_readonly_as_readwrite() {
return true;
}
void MetaspaceShared::print_on(outputStream* st) {
void AOTMetaspace::print_on(outputStream* st) {
if (CDSConfig::is_using_archive()) {
st->print("CDS archive(s) mapped at: ");
address base = (address)MetaspaceObj::aot_metaspace_base();

View File

@ -22,8 +22,8 @@
*
*/
#ifndef SHARE_CDS_METASPACESHARED_HPP
#define SHARE_CDS_METASPACESHARED_HPP
#ifndef SHARE_CDS_AOTMETASPACE_HPP
#define SHARE_CDS_AOTMETASPACE_HPP
#include "memory/allocation.hpp"
#include "memory/memRegion.hpp"
@ -49,7 +49,7 @@ enum MapArchiveResult {
};
// Class Data Sharing Support
class MetaspaceShared : AllStatic {
class AOTMetaspace : AllStatic {
static ReservedSpace _symbol_rs; // used only during -Xshare:dump
static VirtualSpace _symbol_vs; // used only during -Xshare:dump
static bool _archive_loading_failed;
@ -63,8 +63,8 @@ class MetaspaceShared : AllStatic {
public:
enum {
// core archive spaces
rw = 0, // read-write shared space
ro = 1, // read-only shared space
rw = 0, // read-write
ro = 1, // read-only
bm = 2, // relocation bitmaps (freed after file mapping is finished)
hp = 3, // heap region
ac = 4, // aot code
@ -202,4 +202,4 @@ private:
static void unmap_archive(FileMapInfo* mapinfo);
static void get_default_classlist(char* default_classlist, const size_t buf_size);
};
#endif // SHARE_CDS_METASPACESHARED_HPP
#endif // SHARE_CDS_AOTMETASPACE_HPP

View File

@ -209,7 +209,7 @@ bool AOTReferenceObjSupport::check_if_ref_obj(oop obj) {
log_error(aot, heap)("%s", (referent == nullptr) ?
"referent cannot be null" : "referent is not registered with CDS.keepAlive()");
HeapShared::debug_trace();
MetaspaceShared::unrecoverable_writing_error();
AOTMetaspace::unrecoverable_writing_error();
}
if (log_is_enabled(Info, aot, ref)) {

View File

@ -27,6 +27,7 @@
#include "cds/aotLinkedClassBulkLoader.hpp"
#include "cds/aotLogging.hpp"
#include "cds/aotMapLogger.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/archiveHeapWriter.hpp"
#include "cds/archiveUtils.hpp"
@ -35,7 +36,6 @@
#include "cds/dumpAllocStats.hpp"
#include "cds/dynamicArchive.hpp"
#include "cds/heapShared.hpp"
#include "cds/metaspaceShared.hpp"
#include "cds/regeneratedClasses.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderDataShared.hpp"
@ -330,12 +330,12 @@ address ArchiveBuilder::reserve_buffer() {
// AOTCodeCache::max_aot_code_size() accounts for aot code region.
size_t buffer_size = LP64_ONLY(CompressedClassSpaceSize) NOT_LP64(256 * M) + AOTCodeCache::max_aot_code_size();
ReservedSpace rs = MemoryReserver::reserve(buffer_size,
MetaspaceShared::core_region_alignment(),
AOTMetaspace::core_region_alignment(),
os::vm_page_size(),
mtNone);
if (!rs.is_reserved()) {
aot_log_error(aot)("Failed to reserve %zu bytes of output buffer.", buffer_size);
MetaspaceShared::unrecoverable_writing_error();
AOTMetaspace::unrecoverable_writing_error();
}
// buffer_bottom is the lowest address of the 2 core regions (rw, ro) when
@ -357,7 +357,7 @@ address ArchiveBuilder::reserve_buffer() {
ArchivePtrMarker::initialize(&_ptrmap, &_shared_vs);
// The bottom of the static archive should be mapped at this address by default.
_requested_static_archive_bottom = (address)MetaspaceShared::requested_base_address();
_requested_static_archive_bottom = (address)AOTMetaspace::requested_base_address();
// The bottom of the archive (that I am writing now) should be mapped at this address by default.
address my_archive_requested_bottom;
@ -372,7 +372,7 @@ address ArchiveBuilder::reserve_buffer() {
// At run time, we will mmap the dynamic archive at my_archive_requested_bottom
_requested_static_archive_top = _requested_static_archive_bottom + static_archive_size;
my_archive_requested_bottom = align_up(_requested_static_archive_top, MetaspaceShared::core_region_alignment());
my_archive_requested_bottom = align_up(_requested_static_archive_top, AOTMetaspace::core_region_alignment());
_requested_dynamic_archive_bottom = my_archive_requested_bottom;
}
@ -387,13 +387,13 @@ address ArchiveBuilder::reserve_buffer() {
aot_log_error(aot)("my_archive_requested_top = " INTPTR_FORMAT, p2i(my_archive_requested_top));
aot_log_error(aot)("SharedBaseAddress (" INTPTR_FORMAT ") is too high. "
"Please rerun java -Xshare:dump with a lower value", p2i(_requested_static_archive_bottom));
MetaspaceShared::unrecoverable_writing_error();
AOTMetaspace::unrecoverable_writing_error();
}
if (CDSConfig::is_dumping_static_archive()) {
// We don't want any valid object to be at the very bottom of the archive.
// See ArchivePtrMarker::mark_pointer().
_pz_region.allocate(MetaspaceShared::protection_zone_size());
_pz_region.allocate(AOTMetaspace::protection_zone_size());
start_dump_region(&_rw_region);
}
@ -540,7 +540,7 @@ bool ArchiveBuilder::is_excluded(Klass* klass) {
return SystemDictionaryShared::is_excluded_class(ik);
} else if (klass->is_objArray_klass()) {
Klass* bottom = ObjArrayKlass::cast(klass)->bottom_klass();
if (CDSConfig::is_dumping_dynamic_archive() && MetaspaceShared::in_aot_cache_static_region(bottom)) {
if (CDSConfig::is_dumping_dynamic_archive() && AOTMetaspace::in_aot_cache_static_region(bottom)) {
// The bottom class is in the static archive so it's clearly not excluded.
return false;
} else if (bottom->is_instance_klass()) {
@ -553,7 +553,7 @@ bool ArchiveBuilder::is_excluded(Klass* klass) {
ArchiveBuilder::FollowMode ArchiveBuilder::get_follow_mode(MetaspaceClosure::Ref *ref) {
address obj = ref->obj();
if (CDSConfig::is_dumping_dynamic_archive() && MetaspaceShared::in_aot_cache(obj)) {
if (CDSConfig::is_dumping_dynamic_archive() && AOTMetaspace::in_aot_cache(obj)) {
// Don't dump existing shared metadata again.
return point_to_it;
} else if (ref->msotype() == MetaspaceObj::MethodDataType ||
@ -956,7 +956,7 @@ void ArchiveBuilder::make_klasses_shareable() {
}
}
MetaspaceShared::rewrite_nofast_bytecodes_and_calculate_fingerprints(Thread::current(), ik);
AOTMetaspace::rewrite_nofast_bytecodes_and_calculate_fingerprints(Thread::current(), ik);
ik->remove_unshareable_info();
}
@ -1188,12 +1188,12 @@ void ArchiveBuilder::print_stats() {
void ArchiveBuilder::write_archive(FileMapInfo* mapinfo, ArchiveHeapInfo* heap_info) {
// Make sure NUM_CDS_REGIONS (exported in cds.h) agrees with
// MetaspaceShared::n_regions (internal to hotspot).
assert(NUM_CDS_REGIONS == MetaspaceShared::n_regions, "sanity");
// AOTMetaspace::n_regions (internal to hotspot).
assert(NUM_CDS_REGIONS == AOTMetaspace::n_regions, "sanity");
write_region(mapinfo, MetaspaceShared::rw, &_rw_region, /*read_only=*/false,/*allow_exec=*/false);
write_region(mapinfo, MetaspaceShared::ro, &_ro_region, /*read_only=*/true, /*allow_exec=*/false);
write_region(mapinfo, MetaspaceShared::ac, &_ac_region, /*read_only=*/false,/*allow_exec=*/false);
write_region(mapinfo, AOTMetaspace::rw, &_rw_region, /*read_only=*/false,/*allow_exec=*/false);
write_region(mapinfo, AOTMetaspace::ro, &_ro_region, /*read_only=*/true, /*allow_exec=*/false);
write_region(mapinfo, AOTMetaspace::ac, &_ac_region, /*read_only=*/false,/*allow_exec=*/false);
// Split pointer map into read-write and read-only bitmaps
ArchivePtrMarker::initialize_rw_ro_maps(&_rw_ptrmap, &_ro_ptrmap);
@ -1208,7 +1208,7 @@ void ArchiveBuilder::write_archive(FileMapInfo* mapinfo, ArchiveHeapInfo* heap_i
print_region_stats(mapinfo, heap_info);
mapinfo->set_requested_base((char*)MetaspaceShared::requested_base_address());
mapinfo->set_requested_base((char*)AOTMetaspace::requested_base_address());
mapinfo->set_header_crc(mapinfo->compute_header_crc());
// After this point, we should not write any data into mapinfo->header() since this
// would corrupt its checksum we have calculated before.
@ -1239,8 +1239,8 @@ void ArchiveBuilder::count_relocated_pointer(bool tagged, bool nulled) {
void ArchiveBuilder::print_region_stats(FileMapInfo *mapinfo, ArchiveHeapInfo* heap_info) {
// Print statistics of all the regions
const size_t bitmap_used = mapinfo->region_at(MetaspaceShared::bm)->used();
const size_t bitmap_reserved = mapinfo->region_at(MetaspaceShared::bm)->used_aligned();
const size_t bitmap_used = mapinfo->region_at(AOTMetaspace::bm)->used();
const size_t bitmap_reserved = mapinfo->region_at(AOTMetaspace::bm)->used_aligned();
const size_t total_reserved = _ro_region.reserved() + _rw_region.reserved() +
bitmap_reserved +
_total_heap_region_size;
@ -1284,5 +1284,5 @@ void ArchiveBuilder::report_out_of_space(const char* name, size_t needed_bytes)
_ro_region.print_out_of_space_msg(name, needed_bytes);
log_error(aot)("Unable to allocate from '%s' region: Please reduce the number of shared classes.", name);
MetaspaceShared::unrecoverable_writing_error();
AOTMetaspace::unrecoverable_writing_error();
}

View File

@ -22,10 +22,10 @@
*
*/
#include "cds/aotMetaspace.hpp"
#include "cds/archiveHeapLoader.inline.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/heapShared.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/classLoaderDataShared.hpp"
#include "classfile/systemDictionaryShared.hpp"
#include "gc/shared/collectedHeap.hpp"
@ -261,7 +261,7 @@ class ArchiveHeapLoader::PatchLoadedRegionPointers: public BitMapClosure {
bool ArchiveHeapLoader::init_loaded_region(FileMapInfo* mapinfo, LoadedArchiveHeapRegion* loaded_region,
MemRegion& archive_space) {
size_t total_bytes = 0;
FileMapRegion* r = mapinfo->region_at(MetaspaceShared::hp);
FileMapRegion* r = mapinfo->region_at(AOTMetaspace::hp);
r->assert_is_heap_region();
if (r->used() == 0) {
return false;
@ -269,7 +269,7 @@ bool ArchiveHeapLoader::init_loaded_region(FileMapInfo* mapinfo, LoadedArchiveHe
assert(is_aligned(r->used(), HeapWordSize), "must be");
total_bytes += r->used();
loaded_region->_region_index = MetaspaceShared::hp;
loaded_region->_region_index = AOTMetaspace::hp;
loaded_region->_region_size = r->used();
loaded_region->_dumptime_base = (uintptr_t)mapinfo->heap_region_dumptime_address();
@ -447,20 +447,20 @@ class PatchNativePointers: public BitMapClosure {
bool do_bit(size_t offset) {
Metadata** p = _start + offset;
*p = (Metadata*)(address(*p) + MetaspaceShared::relocation_delta());
*p = (Metadata*)(address(*p) + AOTMetaspace::relocation_delta());
return true;
}
};
void ArchiveHeapLoader::patch_native_pointers() {
if (MetaspaceShared::relocation_delta() == 0) {
if (AOTMetaspace::relocation_delta() == 0) {
return;
}
FileMapRegion* r = FileMapInfo::current_info()->region_at(MetaspaceShared::hp);
FileMapRegion* r = FileMapInfo::current_info()->region_at(AOTMetaspace::hp);
if (r->mapped_base() != nullptr && r->has_ptrmap()) {
log_info(aot, heap)("Patching native pointers in heap region");
BitMapView bm = FileMapInfo::current_info()->ptrmap_view(MetaspaceShared::hp);
BitMapView bm = FileMapInfo::current_info()->ptrmap_view(AOTMetaspace::hp);
PatchNativePointers patcher((Metadata**)r->mapped_base() + FileMapInfo::current_info()->heap_ptrmap_start_pos());
bm.iterate(&patcher);
}

View File

@ -23,6 +23,7 @@
*/
#include "cds/aotLogging.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/archiveHeapLoader.inline.hpp"
#include "cds/archiveUtils.hpp"
@ -33,7 +34,6 @@
#include "cds/filemap.hpp"
#include "cds/heapShared.hpp"
#include "cds/lambdaProxyClassDictionary.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/systemDictionaryShared.hpp"
#include "classfile/vmClasses.hpp"
#include "interpreter/bootstrapInfo.hpp"
@ -117,7 +117,7 @@ void ArchivePtrMarker::mark_pointer(address* ptr_loc) {
if (ptr_base() <= ptr_loc && ptr_loc < ptr_end()) {
address value = *ptr_loc;
// We don't want any pointer that points to very bottom of the archive, otherwise when
// MetaspaceShared::default_base_address()==0, we can't distinguish between a pointer
// AOTMetaspace::default_base_address()==0, we can't distinguish between a pointer
// to nothing (null) vs a pointer to an objects that happens to be at the very bottom
// of the archive.
assert(value != (address)ptr_base(), "don't point to the bottom of the archive");
@ -209,7 +209,7 @@ char* DumpRegion::expand_top_to(char* newtop) {
// happens only if you allocate more than 2GB of shared objects and would require
// millions of shared classes.
aot_log_error(aot)("Out of memory in the CDS archive: Please reduce the number of shared classes.");
MetaspaceShared::unrecoverable_writing_error();
AOTMetaspace::unrecoverable_writing_error();
}
}
@ -236,11 +236,11 @@ void DumpRegion::commit_to(char* newtop) {
if (!_vs->expand_by(commit, false)) {
aot_log_error(aot)("Failed to expand shared space to %zu bytes",
need_committed_size);
MetaspaceShared::unrecoverable_writing_error();
AOTMetaspace::unrecoverable_writing_error();
}
const char* which;
if (_rs->base() == (char*)MetaspaceShared::symbol_rs_base()) {
if (_rs->base() == (char*)AOTMetaspace::symbol_rs_base()) {
which = "symbol";
} else {
which = "shared";
@ -298,10 +298,10 @@ void DumpRegion::init(ReservedSpace* rs, VirtualSpace* vs) {
void DumpRegion::pack(DumpRegion* next) {
if (!is_packed()) {
_end = (char*)align_up(_top, MetaspaceShared::core_region_alignment());
_end = (char*)align_up(_top, AOTMetaspace::core_region_alignment());
_is_packed = true;
}
_end = (char*)align_up(_top, MetaspaceShared::core_region_alignment());
_end = (char*)align_up(_top, AOTMetaspace::core_region_alignment());
_is_packed = true;
if (next != nullptr) {
next->_rs = _rs;

View File

@ -28,9 +28,9 @@
#include "cds/archiveUtils.hpp"
#include "cds/aotLogging.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/metaspaceShared.hpp"
#include "oops/array.hpp"
#include "utilities/bitMap.inline.hpp"
#include "utilities/growableArray.hpp"
@ -80,7 +80,7 @@ Array<T>* ArchiveUtils::archive_ptr_array(GrowableArray<T>* tmp_array) {
for (int i = 0; i < tmp_array->length(); i++) {
T ptr = tmp_array->at(i);
if (ptr != nullptr && !builder->is_in_buffer_space(ptr)) {
if (is_dynamic_dump && MetaspaceShared::in_aot_cache(ptr)) {
if (is_dynamic_dump && AOTMetaspace::in_aot_cache(ptr)) {
// We have a pointer that lives in the dynamic archive but points into
// the static archive.
} else {

View File

@ -767,7 +767,7 @@ void CDSConfig::prepare_for_dumping() {
#define __THEMSG " is unsupported when base CDS archive is not loaded. Run with -Xlog:cds for more info."
if (RecordDynamicDumpInfo) {
aot_log_error(aot)("-XX:+RecordDynamicDumpInfo%s", __THEMSG);
MetaspaceShared::unrecoverable_loading_error();
AOTMetaspace::unrecoverable_loading_error();
} else {
assert(ArchiveClassesAtExit != nullptr, "sanity");
aot_log_warning(aot)("-XX:ArchiveClassesAtExit" __THEMSG);

View File

@ -157,7 +157,7 @@ CDSHeapVerifier::~CDSHeapVerifier() {
"an object points to a static field that "
"may hold a different value at runtime.", _archived_objs, _problems);
log_error(aot, heap)("Please see cdsHeapVerifier.cpp and aotClassInitializer.cpp for details");
MetaspaceShared::unrecoverable_writing_error();
AOTMetaspace::unrecoverable_writing_error();
}
}

View File

@ -118,7 +118,7 @@ Handle CDSProtectionDomain::get_package_name(Symbol* class_name, TRAPS) {
PackageEntry* CDSProtectionDomain::get_package_entry_from_class(InstanceKlass* ik, Handle class_loader) {
PackageEntry* pkg_entry = ik->package();
if (CDSConfig::is_using_full_module_graph() && ik->in_aot_cache() && pkg_entry != nullptr) {
assert(MetaspaceShared::in_aot_cache(pkg_entry), "must be");
assert(AOTMetaspace::in_aot_cache(pkg_entry), "must be");
assert(!ik->defined_by_other_loaders(), "unexpected archived package entry for an unregistered class");
return pkg_entry;
}

View File

@ -24,11 +24,11 @@
#include "cds/aotConstantPoolResolver.hpp"
#include "cds/aotLogging.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/archiveUtils.hpp"
#include "cds/classListParser.hpp"
#include "cds/lambdaFormInvokers.hpp"
#include "cds/lambdaProxyClassDictionary.hpp"
#include "cds/metaspaceShared.hpp"
#include "cds/unregisteredClasses.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/javaClasses.inline.hpp"
@ -185,7 +185,7 @@ void ClassListParser::parse_class_name_and_attributes(TRAPS) {
// cpcache to be created. The linking is done as soon as classes
// are loaded in order that the related data structures (klass and
// cpCache) are located together.
MetaspaceShared::try_link_class(THREAD, ik);
AOTMetaspace::try_link_class(THREAD, ik);
}
}
@ -674,7 +674,7 @@ void ClassListParser::resolve_indy_impl(Symbol* class_name_symbol, TRAPS) {
Klass* klass = SystemDictionary::resolve_or_fail(class_name_symbol, class_loader, true, CHECK);
if (klass->is_instance_klass()) {
InstanceKlass* ik = InstanceKlass::cast(klass);
MetaspaceShared::try_link_class(THREAD, ik);
AOTMetaspace::try_link_class(THREAD, ik);
if (!ik->is_linked()) {
// Verification of ik has failed
return;

View File

@ -22,11 +22,11 @@
*
*/
#include "cds/aotMetaspace.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/archiveUtils.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/cppVtables.hpp"
#include "cds/metaspaceShared.hpp"
#include "logging/log.hpp"
#include "oops/instanceClassLoaderKlass.hpp"
#include "oops/instanceMirrorKlass.hpp"
@ -321,7 +321,7 @@ void CppVtables::zero_archived_vtables() {
}
bool CppVtables::is_valid_shared_method(const Method* m) {
assert(MetaspaceShared::in_aot_cache(m), "must be");
assert(AOTMetaspace::in_aot_cache(m), "must be");
return vtable_of(m) == _index[Method_Kind]->cloned_vtable() ||
vtable_of(m) == _archived_cpp_vtptrs[Method_Kind];
}

View File

@ -25,10 +25,10 @@
#ifndef SHARE_CDS_DUMPTIMECLASSINFO_HPP
#define SHARE_CDS_DUMPTIMECLASSINFO_HPP
#include "cds/aotMetaspace.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/archiveUtils.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/compactHashtable.hpp"
#include "memory/metaspaceClosure.hpp"
#include "oops/instanceKlass.hpp"
@ -231,7 +231,7 @@ template <typename T>
inline unsigned DumpTimeSharedClassTable_hash(T* const& k) {
if (CDSConfig::is_dumping_static_archive()) {
// Deterministic archive contents
uintx delta = k->name() - MetaspaceShared::symbol_rs_base();
uintx delta = k->name() - AOTMetaspace::symbol_rs_base();
return primitive_hash<uintx>(delta);
} else {
// Deterministic archive is not possible because classes can be loaded

View File

@ -26,6 +26,7 @@
#include "cds/aotClassLinker.hpp"
#include "cds/aotClassLocation.hpp"
#include "cds/aotLogging.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/archiveHeapWriter.hpp"
#include "cds/archiveUtils.inline.hpp"
@ -34,7 +35,6 @@
#include "cds/dynamicArchive.hpp"
#include "cds/lambdaFormInvokers.hpp"
#include "cds/lambdaProxyClassDictionary.hpp"
#include "cds/metaspaceShared.hpp"
#include "cds/regeneratedClasses.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderData.inline.hpp"
@ -187,7 +187,7 @@ public:
for (int i = T_BOOLEAN; i <= T_LONG; i++) {
assert(is_java_primitive((BasicType)i), "sanity");
Klass* k = Universe::typeArrayKlass((BasicType)i); // this give you "[I", etc
assert(MetaspaceShared::in_aot_cache_static_region((void*)k),
assert(AOTMetaspace::in_aot_cache_static_region((void*)k),
"one-dimensional primitive array should be in static archive");
ArrayKlass* ak = ArrayKlass::cast(k);
while (ak != nullptr && ak->in_aot_cache()) {
@ -216,7 +216,7 @@ void DynamicArchiveBuilder::init_header() {
_header = mapinfo->dynamic_header();
_header->set_base_header_crc(base_info->crc());
for (int i = 0; i < MetaspaceShared::n_regions; i++) {
for (int i = 0; i < AOTMetaspace::n_regions; i++) {
_header->set_base_region_crc(i, base_info->region_crc(i));
}
}
@ -253,7 +253,7 @@ void DynamicArchiveBuilder::sort_methods() {
// klasses were created. Re-sort all the tables. See Method::sort_methods().
void DynamicArchiveBuilder::sort_methods(InstanceKlass* ik) const {
assert(ik != nullptr, "DynamicArchiveBuilder currently doesn't support dumping the base archive");
if (MetaspaceShared::in_aot_cache(ik)) {
if (AOTMetaspace::in_aot_cache(ik)) {
// We have reached a supertype that's already in the base archive
return;
}
@ -287,13 +287,13 @@ void DynamicArchiveBuilder::sort_methods(InstanceKlass* ik) const {
if (ik->methods() != nullptr) {
for (int m = 0; m < ik->methods()->length(); m++) {
Symbol* name = ik->methods()->at(m)->name();
assert(MetaspaceShared::in_aot_cache(name) || is_in_buffer_space(name), "must be");
assert(AOTMetaspace::in_aot_cache(name) || is_in_buffer_space(name), "must be");
}
}
if (ik->default_methods() != nullptr) {
for (int m = 0; m < ik->default_methods()->length(); m++) {
Symbol* name = ik->default_methods()->at(m)->name();
assert(MetaspaceShared::in_aot_cache(name) || is_in_buffer_space(name), "must be");
assert(AOTMetaspace::in_aot_cache(name) || is_in_buffer_space(name), "must be");
}
}
#endif
@ -367,14 +367,14 @@ void DynamicArchiveBuilder::gather_array_klasses() {
if (klasses()->at(i)->is_objArray_klass()) {
ObjArrayKlass* oak = ObjArrayKlass::cast(klasses()->at(i));
Klass* elem = oak->element_klass();
if (MetaspaceShared::in_aot_cache_static_region(elem)) {
if (AOTMetaspace::in_aot_cache_static_region(elem)) {
// Only capture the array klass whose element_klass is in the static archive.
// During run time, setup (see DynamicArchive::setup_array_klasses()) is needed
// so that the element_klass can find its array klasses from the dynamic archive.
DynamicArchive::append_array_klass(oak);
} else {
// The element_klass and its array klasses are in the same archive.
assert(!MetaspaceShared::in_aot_cache_static_region(oak),
assert(!AOTMetaspace::in_aot_cache_static_region(oak),
"we should not gather klasses that are already in the static archive");
}
}
@ -435,7 +435,7 @@ void DynamicArchive::setup_array_klasses() {
assert(!oak->is_typeArray_klass(), "all type array classes must be in static archive");
Klass* elm = oak->element_klass();
assert(MetaspaceShared::in_aot_cache_static_region((void*)elm), "must be");
assert(AOTMetaspace::in_aot_cache_static_region((void*)elm), "must be");
if (elm->is_instance_klass()) {
assert(InstanceKlass::cast(elm)->array_klasses() == nullptr, "must be");
@ -476,7 +476,7 @@ int DynamicArchive::num_array_klasses() {
}
void DynamicArchive::dump_impl(bool jcmd_request, const char* archive_name, TRAPS) {
MetaspaceShared::link_shared_classes(CHECK);
AOTMetaspace::link_shared_classes(CHECK);
if (!jcmd_request && CDSConfig::is_dumping_regenerated_lambdaform_invokers()) {
LambdaFormInvokers::regenerate_holder_classes(CHECK);
}
@ -532,7 +532,7 @@ bool DynamicArchive::validate(FileMapInfo* dynamic_info) {
}
// Check each space's crc
for (int i = 0; i < MetaspaceShared::n_regions; i++) {
for (int i = 0; i < AOTMetaspace::n_regions; i++) {
if (dynamic_header->base_region_crc(i) != base_info->region_crc(i)) {
aot_log_warning(aot)("Dynamic archive cannot be used: static archive region #%d checksum verification failed.", i);
return false;

View File

@ -41,7 +41,7 @@ class DynamicArchiveHeader : public FileMapHeader {
friend class CDSConstants;
private:
int _base_header_crc;
int _base_region_crc[MetaspaceShared::n_regions];
int _base_region_crc[AOTMetaspace::n_regions];
public:
int base_header_crc() const { return _base_header_crc; }

View File

@ -24,6 +24,7 @@
#include "cds/aotClassLocation.hpp"
#include "cds/aotLogging.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/archiveHeapLoader.inline.hpp"
#include "cds/archiveHeapWriter.hpp"
@ -33,7 +34,6 @@
#include "cds/dynamicArchive.hpp"
#include "cds/filemap.hpp"
#include "cds/heapShared.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/altHashing.hpp"
#include "classfile/classFileStream.hpp"
#include "classfile/classLoader.hpp"
@ -329,7 +329,7 @@ bool FileMapInfo::validate_class_location() {
bool has_extra_module_paths = false;
if (!config->validate(full_path(), header()->has_aot_linked_classes(), &has_extra_module_paths)) {
if (PrintSharedArchiveAndExit) {
MetaspaceShared::set_archive_loading_failed();
AOTMetaspace::set_archive_loading_failed();
return true;
} else {
return false;
@ -338,7 +338,7 @@ bool FileMapInfo::validate_class_location() {
if (header()->has_full_module_graph() && has_extra_module_paths) {
CDSConfig::stop_using_optimized_module_handling();
MetaspaceShared::report_loading_error("optimized module handling: disabled because extra module path(s) are specified");
AOTMetaspace::report_loading_error("optimized module handling: disabled because extra module path(s) are specified");
}
if (CDSConfig::is_dumping_dynamic_archive()) {
@ -409,7 +409,7 @@ public:
assert(_archive_name != nullptr, "Archive name is null");
_fd = os::open(_archive_name, O_RDONLY | O_BINARY, 0);
if (_fd < 0) {
MetaspaceShared::report_loading_error("Specified %s not found (%s)", CDSConfig::type_of_archive_being_loaded(), _archive_name);
AOTMetaspace::report_loading_error("Specified %s not found (%s)", CDSConfig::type_of_archive_being_loaded(), _archive_name);
return false;
}
return initialize(_fd);
@ -694,7 +694,7 @@ bool FileMapInfo::init_from_file(int fd) {
size_t len = os::lseek(fd, 0, SEEK_END);
for (int i = 0; i < MetaspaceShared::n_regions; i++) {
for (int i = 0; i < AOTMetaspace::n_regions; i++) {
FileMapRegion* r = region_at(i);
if (r->file_offset() > len || len - r->file_offset() < r->used()) {
aot_log_warning(aot)("The %s has been truncated.", file_type);
@ -708,7 +708,7 @@ bool FileMapInfo::init_from_file(int fd) {
void FileMapInfo::seek_to_position(size_t pos) {
if (os::lseek(_fd, (long)pos, SEEK_SET) < 0) {
aot_log_error(aot)("Unable to seek to position %zu", pos);
MetaspaceShared::unrecoverable_loading_error();
AOTMetaspace::unrecoverable_loading_error();
}
}
@ -763,7 +763,7 @@ void FileMapInfo::open_as_output() {
if (fd < 0) {
aot_log_error(aot)("Unable to create %s %s: (%s).", CDSConfig::type_of_archive_being_written(), _full_path,
os::strerror(errno));
MetaspaceShared::writing_error();
AOTMetaspace::writing_error();
return;
}
_fd = fd;
@ -773,7 +773,7 @@ void FileMapInfo::open_as_output() {
// and their CRCs computed.
size_t header_bytes = header()->header_size();
header_bytes = align_up(header_bytes, MetaspaceShared::core_region_alignment());
header_bytes = align_up(header_bytes, AOTMetaspace::core_region_alignment());
_file_offset = header_bytes;
seek_to_position(_file_offset);
}
@ -788,13 +788,13 @@ void FileMapInfo::write_header() {
}
size_t FileMapRegion::used_aligned() const {
return align_up(used(), MetaspaceShared::core_region_alignment());
return align_up(used(), AOTMetaspace::core_region_alignment());
}
void FileMapRegion::init(int region_index, size_t mapping_offset, size_t size, bool read_only,
bool allow_exec, int crc) {
_is_heap_region = HeapShared::is_heap_region(region_index);
_is_bitmap_region = (region_index == MetaspaceShared::bm);
_is_bitmap_region = (region_index == AOTMetaspace::bm);
_mapping_offset = mapping_offset;
_used = size;
_read_only = read_only;
@ -890,7 +890,7 @@ void FileMapInfo::write_region(int region, char* base, size_t size,
char* requested_base;
size_t mapping_offset = 0;
if (region == MetaspaceShared::bm) {
if (region == AOTMetaspace::bm) {
requested_base = nullptr; // always null for bm region
} else if (size == 0) {
// This is an unused region (e.g., a heap region when !INCLUDE_CDS_JAVA_HEAP)
@ -908,7 +908,7 @@ void FileMapInfo::write_region(int region, char* base, size_t size,
}
#endif // INCLUDE_CDS_JAVA_HEAP
} else {
char* requested_SharedBaseAddress = (char*)MetaspaceShared::requested_base_address();
char* requested_SharedBaseAddress = (char*)AOTMetaspace::requested_base_address();
requested_base = ArchiveBuilder::current()->to_requested(base);
assert(requested_base >= requested_SharedBaseAddress, "must be");
mapping_offset = requested_base - requested_SharedBaseAddress;
@ -984,14 +984,14 @@ char* FileMapInfo::write_bitmap_region(CHeapBitMap* rw_ptrmap, CHeapBitMap* ro_p
char* buffer = NEW_C_HEAP_ARRAY(char, size_in_bytes, mtClassShared);
size_t written = 0;
region_at(MetaspaceShared::rw)->init_ptrmap(0, rw_ptrmap->size());
region_at(AOTMetaspace::rw)->init_ptrmap(0, rw_ptrmap->size());
written = write_bitmap(rw_ptrmap, buffer, written);
region_at(MetaspaceShared::ro)->init_ptrmap(written, ro_ptrmap->size());
region_at(AOTMetaspace::ro)->init_ptrmap(written, ro_ptrmap->size());
written = write_bitmap(ro_ptrmap, buffer, written);
if (heap_info->is_used()) {
FileMapRegion* r = region_at(MetaspaceShared::hp);
FileMapRegion* r = region_at(AOTMetaspace::hp);
r->init_oopmap(written, heap_info->oopmap()->size());
written = write_bitmap(heap_info->oopmap(), buffer, written);
@ -1000,14 +1000,14 @@ char* FileMapInfo::write_bitmap_region(CHeapBitMap* rw_ptrmap, CHeapBitMap* ro_p
written = write_bitmap(heap_info->ptrmap(), buffer, written);
}
write_region(MetaspaceShared::bm, (char*)buffer, size_in_bytes, /*read_only=*/true, /*allow_exec=*/false);
write_region(AOTMetaspace::bm, (char*)buffer, size_in_bytes, /*read_only=*/true, /*allow_exec=*/false);
return buffer;
}
size_t FileMapInfo::write_heap_region(ArchiveHeapInfo* heap_info) {
char* buffer_start = heap_info->buffer_start();
size_t buffer_size = heap_info->buffer_byte_size();
write_region(MetaspaceShared::hp, buffer_start, buffer_size, false, false);
write_region(AOTMetaspace::hp, buffer_start, buffer_size, false, false);
header()->set_heap_root_segments(heap_info->heap_root_segments());
return buffer_size;
}
@ -1022,11 +1022,11 @@ void FileMapInfo::write_bytes(const void* buffer, size_t nbytes) {
remove(_full_path);
if (CDSConfig::is_dumping_preimage_static_archive()) {
MetaspaceShared::writing_error("Unable to write to AOT configuration file.");
AOTMetaspace::writing_error("Unable to write to AOT configuration file.");
} else if (CDSConfig::new_aot_flags_used()) {
MetaspaceShared::writing_error("Unable to write to AOT cache.");
AOTMetaspace::writing_error("Unable to write to AOT cache.");
} else {
MetaspaceShared::writing_error("Unable to write to shared archive.");
AOTMetaspace::writing_error("Unable to write to shared archive.");
}
}
_file_offset += nbytes;
@ -1034,7 +1034,7 @@ void FileMapInfo::write_bytes(const void* buffer, size_t nbytes) {
bool FileMapInfo::is_file_position_aligned() const {
return _file_offset == align_up(_file_offset,
MetaspaceShared::core_region_alignment());
AOTMetaspace::core_region_alignment());
}
// Align file position to an allocation unit boundary.
@ -1042,7 +1042,7 @@ bool FileMapInfo::is_file_position_aligned() const {
void FileMapInfo::align_file_position() {
assert(_file_open, "must be");
size_t new_file_offset = align_up(_file_offset,
MetaspaceShared::core_region_alignment());
AOTMetaspace::core_region_alignment());
if (new_file_offset != _file_offset) {
_file_offset = new_file_offset;
// Seek one byte back from the target and write a byte to insure
@ -1068,7 +1068,7 @@ void FileMapInfo::write_bytes_aligned(const void* buffer, size_t nbytes) {
void FileMapInfo::close() {
if (_file_open) {
if (::close(_fd) < 0) {
MetaspaceShared::unrecoverable_loading_error("Unable to close the shared archive file.");
AOTMetaspace::unrecoverable_loading_error("Unable to close the shared archive file.");
}
_file_open = false;
_fd = -1;
@ -1093,7 +1093,7 @@ static char* map_memory(int fd, const char* file_name, size_t file_offset,
// JVM/TI RedefineClasses() support:
// Remap the shared readonly space to shared readwrite, private.
bool FileMapInfo::remap_shared_readonly_as_readwrite() {
int idx = MetaspaceShared::ro;
int idx = AOTMetaspace::ro;
FileMapRegion* r = region_at(idx);
if (!r->read_only()) {
// the space is already readwrite so we are done
@ -1200,7 +1200,7 @@ MapArchiveResult FileMapInfo::map_region(int i, intx addr_delta, char* mapped_ba
r->set_mapped_from_file(false);
r->set_in_reserved_space(false);
if (MetaspaceShared::use_windows_memory_mapping()) {
if (AOTMetaspace::use_windows_memory_mapping()) {
// Windows cannot remap read-only shared memory to read-write when required for
// RedefineClasses, which is also used by JFR. Always map windows regions as RW.
r->set_read_only(false);
@ -1212,13 +1212,13 @@ MapArchiveResult FileMapInfo::map_region(int i, intx addr_delta, char* mapped_ba
r->set_read_only(false); // Need to patch the pointers
}
if (MetaspaceShared::use_windows_memory_mapping() && rs.is_reserved()) {
if (AOTMetaspace::use_windows_memory_mapping() && rs.is_reserved()) {
// This is the second time we try to map the archive(s). We have already created a ReservedSpace
// that covers all the FileMapRegions to ensure all regions can be mapped. However, Windows
// can't mmap into a ReservedSpace, so we just ::read() the data. We're going to patch all the
// regions anyway, so there's no benefit for mmap anyway.
if (!read_region(i, requested_addr, size, /* do_commit = */ true)) {
MetaspaceShared::report_loading_error("Failed to read %s shared space into reserved space at " INTPTR_FORMAT,
AOTMetaspace::report_loading_error("Failed to read %s shared space into reserved space at " INTPTR_FORMAT,
shared_region_name[i], p2i(requested_addr));
return MAP_ARCHIVE_OTHER_FAILURE; // oom or I/O error.
} else {
@ -1227,12 +1227,12 @@ MapArchiveResult FileMapInfo::map_region(int i, intx addr_delta, char* mapped_ba
} else {
// Note that this may either be a "fresh" mapping into unreserved address
// space (Windows, first mapping attempt), or a mapping into pre-reserved
// space (Posix). See also comment in MetaspaceShared::map_archives().
// space (Posix). See also comment in AOTMetaspace::map_archives().
char* base = map_memory(_fd, _full_path, r->file_offset(),
requested_addr, size, r->read_only(),
r->allow_exec(), mtClassShared);
if (base != requested_addr) {
MetaspaceShared::report_loading_error("Unable to map %s shared space at " INTPTR_FORMAT,
AOTMetaspace::report_loading_error("Unable to map %s shared space at " INTPTR_FORMAT,
shared_region_name[i], p2i(requested_addr));
_memory_mapping_failed = true;
return MAP_ARCHIVE_MMAP_FAILURE;
@ -1258,7 +1258,7 @@ MapArchiveResult FileMapInfo::map_region(int i, intx addr_delta, char* mapped_ba
// The return value is the location of the archive relocation bitmap.
char* FileMapInfo::map_bitmap_region() {
FileMapRegion* r = region_at(MetaspaceShared::bm);
FileMapRegion* r = region_at(AOTMetaspace::bm);
if (r->mapped_base() != nullptr) {
return r->mapped_base();
}
@ -1267,7 +1267,7 @@ char* FileMapInfo::map_bitmap_region() {
char* bitmap_base = map_memory(_fd, _full_path, r->file_offset(),
requested_addr, r->used_aligned(), read_only, allow_exec, mtClassShared);
if (bitmap_base == nullptr) {
MetaspaceShared::report_loading_error("failed to map relocation bitmap");
AOTMetaspace::report_loading_error("failed to map relocation bitmap");
return nullptr;
}
@ -1283,22 +1283,22 @@ char* FileMapInfo::map_bitmap_region() {
r->set_mapped_base(bitmap_base);
aot_log_info(aot)("Mapped %s region #%d at base " INTPTR_FORMAT " top " INTPTR_FORMAT " (%s)",
is_static() ? "static " : "dynamic",
MetaspaceShared::bm, p2i(r->mapped_base()), p2i(r->mapped_end()),
shared_region_name[MetaspaceShared::bm]);
AOTMetaspace::bm, p2i(r->mapped_base()), p2i(r->mapped_end()),
shared_region_name[AOTMetaspace::bm]);
return bitmap_base;
}
bool FileMapInfo::map_aot_code_region(ReservedSpace rs) {
FileMapRegion* r = region_at(MetaspaceShared::ac);
FileMapRegion* r = region_at(AOTMetaspace::ac);
assert(r->used() > 0 && r->used_aligned() == rs.size(), "must be");
char* requested_base = rs.base();
assert(requested_base != nullptr, "should be inside code cache");
char* mapped_base;
if (MetaspaceShared::use_windows_memory_mapping()) {
if (!read_region(MetaspaceShared::ac, requested_base, r->used_aligned(), /* do_commit = */ true)) {
MetaspaceShared::report_loading_error("Failed to read aot code shared space into reserved space at " INTPTR_FORMAT,
if (AOTMetaspace::use_windows_memory_mapping()) {
if (!read_region(AOTMetaspace::ac, requested_base, r->used_aligned(), /* do_commit = */ true)) {
AOTMetaspace::report_loading_error("Failed to read aot code shared space into reserved space at " INTPTR_FORMAT,
p2i(requested_base));
return false;
}
@ -1311,15 +1311,15 @@ bool FileMapInfo::map_aot_code_region(ReservedSpace rs) {
requested_base, r->used_aligned(), read_only, allow_exec, mtClassShared);
}
if (mapped_base == nullptr) {
MetaspaceShared::report_loading_error("failed to map aot code region");
AOTMetaspace::report_loading_error("failed to map aot code region");
return false;
} else {
assert(mapped_base == requested_base, "must be");
r->set_mapped_from_file(true);
r->set_mapped_base(mapped_base);
aot_log_info(aot)("Mapped static region #%d at base " INTPTR_FORMAT " top " INTPTR_FORMAT " (%s)",
MetaspaceShared::ac, p2i(r->mapped_base()), p2i(r->mapped_end()),
shared_region_name[MetaspaceShared::ac]);
AOTMetaspace::ac, p2i(r->mapped_base()), p2i(r->mapped_end()),
shared_region_name[AOTMetaspace::ac]);
return true;
}
}
@ -1359,8 +1359,8 @@ bool FileMapInfo::relocate_pointers_in_core_regions(intx addr_delta) {
if (bitmap_base == nullptr) {
return false; // OOM, or CRC check failure
} else {
BitMapView rw_ptrmap = ptrmap_view(MetaspaceShared::rw);
BitMapView ro_ptrmap = ptrmap_view(MetaspaceShared::ro);
BitMapView rw_ptrmap = ptrmap_view(AOTMetaspace::rw);
BitMapView ro_ptrmap = ptrmap_view(AOTMetaspace::ro);
FileMapRegion* rw_region = first_core_region();
FileMapRegion* ro_region = last_core_region();
@ -1398,7 +1398,7 @@ bool FileMapInfo::relocate_pointers_in_core_regions(intx addr_delta) {
ro_ptrmap.iterate(&ro_patcher);
}
// The MetaspaceShared::bm region will be unmapped in MetaspaceShared::initialize_shared_spaces().
// The AOTMetaspace::bm region will be unmapped in AOTMetaspace::initialize_shared_spaces().
aot_log_debug(aot, reloc)("runtime archive relocation done");
return true;
@ -1421,11 +1421,11 @@ size_t FileMapInfo::read_bytes(void* buffer, size_t count) {
size_t FileMapInfo::readonly_total() {
size_t total = 0;
if (current_info() != nullptr) {
FileMapRegion* r = FileMapInfo::current_info()->region_at(MetaspaceShared::ro);
FileMapRegion* r = FileMapInfo::current_info()->region_at(AOTMetaspace::ro);
if (r->read_only()) total += r->used();
}
if (dynamic_info() != nullptr) {
FileMapRegion* r = FileMapInfo::dynamic_info()->region_at(MetaspaceShared::ro);
FileMapRegion* r = FileMapInfo::dynamic_info()->region_at(AOTMetaspace::ro);
if (r->read_only()) total += r->used();
}
return total;
@ -1435,7 +1435,7 @@ size_t FileMapInfo::readonly_total() {
MemRegion FileMapInfo::_mapped_heap_memregion;
bool FileMapInfo::has_heap_region() {
return (region_at(MetaspaceShared::hp)->used() > 0);
return (region_at(AOTMetaspace::hp)->used() > 0);
}
// Returns the address range of the archived heap region computed using the
@ -1443,7 +1443,7 @@ bool FileMapInfo::has_heap_region() {
// dump time due to encoding mode differences. The result is used in determining
// if/how these regions should be relocated at run time.
MemRegion FileMapInfo::get_heap_region_requested_range() {
FileMapRegion* r = region_at(MetaspaceShared::hp);
FileMapRegion* r = region_at(AOTMetaspace::hp);
size_t size = r->used();
assert(size > 0, "must have non-empty heap region");
@ -1465,9 +1465,9 @@ void FileMapInfo::map_or_load_heap_region() {
success = ArchiveHeapLoader::load_heap_region(this);
} else {
if (!UseCompressedOops && !ArchiveHeapLoader::can_map()) {
MetaspaceShared::report_loading_error("Cannot use CDS heap data. Selected GC not compatible -XX:-UseCompressedOops");
AOTMetaspace::report_loading_error("Cannot use CDS heap data. Selected GC not compatible -XX:-UseCompressedOops");
} else {
MetaspaceShared::report_loading_error("Cannot use CDS heap data. UseEpsilonGC, UseG1GC, UseSerialGC, UseParallelGC, or UseShenandoahGC are required.");
AOTMetaspace::report_loading_error("Cannot use CDS heap data. UseEpsilonGC, UseG1GC, UseSerialGC, UseParallelGC, or UseShenandoahGC are required.");
}
}
}
@ -1482,7 +1482,7 @@ void FileMapInfo::map_or_load_heap_region() {
aot_log_error(aot)("%s has aot-linked classes but the archived "
"heap objects cannot be loaded. Try increasing your heap size.",
CDSConfig::type_of_archive_being_loaded());
MetaspaceShared::unrecoverable_loading_error();
AOTMetaspace::unrecoverable_loading_error();
}
CDSConfig::stop_using_full_module_graph("archive heap loading failed");
}
@ -1575,7 +1575,7 @@ bool FileMapInfo::can_use_heap_region() {
// The actual address of this region during dump time.
address FileMapInfo::heap_region_dumptime_address() {
FileMapRegion* r = region_at(MetaspaceShared::hp);
FileMapRegion* r = region_at(AOTMetaspace::hp);
assert(CDSConfig::is_using_archive(), "runtime only");
assert(is_aligned(r->mapping_offset(), sizeof(HeapWord)), "must be");
if (UseCompressedOops) {
@ -1589,7 +1589,7 @@ address FileMapInfo::heap_region_dumptime_address() {
// patching any of the pointers that are embedded in this region.
address FileMapInfo::heap_region_requested_address() {
assert(CDSConfig::is_using_archive(), "runtime only");
FileMapRegion* r = region_at(MetaspaceShared::hp);
FileMapRegion* r = region_at(AOTMetaspace::hp);
assert(is_aligned(r->mapping_offset(), sizeof(HeapWord)), "must be");
assert(ArchiveHeapLoader::can_use(), "GC must support mapping or loading");
if (UseCompressedOops) {
@ -1643,7 +1643,7 @@ bool FileMapInfo::map_heap_region() {
bool FileMapInfo::map_heap_region_impl() {
assert(UseG1GC, "the following code assumes G1");
FileMapRegion* r = region_at(MetaspaceShared::hp);
FileMapRegion* r = region_at(AOTMetaspace::hp);
size_t size = r->used();
if (size == 0) {
return false; // no archived java heap data
@ -1657,7 +1657,7 @@ bool FileMapInfo::map_heap_region_impl() {
// allocate from java heap
HeapWord* start = G1CollectedHeap::heap()->alloc_archive_region(word_size, (HeapWord*)requested_start);
if (start == nullptr) {
MetaspaceShared::report_loading_error("UseSharedSpaces: Unable to allocate java heap region for archive heap.");
AOTMetaspace::report_loading_error("UseSharedSpaces: Unable to allocate java heap region for archive heap.");
return false;
}
@ -1668,11 +1668,11 @@ bool FileMapInfo::map_heap_region_impl() {
char* addr = (char*)_mapped_heap_memregion.start();
char* base;
if (MetaspaceShared::use_windows_memory_mapping() || UseLargePages) {
if (AOTMetaspace::use_windows_memory_mapping() || UseLargePages) {
// With UseLargePages, memory mapping may fail on some OSes if the size is not
// large page aligned, so let's use read() instead. In this case, the memory region
// is already commited by G1 so we don't need to commit it again.
if (!read_region(MetaspaceShared::hp, addr,
if (!read_region(AOTMetaspace::hp, addr,
align_up(_mapped_heap_memregion.byte_size(), os::vm_page_size()),
/* do_commit = */ !UseLargePages)) {
dealloc_heap_region();
@ -1687,7 +1687,7 @@ bool FileMapInfo::map_heap_region_impl() {
r->allow_exec(), mtJavaHeap);
if (base == nullptr || base != addr) {
dealloc_heap_region();
MetaspaceShared::report_loading_error("UseSharedSpaces: Unable to map at required address in java heap. "
AOTMetaspace::report_loading_error("UseSharedSpaces: Unable to map at required address in java heap. "
INTPTR_FORMAT ", size = %zu bytes",
p2i(addr), _mapped_heap_memregion.byte_size());
return false;
@ -1695,7 +1695,7 @@ bool FileMapInfo::map_heap_region_impl() {
if (VerifySharedSpaces && !r->check_region_crc(base)) {
dealloc_heap_region();
MetaspaceShared::report_loading_error("UseSharedSpaces: mapped heap region is corrupt");
AOTMetaspace::report_loading_error("UseSharedSpaces: mapped heap region is corrupt");
return false;
}
}
@ -1719,7 +1719,7 @@ bool FileMapInfo::map_heap_region_impl() {
if (_heap_pointers_need_patching) {
char* bitmap_base = map_bitmap_region();
if (bitmap_base == nullptr) {
MetaspaceShared::report_loading_error("CDS heap cannot be used because bitmap region cannot be mapped");
AOTMetaspace::report_loading_error("CDS heap cannot be used because bitmap region cannot be mapped");
dealloc_heap_region();
_heap_pointers_need_patching = false;
return false;
@ -1734,7 +1734,7 @@ bool FileMapInfo::map_heap_region_impl() {
narrowOop FileMapInfo::encoded_heap_region_dumptime_address() {
assert(CDSConfig::is_using_archive(), "runtime only");
assert(UseCompressedOops, "sanity");
FileMapRegion* r = region_at(MetaspaceShared::hp);
FileMapRegion* r = region_at(AOTMetaspace::hp);
return CompressedOops::narrow_oop_cast(r->mapping_offset() >> narrow_oop_shift());
}
@ -1746,10 +1746,10 @@ void FileMapInfo::patch_heap_embedded_pointers() {
char* bitmap_base = map_bitmap_region();
assert(bitmap_base != nullptr, "must have already been mapped");
FileMapRegion* r = region_at(MetaspaceShared::hp);
FileMapRegion* r = region_at(AOTMetaspace::hp);
ArchiveHeapLoader::patch_embedded_pointers(
this, _mapped_heap_memregion,
(address)(region_at(MetaspaceShared::bm)->mapped_base()) + r->oopmap_offset(),
(address)(region_at(AOTMetaspace::bm)->mapped_base()) + r->oopmap_offset(),
r->oopmap_size_in_bits());
}
@ -1805,7 +1805,7 @@ void FileMapInfo::unmap_region(int i) {
void FileMapInfo::assert_mark(bool check) {
if (!check) {
MetaspaceShared::unrecoverable_loading_error("Mark mismatch while restoring from shared file.");
AOTMetaspace::unrecoverable_loading_error("Mark mismatch while restoring from shared file.");
}
}
@ -1832,16 +1832,16 @@ bool FileMapInfo::open_as_input() {
// are replaced at runtime by JVMTI ClassFileLoadHook. All of those classes are resolved
// during the JVMTI "early" stage, so we can still use CDS if
// JvmtiExport::has_early_class_hook_env() is false.
MetaspaceShared::report_loading_error("CDS is disabled because early JVMTI ClassFileLoadHook is in use.");
AOTMetaspace::report_loading_error("CDS is disabled because early JVMTI ClassFileLoadHook is in use.");
return false;
}
if (!open_for_read() || !init_from_file(_fd) || !validate_header()) {
if (_is_static) {
MetaspaceShared::report_loading_error("Loading static archive failed.");
AOTMetaspace::report_loading_error("Loading static archive failed.");
return false;
} else {
MetaspaceShared::report_loading_error("Loading dynamic archive failed.");
AOTMetaspace::report_loading_error("Loading dynamic archive failed.");
if (AutoCreateSharedArchive) {
CDSConfig::enable_dumping_dynamic_archive(_full_path);
}
@ -1894,11 +1894,11 @@ bool FileMapInfo::validate_aot_class_linking() {
// The 2 core spaces are RW->RO
FileMapRegion* FileMapInfo::first_core_region() const {
return region_at(MetaspaceShared::rw);
return region_at(AOTMetaspace::rw);
}
FileMapRegion* FileMapInfo::last_core_region() const {
return region_at(MetaspaceShared::ro);
return region_at(AOTMetaspace::ro);
}
void FileMapInfo::print(outputStream* st) const {
@ -1925,13 +1925,13 @@ int FileMapHeader::compute_crc() {
bool FileMapHeader::validate() {
const char* file_type = CDSConfig::type_of_archive_being_loaded();
if (_obj_alignment != ObjectAlignmentInBytes) {
MetaspaceShared::report_loading_error("The %s's ObjectAlignmentInBytes of %d"
AOTMetaspace::report_loading_error("The %s's ObjectAlignmentInBytes of %d"
" does not equal the current ObjectAlignmentInBytes of %d.",
file_type, _obj_alignment, ObjectAlignmentInBytes);
return false;
}
if (_compact_strings != CompactStrings) {
MetaspaceShared::report_loading_error("The %s's CompactStrings setting (%s)"
AOTMetaspace::report_loading_error("The %s's CompactStrings setting (%s)"
" does not equal the current CompactStrings setting (%s).", file_type,
_compact_strings ? "enabled" : "disabled",
CompactStrings ? "enabled" : "disabled");
@ -1949,46 +1949,46 @@ bool FileMapHeader::validate() {
(compiler_type == CompilerType::compiler_none);
if (!intepreter_is_used &&
jvmci_compiler_is_enabled != (archive_compiler_type == CompilerType::compiler_jvmci)) {
MetaspaceShared::report_loading_error("The %s's JIT compiler setting (%s)"
AOTMetaspace::report_loading_error("The %s's JIT compiler setting (%s)"
" does not equal the current setting (%s).", file_type,
compilertype2name(archive_compiler_type), compilertype2name(compiler_type));
return false;
}
if (TrainingData::have_data()) {
if (_type_profile_level != TypeProfileLevel) {
MetaspaceShared::report_loading_error("The %s's TypeProfileLevel setting (%d)"
AOTMetaspace::report_loading_error("The %s's TypeProfileLevel setting (%d)"
" does not equal the current TypeProfileLevel setting (%d).", file_type,
_type_profile_level, TypeProfileLevel);
return false;
}
if (_type_profile_args_limit != TypeProfileArgsLimit) {
MetaspaceShared::report_loading_error("The %s's TypeProfileArgsLimit setting (%d)"
AOTMetaspace::report_loading_error("The %s's TypeProfileArgsLimit setting (%d)"
" does not equal the current TypeProfileArgsLimit setting (%d).", file_type,
_type_profile_args_limit, TypeProfileArgsLimit);
return false;
}
if (_type_profile_parms_limit != TypeProfileParmsLimit) {
MetaspaceShared::report_loading_error("The %s's TypeProfileParamsLimit setting (%d)"
AOTMetaspace::report_loading_error("The %s's TypeProfileParamsLimit setting (%d)"
" does not equal the current TypeProfileParamsLimit setting (%d).", file_type,
_type_profile_args_limit, TypeProfileArgsLimit);
return false;
}
if (_type_profile_width != TypeProfileWidth) {
MetaspaceShared::report_loading_error("The %s's TypeProfileWidth setting (%d)"
AOTMetaspace::report_loading_error("The %s's TypeProfileWidth setting (%d)"
" does not equal the current TypeProfileWidth setting (%d).", file_type,
(int)_type_profile_width, (int)TypeProfileWidth);
return false;
}
if (_bci_profile_width != BciProfileWidth) {
MetaspaceShared::report_loading_error("The %s's BciProfileWidth setting (%d)"
AOTMetaspace::report_loading_error("The %s's BciProfileWidth setting (%d)"
" does not equal the current BciProfileWidth setting (%d).", file_type,
(int)_bci_profile_width, (int)BciProfileWidth);
return false;
}
if (_type_profile_casts != TypeProfileCasts) {
MetaspaceShared::report_loading_error("The %s's TypeProfileCasts setting (%s)"
AOTMetaspace::report_loading_error("The %s's TypeProfileCasts setting (%s)"
" does not equal the current TypeProfileCasts setting (%s).", file_type,
_type_profile_casts ? "enabled" : "disabled",
TypeProfileCasts ? "enabled" : "disabled");
@ -1997,7 +1997,7 @@ bool FileMapHeader::validate() {
}
if (_profile_traps != ProfileTraps) {
MetaspaceShared::report_loading_error("The %s's ProfileTraps setting (%s)"
AOTMetaspace::report_loading_error("The %s's ProfileTraps setting (%s)"
" does not equal the current ProfileTraps setting (%s).", file_type,
_profile_traps ? "enabled" : "disabled",
ProfileTraps ? "enabled" : "disabled");
@ -2005,7 +2005,7 @@ bool FileMapHeader::validate() {
return false;
}
if (_spec_trap_limit_extra_entries != SpecTrapLimitExtraEntries) {
MetaspaceShared::report_loading_error("The %s's SpecTrapLimitExtraEntries setting (%d)"
AOTMetaspace::report_loading_error("The %s's SpecTrapLimitExtraEntries setting (%d)"
" does not equal the current SpecTrapLimitExtraEntries setting (%d).", file_type,
_spec_trap_limit_extra_entries, SpecTrapLimitExtraEntries);
return false;
@ -2018,7 +2018,7 @@ bool FileMapHeader::validate() {
const char* prop = Arguments::get_property("java.system.class.loader");
if (prop != nullptr) {
if (has_aot_linked_classes()) {
MetaspaceShared::report_loading_error("%s has aot-linked classes. It cannot be used when the "
AOTMetaspace::report_loading_error("%s has aot-linked classes. It cannot be used when the "
"java.system.class.loader property is specified.",
CDSConfig::type_of_archive_being_loaded());
return false;
@ -2032,7 +2032,7 @@ bool FileMapHeader::validate() {
if (!_verify_local && BytecodeVerificationLocal) {
// we cannot load boot classes, so there's no point of using the CDS archive
MetaspaceShared::report_loading_error("The %s's BytecodeVerificationLocal setting (%s)"
AOTMetaspace::report_loading_error("The %s's BytecodeVerificationLocal setting (%s)"
" does not equal the current BytecodeVerificationLocal setting (%s).", file_type,
_verify_local ? "enabled" : "disabled",
BytecodeVerificationLocal ? "enabled" : "disabled");
@ -2056,7 +2056,7 @@ bool FileMapHeader::validate() {
// Note: _allow_archiving_with_java_agent is set in the shared archive during dump time
// while AllowArchivingWithJavaAgent is set during the current run.
if (_allow_archiving_with_java_agent && !AllowArchivingWithJavaAgent) {
MetaspaceShared::report_loading_error("The setting of the AllowArchivingWithJavaAgent is different "
AOTMetaspace::report_loading_error("The setting of the AllowArchivingWithJavaAgent is different "
"from the setting in the %s.", file_type);
return false;
}

View File

@ -25,8 +25,8 @@
#ifndef SHARE_CDS_FILEMAP_HPP
#define SHARE_CDS_FILEMAP_HPP
#include "cds/aotMetaspace.hpp"
#include "cds/archiveUtils.hpp"
#include "cds/metaspaceShared.hpp"
#include "include/cds.h"
#include "logging/logLevel.hpp"
#include "memory/allocation.hpp"
@ -71,7 +71,7 @@ public:
size_t mapping_offset() const { return _mapping_offset; }
size_t mapping_end_offset() const { return _mapping_offset + used_aligned(); }
size_t used() const { return _used; }
size_t used_aligned() const; // aligned up to MetaspaceShared::core_region_alignment()
size_t used_aligned() const; // aligned up to AOTMetaspace::core_region_alignment()
char* mapped_base() const { return _mapped_base; }
char* mapped_end() const { return mapped_base() + used_aligned(); }
bool read_only() const { return _read_only != 0; }

View File

@ -184,7 +184,7 @@ void FinalImageRecipes::load_all_classes(TRAPS) {
log_error(aot)("Unable to resolve class from CDS archive: %s", ik->external_name());
log_error(aot)("Expected: " INTPTR_FORMAT ", actual: " INTPTR_FORMAT, p2i(ik), p2i(actual));
log_error(aot)("Please check if your VM command-line is the same as in the training run");
MetaspaceShared::unrecoverable_writing_error();
AOTMetaspace::unrecoverable_writing_error();
}
assert(ik->is_loaded(), "must be");
ik->link_class(CHECK);
@ -208,7 +208,7 @@ void FinalImageRecipes::apply_recipes(TRAPS) {
log_error(aot)("%s: %s", PENDING_EXCEPTION->klass()->external_name(),
java_lang_String::as_utf8_string(java_lang_Throwable::message(PENDING_EXCEPTION)));
log_error(aot)("Please check if your VM command-line is the same as in the training run");
MetaspaceShared::unrecoverable_writing_error("Unexpected exception, use -Xlog:aot,exceptions=trace for detail");
AOTMetaspace::unrecoverable_writing_error("Unexpected exception, use -Xlog:aot,exceptions=trace for detail");
}
}

View File

@ -26,6 +26,7 @@
#include "cds/aotClassInitializer.hpp"
#include "cds/aotClassLocation.hpp"
#include "cds/aotLogging.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/aotReferenceObjSupport.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/archiveHeapLoader.hpp"
@ -35,7 +36,6 @@
#include "cds/cdsEnumKlass.hpp"
#include "cds/cdsHeapVerifier.hpp"
#include "cds/heapShared.hpp"
#include "cds/metaspaceShared.hpp"
#include "cds/regeneratedClasses.hpp"
#include "classfile/classLoaderData.hpp"
#include "classfile/javaClasses.inline.hpp"
@ -873,7 +873,7 @@ void KlassSubGraphInfo::check_allowed_klass(InstanceKlass* ik) {
ResourceMark rm;
log_error(aot, heap)("Class %s not allowed in archive heap. Must be in java.base%s%s",
ik->external_name(), lambda_msg, testcls_msg);
MetaspaceShared::unrecoverable_writing_error();
AOTMetaspace::unrecoverable_writing_error();
}
bool KlassSubGraphInfo::is_non_early_klass(Klass* k) {
@ -1509,7 +1509,7 @@ bool HeapShared::walk_one_object(PendingOopStack* stack, int level, KlassSubGrap
ResourceMark rm;
log_error(aot, heap)("Cannot archive object " PTR_FORMAT " of class %s", p2i(orig_obj), orig_obj->klass()->external_name());
debug_trace();
MetaspaceShared::unrecoverable_writing_error();
AOTMetaspace::unrecoverable_writing_error();
}
if (log_is_enabled(Debug, aot, heap) && java_lang_Class::is_instance(orig_obj)) {
@ -1562,7 +1562,7 @@ bool HeapShared::walk_one_object(PendingOopStack* stack, int level, KlassSubGrap
// defined at the top of this file.
log_error(aot, heap)("(%d) Unknown java.lang.Class object is in the archived sub-graph", level);
debug_trace();
MetaspaceShared::unrecoverable_writing_error();
AOTMetaspace::unrecoverable_writing_error();
}
}
@ -1592,7 +1592,7 @@ bool HeapShared::walk_one_object(PendingOopStack* stack, int level, KlassSubGrap
// We don't know how to handle an object that has been archived, but some of its reachable
// objects cannot be archived. Bail out for now. We might need to fix this in the future if
// we have a real use case.
MetaspaceShared::unrecoverable_writing_error();
AOTMetaspace::unrecoverable_writing_error();
}
}
}

View File

@ -25,8 +25,8 @@
#ifndef SHARE_CDS_HEAPSHARED_HPP
#define SHARE_CDS_HEAPSHARED_HPP
#include "cds/aotMetaspace.hpp"
#include "cds/dumpTimeClassInfo.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/compactHashtable.hpp"
#include "classfile/javaClasses.hpp"
#include "gc/shared/gc_globals.hpp"
@ -432,7 +432,7 @@ private:
static void init_scratch_objects_for_basic_type_mirrors(TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
static void init_box_classes(TRAPS) NOT_CDS_JAVA_HEAP_RETURN;
static bool is_heap_region(int idx) {
CDS_JAVA_HEAP_ONLY(return (idx == MetaspaceShared::hp);)
CDS_JAVA_HEAP_ONLY(return (idx == AOTMetaspace::hp);)
NOT_CDS_JAVA_HEAP_RETURN_(false);
}

View File

@ -23,10 +23,10 @@
*/
#include "cds/aotClassFilter.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/lambdaFormInvokers.inline.hpp"
#include "cds/metaspaceShared.hpp"
#include "cds/regeneratedClasses.hpp"
#include "classfile/classFileStream.hpp"
#include "classfile/classLoadInfo.hpp"
@ -219,7 +219,7 @@ void LambdaFormInvokers::regenerate_class(char* class_name, ClassFileStream& st,
result->add_to_hierarchy(THREAD);
// new class not linked yet.
MetaspaceShared::try_link_class(THREAD, result);
AOTMetaspace::try_link_class(THREAD, result);
assert(!HAS_PENDING_EXCEPTION, "Invariant");
result->set_is_generated_shared_class();

View File

@ -25,8 +25,8 @@
#ifndef SHARE_CDS_LAMBDAPROXYCLASSINFO_HPP
#define SHARE_CDS_LAMBDAPROXYCLASSINFO_HPP
#include "cds/aotMetaspace.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/javaClasses.hpp"
#include "memory/metaspaceClosure.hpp"
#include "utilities/growableArray.hpp"

View File

@ -75,7 +75,7 @@ void RunTimeClassInfo::init(DumpTimeClassInfo& info) {
}
InstanceKlass* RunTimeClassInfo::klass() const {
if (MetaspaceShared::in_aot_cache(this)) {
if (AOTMetaspace::in_aot_cache(this)) {
// <this> is inside a mmaped CDS archive.
return ArchiveUtils::offset_to_archived_address<InstanceKlass*>(_klass_offset);
} else {

View File

@ -25,10 +25,10 @@
#ifndef SHARE_CDS_RUNTIMECLASSINFO_HPP
#define SHARE_CDS_RUNTIMECLASSINFO_HPP
#include "cds/aotMetaspace.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/archiveUtils.hpp"
#include "cds/cds_globals.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/compactHashtable.hpp"
#include "classfile/javaClasses.hpp"
#include "memory/metaspaceClosure.hpp"

View File

@ -22,12 +22,12 @@
*
*/
#include "cds/aotMetaspace.hpp"
#include "cds/aotReferenceObjSupport.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"
#include "classfile/classLoaderData.inline.hpp"
#include "classfile/javaClasses.inline.hpp"

View File

@ -23,9 +23,9 @@
*/
#include "cds/aotLogging.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/classFileParser.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderData.inline.hpp"
@ -601,21 +601,21 @@ void Modules::ArchivedProperty::runtime_check() const {
bool disable = false;
if (runtime_value == nullptr) {
if (_archived_value != nullptr) {
MetaspaceShared::report_loading_error("Mismatched values for property %s: %s specified during dump time but not during runtime", _prop, _archived_value);
AOTMetaspace::report_loading_error("Mismatched values for property %s: %s specified during dump time but not during runtime", _prop, _archived_value);
disable = true;
}
} else {
if (_archived_value == nullptr) {
MetaspaceShared::report_loading_error("Mismatched values for property %s: %s specified during runtime but not during dump time", _prop, runtime_value);
AOTMetaspace::report_loading_error("Mismatched values for property %s: %s specified during runtime but not during dump time", _prop, runtime_value);
disable = true;
} else if (strcmp(runtime_value, _archived_value) != 0) {
MetaspaceShared::report_loading_error("Mismatched values for property %s: runtime %s dump time %s", _prop, runtime_value, _archived_value);
AOTMetaspace::report_loading_error("Mismatched values for property %s: runtime %s dump time %s", _prop, runtime_value, _archived_value);
disable = true;
}
}
if (disable) {
MetaspaceShared::report_loading_error("Disabling optimized module handling");
AOTMetaspace::report_loading_error("Disabling optimized module handling");
CDSConfig::stop_using_optimized_module_handling();
}
}

View File

@ -993,7 +993,7 @@ void StringTable::allocate_shared_strings_array(TRAPS) {
// refer to more than 16384 * 16384 = 26M interned strings! Not a practical concern
// but bail out for safety.
log_error(aot)("Too many strings to be archived: %zu", items_count_acquire());
MetaspaceShared::unrecoverable_writing_error();
AOTMetaspace::unrecoverable_writing_error();
}
objArrayOop primary = oopFactory::new_objArray(vmClasses::Object_klass(), primary_array_length, CHECK);

View File

@ -146,7 +146,7 @@ public:
"refcount %d", value.refcount());
#if INCLUDE_CDS
if (CDSConfig::is_dumping_static_archive()) {
// We have allocated with MetaspaceShared::symbol_space_alloc(). No deallocation is needed.
// We have allocated with AOTMetaspace::symbol_space_alloc(). No deallocation is needed.
// Unreferenced Symbols will not be copied into the archive.
return;
}
@ -185,7 +185,7 @@ private:
// the archived symbol of "java/lang/Object" may sometimes be lower than "java/lang/String", and
// sometimes be higher. This would cause non-deterministic contents in the archive.
DEBUG_ONLY(static void* last = nullptr);
void* p = (void*)MetaspaceShared::symbol_space_alloc(alloc_size);
void* p = (void*)AOTMetaspace::symbol_space_alloc(alloc_size);
assert(p > last, "must increase monotonically");
DEBUG_ONLY(last = p);
return p;

View File

@ -2001,7 +2001,7 @@ void SystemDictionary::restore_archived_method_handle_intrinsics() {
}
void SystemDictionary::restore_archived_method_handle_intrinsics_impl(TRAPS) {
Array<Method*>* list = MetaspaceShared::archived_method_handle_intrinsics();
Array<Method*>* list = AOTMetaspace::archived_method_handle_intrinsics();
for (int i = 0; i < list->length(); i++) {
methodHandle m(THREAD, list->at(i));
Method::restore_archived_method_handle_intrinsic(m, CHECK);

View File

@ -26,6 +26,7 @@
#include "cds/aotClassFilter.hpp"
#include "cds/aotClassLocation.hpp"
#include "cds/aotLogging.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/archiveBuilder.hpp"
#include "cds/archiveUtils.hpp"
#include "cds/cdsConfig.hpp"
@ -38,7 +39,6 @@
#include "cds/heapShared.hpp"
#include "cds/lambdaFormInvokers.inline.hpp"
#include "cds/lambdaProxyClassDictionary.hpp"
#include "cds/metaspaceShared.hpp"
#include "cds/runTimeClassInfo.hpp"
#include "cds/unregisteredClasses.hpp"
#include "classfile/classFileStream.hpp"
@ -205,7 +205,7 @@ DumpTimeClassInfo* SystemDictionaryShared::get_info_locked(InstanceKlass* k) {
}
bool SystemDictionaryShared::check_for_exclusion(InstanceKlass* k, DumpTimeClassInfo* info) {
if (CDSConfig::is_dumping_dynamic_archive() && MetaspaceShared::in_aot_cache(k)) {
if (CDSConfig::is_dumping_dynamic_archive() && AOTMetaspace::in_aot_cache(k)) {
// We have reached a super type that's already in the base archive. Treat it
// as "not excluded".
return false;
@ -300,7 +300,7 @@ bool SystemDictionaryShared::check_for_exclusion_impl(InstanceKlass* k) {
if (has_class_failed_verification(k)) {
return warn_excluded(k, "Failed verification");
} else if (CDSConfig::is_dumping_aot_linked_classes()) {
// Most loaded classes should have been speculatively linked by MetaspaceShared::link_class_for_cds().
// Most loaded classes should have been speculatively linked by AOTMetaspace::link_class_for_cds().
// However, we do not speculatively link old classes, as they are not recorded by
// SystemDictionaryShared::record_linking_constraint(). As a result, such an unlinked
// class may fail to verify in AOTLinkedClassBulkLoader::init_required_classes_for_loader(),
@ -691,7 +691,7 @@ bool SystemDictionaryShared::should_be_excluded(Klass* k) {
return check_for_exclusion(ik, p);
} else {
// No need to check for is_linked() as all eligible classes should have
// already been linked in MetaspaceShared::link_class_for_cds().
// already been linked in AOTMetaspace::link_class_for_cds().
// Can't take the lock as we are in safepoint.
DumpTimeClassInfo* p = _dumptime_table->get(ik);
if (p->is_excluded()) {
@ -1124,7 +1124,7 @@ SystemDictionaryShared::find_record(RunTimeSharedDictionary* static_dict, RunTim
}
}
if (!MetaspaceShared::in_aot_cache_dynamic_region(name)) {
if (!AOTMetaspace::in_aot_cache_dynamic_region(name)) {
// The names of all shared classes in the static dict must also be in the
// static archive
record = static_dict->lookup(name, hash, 0);

View File

@ -25,10 +25,10 @@
#include "asm/macroAssembler.hpp"
#include "cds/aotCacheAccess.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/cds_globals.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/heapShared.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/javaAssertions.hpp"
#include "code/aotCodeCache.hpp"
#include "code/codeCache.hpp"
@ -96,7 +96,7 @@ static void report_store_failure() {
// where we set number of compiler threads for AOT assembly phase.
//
// 3. We determine presence of AOT code in AOT Cache in
// MetaspaceShared::open_static_archive() which is calles
// AOTMetaspace::open_static_archive() which is calles
// after compilationPolicy_init() but before codeCache_init().
//
// 4. AOTCodeCache::initialize() is called during universe_init()
@ -165,7 +165,7 @@ uint AOTCodeCache::max_aot_code_size() {
return _max_aot_code_size;
}
// It is called from MetaspaceShared::initialize_shared_spaces()
// It is called from AOTMetaspace::initialize_shared_spaces()
// which is called from universe_init().
// At this point all AOT class linking seetings are finilized
// and AOT cache is open so we can map AOT code region.

View File

@ -35,7 +35,7 @@
//
// Also, this is a C header file. Do not use C++ here.
#define NUM_CDS_REGIONS 5 // this must be the same as MetaspaceShared::n_regions
#define NUM_CDS_REGIONS 5 // this must be the same as AOTMetaspace::n_regions
#define CDS_ARCHIVE_MAGIC 0xf00baba2
#define CDS_DYNAMIC_ARCHIVE_MAGIC 0xf00baba8
#define CDS_PREIMAGE_ARCHIVE_MAGIC 0xcafea07c
@ -72,7 +72,7 @@ typedef struct CDSFileMapRegion {
size_t _ptrmap_size_in_bits;
char* _mapped_base; // Actually mapped address used for mapping the core regions. At that address the
// zero nklass protection zone is established; following that (at offset
// MetaspaceShared::protection_zone_size()) the lowest core region (rw for the
// AOTMetaspace::protection_zone_size()) the lowest core region (rw for the
// static archive) is is mapped.
bool _in_reserved_space; // Is this region in a ReservedSpace
} CDSFileMapRegion;

View File

@ -23,7 +23,7 @@
*/
#include "asm/macroAssembler.inline.hpp"
#include "cds/metaspaceShared.hpp"
#include "cds/aotMetaspace.hpp"
#include "compiler/disassembler.hpp"
#include "interpreter/bytecodeHistogram.hpp"
#include "interpreter/bytecodeStream.hpp"

View File

@ -22,8 +22,8 @@
*
*/
#include "cds/aotMetaspace.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/vmClasses.hpp"
#include "interpreter/bytecodes.hpp"
#include "interpreter/bytecodeStream.hpp"

View File

@ -24,8 +24,8 @@
*
*/
#include "cds/aotMetaspace.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/classLoaderData.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "logging/log.hpp"
@ -721,7 +721,7 @@ void Metaspace::global_initialize() {
metaspace::ChunkHeaderPool::initialize();
if (CDSConfig::is_dumping_static_archive()) {
MetaspaceShared::initialize_for_static_dump();
AOTMetaspace::initialize_for_static_dump();
}
// If UseCompressedClassPointers=1, we have two cases:
@ -740,7 +740,7 @@ void Metaspace::global_initialize() {
if (!FLAG_IS_DEFAULT(CompressedClassSpaceBaseAddress)) {
log_warning(metaspace)("CDS active - ignoring CompressedClassSpaceBaseAddress.");
}
MetaspaceShared::initialize_runtime_shared_and_meta_spaces();
AOTMetaspace::initialize_runtime_shared_and_meta_spaces();
// If any of the archived space fails to map, UseSharedSpaces
// is reset to false.
}
@ -853,7 +853,7 @@ void Metaspace::global_initialize() {
LogTarget(Info, gc, metaspace) lt;
if (lt.is_enabled()) {
LogStream ls(lt);
CDS_ONLY(MetaspaceShared::print_on(&ls);)
CDS_ONLY(AOTMetaspace::print_on(&ls);)
Metaspace::print_compressed_class_space(&ls);
CompressedKlassPointers::print_mode(&ls);
}
@ -1037,7 +1037,7 @@ void Metaspace::purge(bool classes_unloaded) {
// Returns true if pointer points into one of the metaspace regions, or
// into the class space.
bool Metaspace::in_aot_cache(const void* ptr) {
return MetaspaceShared::in_aot_cache(ptr);
return AOTMetaspace::in_aot_cache(ptr);
}
// Returns true if pointer points into one of the non-class-space metaspace regions.

View File

@ -31,7 +31,7 @@
#include "utilities/globalDefinitions.hpp"
class ClassLoaderData;
class MetaspaceShared;
class AOTMetaspace;
class MetaspaceTracer;
class Mutex;
class outputStream;
@ -43,7 +43,7 @@ class ReservedSpace;
// (auxiliary stuff goes into MetaspaceUtils)
class Metaspace : public AllStatic {
friend class MetaspaceShared;
friend class AOTMetaspace;
public:
enum MetadataType {

View File

@ -22,11 +22,11 @@
*
*/
#include "cds/aotMetaspace.hpp"
#include "cds/archiveHeapLoader.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/dynamicArchive.hpp"
#include "cds/heapShared.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/classLoaderDataShared.hpp"
@ -878,7 +878,7 @@ jint universe_init() {
ObjLayout::initialize();
#ifdef _LP64
MetaspaceShared::adjust_heap_sizes_for_dumping();
AOTMetaspace::adjust_heap_sizes_for_dumping();
#endif // _LP64
GCConfig::arguments()->initialize_heap_sizes();
@ -904,7 +904,7 @@ jint universe_init() {
if (CDSConfig::is_using_archive()) {
// Read the data structures supporting the shared spaces (shared
// system dictionary, symbol table, etc.)
MetaspaceShared::initialize_shared_spaces();
AOTMetaspace::initialize_shared_spaces();
}
#endif
@ -1161,7 +1161,7 @@ bool universe_post_init() {
MemoryService::set_universe_heap(Universe::heap());
#if INCLUDE_CDS
MetaspaceShared::post_initialize(CHECK_false);
AOTMetaspace::post_initialize(CHECK_false);
#endif
return true;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2025, 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
@ -54,7 +54,7 @@ class Universe: AllStatic {
friend class VMStructs;
friend class VM_PopulateDumpSharedSpace;
friend class Metaspace;
friend class MetaspaceShared;
friend class AOTMetaspace;
friend class vmClasses;
friend jint universe_init();

View File

@ -22,8 +22,8 @@
*
*/
#include "cds/aotMetaspace.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/moduleEntry.hpp"
#include "classfile/vmClasses.hpp"
@ -259,9 +259,9 @@ void ArrayKlass::log_array_class_load(Klass* k) {
LogStream ls(lt);
ResourceMark rm;
ls.print("%s", k->name()->as_klass_external_name());
if (MetaspaceShared::in_aot_cache_dynamic_region((void*)k)) {
if (AOTMetaspace::in_aot_cache_dynamic_region((void*)k)) {
ls.print(" source: shared objects file (top)");
} else if (MetaspaceShared::in_aot_cache_static_region((void*)k)) {
} else if (AOTMetaspace::in_aot_cache_static_region((void*)k)) {
ls.print(" source: shared objects file");
}
ls.cr();

View File

@ -23,12 +23,12 @@
*/
#include "cds/aotClassInitializer.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/archiveUtils.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/cdsEnumKlass.hpp"
#include "cds/classListWriter.hpp"
#include "cds/heapShared.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/classFileParser.hpp"
#include "classfile/classFileStream.hpp"
#include "classfile/classLoader.hpp"
@ -2763,7 +2763,7 @@ void InstanceKlass::init_shared_package_entry() {
}
} else if (CDSConfig::is_dumping_dynamic_archive() &&
CDSConfig::is_using_full_module_graph() &&
MetaspaceShared::in_aot_cache(_package_entry)) {
AOTMetaspace::in_aot_cache(_package_entry)) {
// _package_entry is an archived package in the base archive. Leave it as is.
} else {
_package_entry = nullptr;
@ -2845,7 +2845,7 @@ void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handl
// retrieved during dump time.
// Verification of archived old classes will be performed during run time.
bool InstanceKlass::can_be_verified_at_dumptime() const {
if (MetaspaceShared::in_aot_cache(this)) {
if (AOTMetaspace::in_aot_cache(this)) {
// This is a class that was dumped into the base archive, so we know
// it was verified at dump time.
return true;
@ -3088,7 +3088,7 @@ void InstanceKlass::set_package(ClassLoaderData* loader_data, PackageEntry* pkg_
if (in_aot_cache() && _package_entry != nullptr) {
if (CDSConfig::is_using_full_module_graph() && _package_entry == pkg_entry) {
// we can use the saved package
assert(MetaspaceShared::in_aot_cache(_package_entry), "must be");
assert(AOTMetaspace::in_aot_cache(_package_entry), "must be");
return;
} else {
_package_entry = nullptr;
@ -3971,7 +3971,7 @@ void InstanceKlass::print_class_load_helper(ClassLoaderData* loader_data,
}
} else {
assert(this->in_aot_cache(), "must be");
if (MetaspaceShared::in_aot_cache_dynamic_region((void*)this)) {
if (AOTMetaspace::in_aot_cache_dynamic_region((void*)this)) {
info_stream.print(" source: shared objects file (top)");
} else {
info_stream.print(" source: shared objects file");

View File

@ -22,7 +22,7 @@
*
*/
#include "cds/metaspaceShared.hpp"
#include "cds/aotMetaspace.hpp"
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/systemDictionary.hpp"
@ -50,7 +50,7 @@ inline InstanceKlass* klassVtable::ik() const {
}
bool klassVtable::is_preinitialized_vtable() {
return _klass->in_aot_cache() && !MetaspaceShared::remapped_readwrite() && _klass->verified_at_dump_time();
return _klass->in_aot_cache() && !AOTMetaspace::remapped_readwrite() && _klass->verified_at_dump_time();
}
@ -1089,8 +1089,8 @@ void itableMethodEntry::initialize(InstanceKlass* klass, Method* m) {
if (m == nullptr) return;
#ifdef ASSERT
if (MetaspaceShared::in_aot_cache((void*)&_method) &&
!MetaspaceShared::remapped_readwrite() &&
if (AOTMetaspace::in_aot_cache((void*)&_method) &&
!AOTMetaspace::remapped_readwrite() &&
m->method_holder()->verified_at_dump_time() &&
klass->verified_at_dump_time()) {
// At runtime initialize_itable is rerun as part of link_class_impl()

View File

@ -22,9 +22,9 @@
*
*/
#include "cds/aotMetaspace.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/cppVtables.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/metadataOnStackMark.hpp"
@ -446,7 +446,7 @@ void Method::restore_unshareable_info(TRAPS) {
#endif
void Method::set_vtable_index(int index) {
if (in_aot_cache() && !MetaspaceShared::remapped_readwrite() && method_holder()->verified_at_dump_time()) {
if (in_aot_cache() && !AOTMetaspace::remapped_readwrite() && method_holder()->verified_at_dump_time()) {
// At runtime initialize_vtable is rerun as part of link_class_impl()
// for a shared class loaded by the non-boot loader to obtain the loader
// constraints based on the runtime classloaders' context.
@ -457,7 +457,7 @@ void Method::set_vtable_index(int index) {
}
void Method::set_itable_index(int index) {
if (in_aot_cache() && !MetaspaceShared::remapped_readwrite() && method_holder()->verified_at_dump_time()) {
if (in_aot_cache() && !AOTMetaspace::remapped_readwrite() && method_holder()->verified_at_dump_time()) {
// At runtime initialize_itable is rerun as part of link_class_impl()
// for a shared class loaded by the non-boot loader to obtain the loader
// constraints based on the runtime classloaders' context. The dumptime

View File

@ -23,7 +23,6 @@
*/
#include "cds/archiveBuilder.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/altHashing.hpp"
#include "classfile/classLoaderData.hpp"
#include "classfile/vmSymbols.hpp"

View File

@ -23,7 +23,6 @@
*/
#include "cds/cdsConfig.hpp"
#include "cds/metaspaceShared.hpp"
#include "ci/ciEnv.hpp"
#include "ci/ciMetadata.hpp"
#include "classfile/classLoaderData.hpp"

View File

@ -23,6 +23,7 @@
*/
#include "cds/aotClassInitializer.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/classListParser.hpp"
#include "cds/classListWriter.hpp"
@ -3503,7 +3504,7 @@ JVM_ENTRY(void, JVM_DumpClassListToFile(JNIEnv *env, jstring listFileName))
ResourceMark rm(THREAD);
Handle file_handle(THREAD, JNIHandles::resolve_non_null(listFileName));
char* file_name = java_lang_String::as_utf8_string(file_handle());
MetaspaceShared::dump_loaded_classes(file_name, THREAD);
AOTMetaspace::dump_loaded_classes(file_name, THREAD);
#endif // INCLUDE_CDS
JVM_END

View File

@ -22,8 +22,8 @@
*
*/
#include "cds/aotMetaspace.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/classFileStream.hpp"
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/classLoadInfo.hpp"
@ -254,7 +254,7 @@ void VM_RedefineClasses::doit() {
// shared readwrite, private just in case we need to redefine
// a shared class. We do the remap during the doit() phase of
// the safepoint to be safer.
if (!MetaspaceShared::remap_shared_readonly_as_readwrite()) {
if (!AOTMetaspace::remap_shared_readonly_as_readwrite()) {
log_info(redefine, class, load)("failed to remap shared readonly space to readwrite, private");
_res = JVMTI_ERROR_INTERNAL;
_timer_vm_op_doit.stop();

View File

@ -23,11 +23,11 @@
*/
#include "cds.h"
#include "cds/aotMetaspace.hpp"
#include "cds/archiveHeapLoader.hpp"
#include "cds/cdsConstants.hpp"
#include "cds/filemap.hpp"
#include "cds/heapShared.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/classLoaderDataGraph.hpp"
#include "classfile/classLoaderStats.hpp"
@ -1884,9 +1884,9 @@ WB_ENTRY(jlong, WB_MetaspaceCapacityUntilGC(JNIEnv* env, jobject wb))
WB_END
// The function is only valid when CDS is available.
WB_ENTRY(jlong, WB_MetaspaceSharedRegionAlignment(JNIEnv* env, jobject wb))
WB_ENTRY(jlong, WB_AOTMetaspaceRegionAlignment(JNIEnv* env, jobject wb))
#if INCLUDE_CDS
return (jlong)MetaspaceShared::core_region_alignment();
return (jlong)AOTMetaspace::core_region_alignment();
#else
ShouldNotReachHere();
return 0L;
@ -2154,7 +2154,7 @@ WB_ENTRY(jboolean, WB_IsSharedInternedString(JNIEnv* env, jobject wb, jobject st
WB_END
WB_ENTRY(jboolean, WB_IsSharedClass(JNIEnv* env, jobject wb, jclass clazz))
return (jboolean)MetaspaceShared::in_aot_cache(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
return (jboolean)AOTMetaspace::in_aot_cache(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)));
WB_END
WB_ENTRY(jboolean, WB_AreSharedStringsMapped(JNIEnv* env))
@ -2887,7 +2887,7 @@ static JNINativeMethod methods[] = {
CC"(Ljava/lang/ClassLoader;J)J", (void*)&WB_AllocateMetaspace },
{CC"incMetaspaceCapacityUntilGC", CC"(J)J", (void*)&WB_IncMetaspaceCapacityUntilGC },
{CC"metaspaceCapacityUntilGC", CC"()J", (void*)&WB_MetaspaceCapacityUntilGC },
{CC"metaspaceSharedRegionAlignment", CC"()J", (void*)&WB_MetaspaceSharedRegionAlignment },
{CC"metaspaceSharedRegionAlignment", CC"()J", (void*)&WB_AOTMetaspaceRegionAlignment },
{CC"getCPUFeatures", CC"()Ljava/lang/String;", (void*)&WB_GetCPUFeatures },
{CC"getNMethod0", CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;",
(void*)&WB_GetNMethod },

View File

@ -22,6 +22,7 @@
*
*/
#include "cds/aotMetaspace.hpp"
#include "cds/cds_globals.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/classListWriter.hpp"
@ -449,7 +450,7 @@ void before_exit(JavaThread* thread, bool halt) {
ClassListWriter::write_resolved_constants();
if (CDSConfig::is_dumping_preimage_static_archive()) {
MetaspaceShared::preload_and_dump(thread);
AOTMetaspace::preload_and_dump(thread);
}
#endif

View File

@ -25,10 +25,10 @@
*/
#include "cds/aotLinkedClassBulkLoader.hpp"
#include "cds/aotMetaspace.hpp"
#include "cds/cds_globals.hpp"
#include "cds/cdsConfig.hpp"
#include "cds/heapShared.hpp"
#include "cds/metaspaceShared.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/javaThreadStatus.hpp"
@ -889,10 +889,10 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
if (CDSConfig::is_dumping_classic_static_archive()) {
// Classic -Xshare:dump, aka "old workflow"
MetaspaceShared::preload_and_dump(CHECK_JNI_ERR);
AOTMetaspace::preload_and_dump(CHECK_JNI_ERR);
} else if (CDSConfig::is_dumping_final_static_archive()) {
tty->print_cr("Reading AOTConfiguration %s and writing AOTCache %s", AOTConfiguration, AOTCache);
MetaspaceShared::preload_and_dump(CHECK_JNI_ERR);
AOTMetaspace::preload_and_dump(CHECK_JNI_ERR);
}
if (log_is_enabled(Info, perf, class, link)) {

View File

@ -24,7 +24,7 @@
*
*/
#include "cds/metaspaceShared.hpp"
#include "cds/aotMetaspace.hpp"
#include "code/codeCache.hpp"
#include "compiler/compilationFailureInfo.hpp"
#include "compiler/compilationMemoryStatistic.hpp"
@ -1199,7 +1199,7 @@ void VMError::report(outputStream* st, bool _verbose) {
st->cr();
STEP_IF("printing compressed klass pointers mode", _verbose && UseCompressedClassPointers)
CDS_ONLY(MetaspaceShared::print_on(st);)
CDS_ONLY(AOTMetaspace::print_on(st);)
Metaspace::print_compressed_class_space(st);
CompressedKlassPointers::print_mode(st);
st->cr();
@ -1414,7 +1414,7 @@ void VMError::print_vm_info(outputStream* st) {
// STEP("printing compressed class ptrs mode")
if (UseCompressedClassPointers) {
CDS_ONLY(MetaspaceShared::print_on(st);)
CDS_ONLY(AOTMetaspace::print_on(st);)
Metaspace::print_compressed_class_space(st);
CompressedKlassPointers::print_mode(st);
st->cr();

View File

@ -59,7 +59,7 @@ public class SpaceUtilizationCheck {
Pattern pattern = Pattern.compile("(..) space: *([0-9]+).* out of *([0-9]+) bytes .* at 0x([0-9a0-f]+)");
WhiteBox wb = WhiteBox.getWhiteBox();
long reserve_alignment = wb.metaspaceSharedRegionAlignment();
System.out.println("MetaspaceShared::core_region_alignment() = " + reserve_alignment);
System.out.println("AOTMetaspace::core_region_alignment() = " + reserve_alignment);
// Look for output like this. The pattern will only match the first 2 regions, which is what we need to check
//
@ -90,7 +90,7 @@ public class SpaceUtilizationCheck {
}
if (unused > reserve_alignment) {
// [1] Check for unused space
throw new RuntimeException("Unused space (" + unused + ") must be smaller than MetaspaceShared::core_region_alignment() (" +
throw new RuntimeException("Unused space (" + unused + ") must be smaller than AOTMetaspace::core_region_alignment() (" +
reserve_alignment + ")");
}
if (last_region >= 0 && address != last_region) {

View File

@ -45,7 +45,7 @@ public class SharedArchiveConsistency {
private static int genericHeaderMinVersion; // minimum supported CDS version
private static int currentCDSArchiveVersion; // current CDS version in java process
// The following should be consistent with the enum in the C++ MetaspaceShared class
// The following should be consistent with the enum in the C++ AOTMetaspace class
public static String[] shared_region_name = {
"rw", // ReadWrite
"ro", // ReadOnly

View File

@ -67,9 +67,9 @@ public class CDSArchiveUtils {
private static int staticArchiveHeaderSize; // static archive file header size
private static int dynamicArchiveHeaderSize; // dynamic archive file header size
private static int cdsFileMapRegionSize; // size of CDSFileMapRegion
private static long alignment; // MetaspaceShared::core_region_alignment
private static long alignment; // AOTMetaspace::core_region_alignment
// The following should be consistent with the enum in the C++ MetaspaceShared class
// The following should be consistent with the enum in the C++ AOTMetaspace class
private static String[] shared_region_name = {
"rw", // ReadWrite
"ro", // ReadOnly