mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8356595: Convert -Xlog:cds to -Xlog:aot (step1)
Reviewed-by: ccheung, dholmes, jsjolen, matsaave
This commit is contained in:
parent
39d8d109dd
commit
7077535c0b
@ -76,11 +76,13 @@ $(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXECUTABLE_SUFFIX) $(CLASSLIST
|
|||||||
$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $(JLI_TRACE_FILE)))
|
$(call LogInfo, Generating $(patsubst $(OUTPUTDIR)/%, %, $(JLI_TRACE_FILE)))
|
||||||
$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@.raw \
|
$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@.raw \
|
||||||
$(CLASSLIST_FILE_VM_OPTS) \
|
$(CLASSLIST_FILE_VM_OPTS) \
|
||||||
|
-Xlog:aot=off \
|
||||||
-Xlog:cds=off \
|
-Xlog:cds=off \
|
||||||
-cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
|
-cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
|
||||||
build.tools.classlist.HelloClasslist $(LOG_DEBUG)
|
build.tools.classlist.HelloClasslist $(LOG_DEBUG)
|
||||||
$(GREP) -v HelloClasslist $@.raw > $@.interim
|
$(GREP) -v HelloClasslist $@.raw > $@.interim
|
||||||
$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -Xshare:dump \
|
$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -Xshare:dump \
|
||||||
|
-Xlog:aot=off \
|
||||||
-Xlog:cds=off \
|
-Xlog:cds=off \
|
||||||
-XX:SharedClassListFile=$@.interim -XX:SharedArchiveFile=$@.jsa \
|
-XX:SharedClassListFile=$@.interim -XX:SharedArchiveFile=$@.jsa \
|
||||||
-Xmx128M -Xms128M $(LOG_INFO)
|
-Xmx128M -Xms128M $(LOG_INFO)
|
||||||
@ -89,6 +91,7 @@ $(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXECUTABLE_SUFFIX) $(CLASSLIST
|
|||||||
-Djava.lang.invoke.MethodHandle.TRACE_RESOLVE=true \
|
-Djava.lang.invoke.MethodHandle.TRACE_RESOLVE=true \
|
||||||
$(CLASSLIST_FILE_VM_OPTS) \
|
$(CLASSLIST_FILE_VM_OPTS) \
|
||||||
--module-path $(SUPPORT_OUTPUTDIR)/classlist.jar \
|
--module-path $(SUPPORT_OUTPUTDIR)/classlist.jar \
|
||||||
|
-Xlog:aot=off \
|
||||||
-Xlog:cds=off \
|
-Xlog:cds=off \
|
||||||
-cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
|
-cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
|
||||||
build.tools.classlist.HelloClasslist \
|
build.tools.classlist.HelloClasslist \
|
||||||
@ -103,6 +106,7 @@ $(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXECUTABLE_SUFFIX) $(CLASSLIST
|
|||||||
$(GREP) -v HelloClasslist $@.raw.2 > $@.raw.3
|
$(GREP) -v HelloClasslist $@.raw.2 > $@.raw.3
|
||||||
$(GREP) -v @cp $@.raw.3 > $@.raw.4
|
$(GREP) -v @cp $@.raw.3 > $@.raw.4
|
||||||
$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java \
|
$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java \
|
||||||
|
-Xlog:aot=off \
|
||||||
-Xlog:cds=off \
|
-Xlog:cds=off \
|
||||||
-cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
|
-cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
|
||||||
build.tools.classlist.SortClasslist $@.raw.4 > $@
|
build.tools.classlist.SortClasslist $@.raw.4 > $@
|
||||||
|
|||||||
@ -754,7 +754,7 @@ define SetupAOTBody
|
|||||||
cd $$($1_AOT_JDK_OUTPUT_DIR); \
|
cd $$($1_AOT_JDK_OUTPUT_DIR); \
|
||||||
$(JAR) --extract --file $(TEST_IMAGE_DIR)/setup_aot/TestSetupAOT.jar; \
|
$(JAR) --extract --file $(TEST_IMAGE_DIR)/setup_aot/TestSetupAOT.jar; \
|
||||||
$$(FIXPATH) $(JDK_UNDER_TEST)/bin/java $$($1_VM_OPTIONS) \
|
$$(FIXPATH) $(JDK_UNDER_TEST)/bin/java $$($1_VM_OPTIONS) \
|
||||||
-Xlog:class+load,cds,cds+class=debug:file=$$($1_AOT_JDK_CONF).log -Xlog:cds*=error \
|
-Xlog:class+load,aot,aot+class=debug:file=$$($1_AOT_JDK_CONF).log -Xlog:cds*=error -Xlog:aot*=error \
|
||||||
-XX:AOTMode=record -XX:AOTConfiguration=$$($1_AOT_JDK_CONF) \
|
-XX:AOTMode=record -XX:AOTConfiguration=$$($1_AOT_JDK_CONF) \
|
||||||
TestSetupAOT $$($1_AOT_JDK_OUTPUT_DIR) > $$($1_AOT_JDK_LOG) \
|
TestSetupAOT $$($1_AOT_JDK_OUTPUT_DIR) > $$($1_AOT_JDK_LOG) \
|
||||||
))
|
))
|
||||||
@ -762,7 +762,7 @@ define SetupAOTBody
|
|||||||
$$(call LogWarn, AOT: Generate AOT cache $$($1_AOT_JDK_CACHE) with flags: $$($1_VM_OPTIONS))
|
$$(call LogWarn, AOT: Generate AOT cache $$($1_AOT_JDK_CACHE) with flags: $$($1_VM_OPTIONS))
|
||||||
$$(call ExecuteWithLog, $$($1_AOT_JDK_OUTPUT_DIR), ( \
|
$$(call ExecuteWithLog, $$($1_AOT_JDK_OUTPUT_DIR), ( \
|
||||||
$$(FIXPATH) $(JDK_UNDER_TEST)/bin/java \
|
$$(FIXPATH) $(JDK_UNDER_TEST)/bin/java \
|
||||||
$$($1_VM_OPTIONS) -Xlog:cds,cds+class=debug:file=$$($1_AOT_JDK_CACHE).log -Xlog:cds*=error \
|
$$($1_VM_OPTIONS) -Xlog:aot,aot+class=debug:file=$$($1_AOT_JDK_CACHE).log -Xlog:cds*=error -Xlog:aot*=error \
|
||||||
-XX:ExtraSharedClassListFile=$(JDK_UNDER_TEST)/lib/classlist \
|
-XX:ExtraSharedClassListFile=$(JDK_UNDER_TEST)/lib/classlist \
|
||||||
-XX:AOTMode=create -XX:AOTConfiguration=$$($1_AOT_JDK_CONF) -XX:AOTCache=$$($1_AOT_JDK_CACHE) \
|
-XX:AOTMode=create -XX:AOTConfiguration=$$($1_AOT_JDK_CONF) -XX:AOTCache=$$($1_AOT_JDK_CACHE) \
|
||||||
))
|
))
|
||||||
|
|||||||
@ -97,7 +97,7 @@ void AOTArtifactFinder::find_artifacts() {
|
|||||||
oop orig_mirror = Universe::java_mirror(bt);
|
oop orig_mirror = Universe::java_mirror(bt);
|
||||||
oop scratch_mirror = HeapShared::scratch_java_mirror(bt);
|
oop scratch_mirror = HeapShared::scratch_java_mirror(bt);
|
||||||
HeapShared::scan_java_mirror(orig_mirror);
|
HeapShared::scan_java_mirror(orig_mirror);
|
||||||
log_trace(cds, heap, mirror)(
|
log_trace(aot, heap, mirror)(
|
||||||
"Archived %s mirror object from " PTR_FORMAT,
|
"Archived %s mirror object from " PTR_FORMAT,
|
||||||
type2name(bt), p2i(scratch_mirror));
|
type2name(bt), p2i(scratch_mirror));
|
||||||
Universe::set_archived_basic_type_mirror_index(bt, HeapShared::append_root(scratch_mirror));
|
Universe::set_archived_basic_type_mirror_index(bt, HeapShared::append_root(scratch_mirror));
|
||||||
|
|||||||
@ -113,9 +113,9 @@ void AOTClassLinker::add_new_candidate(InstanceKlass* ik) {
|
|||||||
_candidates->put_when_absent(ik, true);
|
_candidates->put_when_absent(ik, true);
|
||||||
_sorted_candidates->append(ik);
|
_sorted_candidates->append(ik);
|
||||||
|
|
||||||
if (log_is_enabled(Info, cds, aot, link)) {
|
if (log_is_enabled(Info, aot, link)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_info(cds, aot, link)("%s %s %p", class_category_name(ik), ik->external_name(), ik);
|
log_info(aot, link)("%s %s %p", class_category_name(ik), ik->external_name(), ik);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ bool AOTClassLinker::try_add_candidate(InstanceKlass* ik) {
|
|||||||
InstanceKlass* nest_host = ik->nest_host_not_null();
|
InstanceKlass* nest_host = ik->nest_host_not_null();
|
||||||
if (!try_add_candidate(nest_host)) {
|
if (!try_add_candidate(nest_host)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_warning(cds, aot, link)("%s cannot be aot-linked because it nest host is not aot-linked", ik->external_name());
|
log_warning(aot, link)("%s cannot be aot-linked because it nest host is not aot-linked", ik->external_name());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -228,7 +228,7 @@ Array<InstanceKlass*>* AOTClassLinker::write_classes(oop class_loader, bool is_j
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
} else {
|
} else {
|
||||||
const char* category = class_category_name(list.at(0));
|
const char* category = class_category_name(list.at(0));
|
||||||
log_info(cds, aot, link)("wrote %d class(es) for category %s", list.length(), category);
|
log_info(aot, link)("wrote %d class(es) for category %s", list.length(), category);
|
||||||
return ArchiveUtils::archive_array(&list);
|
return ArchiveUtils::archive_array(&list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1029,8 +1029,7 @@ bool AOTClassLocationConfig::validate(bool has_aot_linked_classes, bool* has_ext
|
|||||||
MetaspaceShared::unrecoverable_loading_error();
|
MetaspaceShared::unrecoverable_loading_error();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log_warning(cds)("%s%s", mismatch_msg, hint_msg);
|
MetaspaceShared::report_loading_error("%s%s", mismatch_msg, hint_msg);
|
||||||
MetaspaceShared::report_loading_error(nullptr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
|
|||||||
@ -179,11 +179,11 @@ void AOTLinkedClassBulkLoader::load_classes_impl(AOTLinkedClassCategory class_ca
|
|||||||
|
|
||||||
for (int i = 0; i < classes->length(); i++) {
|
for (int i = 0; i < classes->length(); i++) {
|
||||||
InstanceKlass* ik = classes->at(i);
|
InstanceKlass* ik = classes->at(i);
|
||||||
if (log_is_enabled(Info, cds, aot, load)) {
|
if (log_is_enabled(Info, aot, load)) {
|
||||||
ResourceMark rm(THREAD);
|
ResourceMark rm(THREAD);
|
||||||
log_info(cds, aot, load)("%-5s %s%s%s", category_name, ik->external_name(),
|
log_info(aot, load)("%-5s %s%s%s", category_name, ik->external_name(),
|
||||||
ik->is_loaded() ? " (already loaded)" : "",
|
ik->is_loaded() ? " (already loaded)" : "",
|
||||||
ik->is_hidden() ? " (hidden)" : "");
|
ik->is_hidden() ? " (hidden)" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ik->is_loaded()) {
|
if (!ik->is_loaded()) {
|
||||||
@ -236,11 +236,11 @@ void AOTLinkedClassBulkLoader::initiate_loading(JavaThread* current, const char*
|
|||||||
assert(ik->class_loader() == nullptr ||
|
assert(ik->class_loader() == nullptr ||
|
||||||
ik->class_loader() == SystemDictionary::java_platform_loader(), "must be");
|
ik->class_loader() == SystemDictionary::java_platform_loader(), "must be");
|
||||||
if (ik->is_public() && !ik->is_hidden()) {
|
if (ik->is_public() && !ik->is_hidden()) {
|
||||||
if (log_is_enabled(Info, cds, aot, load)) {
|
if (log_is_enabled(Info, aot, load)) {
|
||||||
ResourceMark rm(current);
|
ResourceMark rm(current);
|
||||||
const char* defining_loader = (ik->class_loader() == nullptr ? "boot" : "plat");
|
const char* defining_loader = (ik->class_loader() == nullptr ? "boot" : "plat");
|
||||||
log_info(cds, aot, load)("%s %s (initiated, defined by %s)", category_name, ik->external_name(),
|
log_info(aot, load)("%s %s (initiated, defined by %s)", category_name, ik->external_name(),
|
||||||
defining_loader);
|
defining_loader);
|
||||||
}
|
}
|
||||||
SystemDictionary::add_to_initiating_loader(current, ik, loader_data);
|
SystemDictionary::add_to_initiating_loader(current, ik, loader_data);
|
||||||
}
|
}
|
||||||
|
|||||||
167
src/hotspot/share/cds/aotLogging.hpp
Normal file
167
src/hotspot/share/cds/aotLogging.hpp
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 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
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SHARE_CDS_AOTLOGGING_HPP
|
||||||
|
#define SHARE_CDS_AOTLOGGING_HPP
|
||||||
|
|
||||||
|
#include "cds/cds_globals.hpp"
|
||||||
|
#include "cds/cdsConfig.hpp"
|
||||||
|
#include "logging/log.hpp"
|
||||||
|
|
||||||
|
// UL Logging for AOT
|
||||||
|
// ==================
|
||||||
|
//
|
||||||
|
// The old "CDS" feature is rebranded as "AOT" in JEP 483. Therefore, UL logging
|
||||||
|
// related to the AOT features should be using the [aot] tag.
|
||||||
|
//
|
||||||
|
// However, some old scripts may be using -Xlog:cds for diagnostic purposes. To
|
||||||
|
// provide a fair amount of backwards compatibility for such scripts, some AOT
|
||||||
|
// logs that are likely to be used by such scripts are printed using the macros
|
||||||
|
// in this header file.
|
||||||
|
//
|
||||||
|
// NOTE: MOST of the AOT logs will be using the usual macros such as log_info(aot)(...).
|
||||||
|
// The information below does NOT apply to such logs.
|
||||||
|
//
|
||||||
|
// CDS Compatibility Logs & Compatibility Macros
|
||||||
|
// =============================================
|
||||||
|
//
|
||||||
|
// A subset of the original CDS logs (the "CDS Compatibility Logs") have been
|
||||||
|
// chosen in JDK 25. These logs are guarded using the aot_log_xxx compatibility
|
||||||
|
// macros. Before JDK 25, such code looked like this:
|
||||||
|
//
|
||||||
|
// log_info(cds)("trying to map %s%s", info, _full_path);
|
||||||
|
// log_warning(cds)("Unable to read the file header.");
|
||||||
|
//
|
||||||
|
// New code since JDK 25:
|
||||||
|
//
|
||||||
|
// aot_log_info(aot)("trying to map %s%s", info, _full_path);
|
||||||
|
// aot_log_warning(aot)("Unable to read the file header.");
|
||||||
|
//
|
||||||
|
// The messages printed with the log_aot_xxx() macros work as if they are
|
||||||
|
// using the [cds] tag when running with the "classic" CDS workflow (i.e.,
|
||||||
|
// new -XX:AOTxxx flags are not used).
|
||||||
|
//
|
||||||
|
// $ java -Xlog:cds -XX:SharedArchiveFile=bad.jsa ...
|
||||||
|
// [0.020s][info][cds] trying to map bad.jsa
|
||||||
|
// [0.020s][warning][cds] Unable to read the file header
|
||||||
|
//
|
||||||
|
// However, when running new AOT flags such as-XX:AOTCache, these messages are
|
||||||
|
// under the [aot] tag:
|
||||||
|
//
|
||||||
|
// $ java -Xlog:aot -XX:AOTCache=bad.aot ...
|
||||||
|
// [0.020s][info][aot] trying to map bad.aot
|
||||||
|
// [0.020s][warning][aot] Unable to read the file header
|
||||||
|
//
|
||||||
|
// Rules on selection and printing
|
||||||
|
//
|
||||||
|
// [1] When using AOT cache
|
||||||
|
// - These logs are selected via the aot tag, and not the cds tag.
|
||||||
|
// They are always printed with [aot] decoration
|
||||||
|
//
|
||||||
|
// [2] When using CDS archives
|
||||||
|
// - These logs are selected via the cds tag, and not the aot tag.
|
||||||
|
// They are always printed with [cds] decoration
|
||||||
|
//
|
||||||
|
// Deprecation Process
|
||||||
|
// ===================
|
||||||
|
//
|
||||||
|
// This is modeled after the deprecate/obsolete/expire process of VM options in arguments.cpp
|
||||||
|
//
|
||||||
|
// JDK 25 - When no -XX:AOTxxx flags are used, the CDS Compatibility Logs must be selected
|
||||||
|
// with -Xlog:cds
|
||||||
|
//
|
||||||
|
// JDK 26 - Same as above, except that when -Xlog:cds is specified in the command-line, a warning
|
||||||
|
// message is printed to indicate that -Xlog:cds is deprecated.
|
||||||
|
//
|
||||||
|
// JDK 27 - The CDS Compatibility Logs must be selected with -Xlog:aot.
|
||||||
|
//
|
||||||
|
// When -Xlog:cds is specified in the command-line, a warning message is printed to
|
||||||
|
// indicate that -Xlog:cds is obsolete.
|
||||||
|
//
|
||||||
|
// JDK 28 - When -Xlog:cds is specified in the command-line, the VM will exit with an error message:
|
||||||
|
//
|
||||||
|
// [0.002s][error][logging] Invalid tag 'cds' in log selection.
|
||||||
|
// Invalid -Xlog option '-Xlog:cds', see error log for details.
|
||||||
|
//
|
||||||
|
|
||||||
|
// The following macros are inspired by the same macros (without the aot_ prefix) in logging/log.hpp
|
||||||
|
|
||||||
|
#define aot_log_is_enabled(level, ...) (AOTLogImpl<LOG_TAGS(__VA_ARGS__)>::is_level(LogLevel::level))
|
||||||
|
|
||||||
|
#define aot_log_error(...) (!aot_log_is_enabled(Error, __VA_ARGS__)) ? (void)0 : AOTLogImpl<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Error>
|
||||||
|
#define aot_log_warning(...) (!aot_log_is_enabled(Warning, __VA_ARGS__)) ? (void)0 : AOTLogImpl<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Warning>
|
||||||
|
#define aot_log_info(...) (!aot_log_is_enabled(Info, __VA_ARGS__)) ? (void)0 : AOTLogImpl<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Info>
|
||||||
|
#define aot_log_debug(...) (!aot_log_is_enabled(Debug, __VA_ARGS__)) ? (void)0 : AOTLogImpl<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Debug>
|
||||||
|
#define aot_log_trace(...) (!aot_log_is_enabled(Trace, __VA_ARGS__)) ? (void)0 : AOTLogImpl<LOG_TAGS(__VA_ARGS__)>::write<LogLevel::Trace>
|
||||||
|
|
||||||
|
template <LogTagType IGNORED, LogTagType T1 = LogTag::__NO_TAG, LogTagType T2 = LogTag::__NO_TAG, LogTagType T3 = LogTag::__NO_TAG,
|
||||||
|
LogTagType T4 = LogTag::__NO_TAG, LogTagType GuardTag = LogTag::__NO_TAG>
|
||||||
|
class AOTLogImpl {
|
||||||
|
public:
|
||||||
|
// Make sure no more than the maximum number of tags have been given.
|
||||||
|
// The GuardTag allows this to be detected if/when it happens. If the GuardTag
|
||||||
|
// is not __NO_TAG, the number of tags given exceeds the maximum allowed.
|
||||||
|
STATIC_ASSERT(GuardTag == LogTag::__NO_TAG); // Number of logging tags exceeds maximum supported!
|
||||||
|
|
||||||
|
// Empty constructor to avoid warnings on MSVC about unused variables
|
||||||
|
// when the log instance is only used for static functions.
|
||||||
|
AOTLogImpl() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool is_level(LogLevelType level) {
|
||||||
|
if (CDSConfig::new_aot_flags_used()) {
|
||||||
|
return LogTagSetMapping<LogTag::_aot, T1, T2, T3, T4>::tagset().is_level(level);
|
||||||
|
} else {
|
||||||
|
return LogTagSetMapping<LogTag::_cds, T1, T2, T3, T4>::tagset().is_level(level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ATTRIBUTE_PRINTF(2, 3)
|
||||||
|
static void write(LogLevelType level, const char* fmt, ...) {
|
||||||
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
|
vwrite(level, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <LogLevelType Level>
|
||||||
|
ATTRIBUTE_PRINTF(1, 2)
|
||||||
|
static void write(const char* fmt, ...) {
|
||||||
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
|
vwrite(Level, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
ATTRIBUTE_PRINTF(2, 0)
|
||||||
|
static void vwrite(LogLevelType level, const char* fmt, va_list args) {
|
||||||
|
if (CDSConfig::new_aot_flags_used()) {
|
||||||
|
LogTagSetMapping<LogTag::_aot, T1, T2, T3, T4>::tagset().vwrite(level, fmt, args);
|
||||||
|
} else {
|
||||||
|
LogTagSetMapping<LogTag::_cds, T1, T2, T3, T4>::tagset().vwrite(level, fmt, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -197,24 +197,24 @@ bool AOTReferenceObjSupport::check_if_ref_obj(oop obj) {
|
|||||||
if (needs_special_cleanup && (referent == nullptr || !_keep_alive_objs_table->contains(referent))) {
|
if (needs_special_cleanup && (referent == nullptr || !_keep_alive_objs_table->contains(referent))) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
|
|
||||||
log_error(cds, heap)("Cannot archive reference object " PTR_FORMAT " of class %s",
|
log_error(aot, heap)("Cannot archive reference object " PTR_FORMAT " of class %s",
|
||||||
p2i(obj), obj->klass()->external_name());
|
p2i(obj), obj->klass()->external_name());
|
||||||
log_error(cds, heap)("referent = " PTR_FORMAT
|
log_error(aot, heap)("referent = " PTR_FORMAT
|
||||||
", queue = " PTR_FORMAT
|
", queue = " PTR_FORMAT
|
||||||
", next = " PTR_FORMAT
|
", next = " PTR_FORMAT
|
||||||
", discovered = " PTR_FORMAT,
|
", discovered = " PTR_FORMAT,
|
||||||
p2i(referent), p2i(queue), p2i(next), p2i(discovered));
|
p2i(referent), p2i(queue), p2i(next), p2i(discovered));
|
||||||
log_error(cds, heap)("This object requires special clean up as its queue is not ReferenceQueue::N" "ULL ("
|
log_error(aot, heap)("This object requires special clean up as its queue is not ReferenceQueue::N" "ULL ("
|
||||||
PTR_FORMAT ")", p2i(_null_queue.resolve()));
|
PTR_FORMAT ")", p2i(_null_queue.resolve()));
|
||||||
log_error(cds, heap)("%s", (referent == nullptr) ?
|
log_error(aot, heap)("%s", (referent == nullptr) ?
|
||||||
"referent cannot be null" : "referent is not registered with CDS.keepAlive()");
|
"referent cannot be null" : "referent is not registered with CDS.keepAlive()");
|
||||||
HeapShared::debug_trace();
|
HeapShared::debug_trace();
|
||||||
MetaspaceShared::unrecoverable_writing_error();
|
MetaspaceShared::unrecoverable_writing_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (log_is_enabled(Info, cds, ref)) {
|
if (log_is_enabled(Info, aot, ref)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_info(cds, ref)("Reference obj:"
|
log_info(aot, ref)("Reference obj:"
|
||||||
" r=" PTR_FORMAT
|
" r=" PTR_FORMAT
|
||||||
" q=" PTR_FORMAT
|
" q=" PTR_FORMAT
|
||||||
" n=" PTR_FORMAT
|
" n=" PTR_FORMAT
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
#include "cds/aotArtifactFinder.hpp"
|
#include "cds/aotArtifactFinder.hpp"
|
||||||
#include "cds/aotClassLinker.hpp"
|
#include "cds/aotClassLinker.hpp"
|
||||||
#include "cds/aotLinkedClassBulkLoader.hpp"
|
#include "cds/aotLinkedClassBulkLoader.hpp"
|
||||||
|
#include "cds/aotLogging.hpp"
|
||||||
#include "cds/archiveBuilder.hpp"
|
#include "cds/archiveBuilder.hpp"
|
||||||
#include "cds/archiveHeapWriter.hpp"
|
#include "cds/archiveHeapWriter.hpp"
|
||||||
#include "cds/archiveUtils.hpp"
|
#include "cds/archiveUtils.hpp"
|
||||||
@ -133,7 +134,7 @@ public:
|
|||||||
address old_p = *ptr_loc;
|
address old_p = *ptr_loc;
|
||||||
address new_p = _builder->get_buffered_addr(old_p);
|
address new_p = _builder->get_buffered_addr(old_p);
|
||||||
|
|
||||||
log_trace(cds)("Ref: [" PTR_FORMAT "] -> " PTR_FORMAT " => " PTR_FORMAT,
|
log_trace(aot)("Ref: [" PTR_FORMAT "] -> " PTR_FORMAT " => " PTR_FORMAT,
|
||||||
p2i(ptr_loc), p2i(old_p), p2i(new_p));
|
p2i(ptr_loc), p2i(old_p), p2i(new_p));
|
||||||
|
|
||||||
ArchivePtrMarker::set_and_mark_pointer(ptr_loc, new_p);
|
ArchivePtrMarker::set_and_mark_pointer(ptr_loc, new_p);
|
||||||
@ -251,7 +252,7 @@ void ArchiveBuilder::gather_klasses_and_symbols() {
|
|||||||
AOTArtifactFinder::initialize();
|
AOTArtifactFinder::initialize();
|
||||||
AOTArtifactFinder::find_artifacts();
|
AOTArtifactFinder::find_artifacts();
|
||||||
|
|
||||||
log_info(cds)("Gathering classes and symbols ... ");
|
aot_log_info(aot)("Gathering classes and symbols ... ");
|
||||||
GatherKlassesAndSymbols doit(this);
|
GatherKlassesAndSymbols doit(this);
|
||||||
iterate_roots(&doit);
|
iterate_roots(&doit);
|
||||||
#if INCLUDE_CDS_JAVA_HEAP
|
#if INCLUDE_CDS_JAVA_HEAP
|
||||||
@ -281,7 +282,7 @@ void ArchiveBuilder::gather_klasses_and_symbols() {
|
|||||||
// TODO: in the future, if we want to produce deterministic contents in the
|
// TODO: in the future, if we want to produce deterministic contents in the
|
||||||
// dynamic archive, we might need to sort the symbols alphabetically (also see
|
// dynamic archive, we might need to sort the symbols alphabetically (also see
|
||||||
// DynamicArchiveBuilder::sort_methods()).
|
// DynamicArchiveBuilder::sort_methods()).
|
||||||
log_info(cds)("Sorting symbols ... ");
|
aot_log_info(aot)("Sorting symbols ... ");
|
||||||
_symbols->sort(compare_symbols_by_address);
|
_symbols->sort(compare_symbols_by_address);
|
||||||
sort_klasses();
|
sort_klasses();
|
||||||
}
|
}
|
||||||
@ -303,7 +304,7 @@ int ArchiveBuilder::compare_klass_by_name(Klass** a, Klass** b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ArchiveBuilder::sort_klasses() {
|
void ArchiveBuilder::sort_klasses() {
|
||||||
log_info(cds)("Sorting classes ... ");
|
aot_log_info(aot)("Sorting classes ... ");
|
||||||
_klasses->sort(compare_klass_by_name);
|
_klasses->sort(compare_klass_by_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,14 +316,14 @@ address ArchiveBuilder::reserve_buffer() {
|
|||||||
os::vm_page_size(),
|
os::vm_page_size(),
|
||||||
mtNone);
|
mtNone);
|
||||||
if (!rs.is_reserved()) {
|
if (!rs.is_reserved()) {
|
||||||
log_error(cds)("Failed to reserve %zu bytes of output buffer.", buffer_size);
|
aot_log_error(aot)("Failed to reserve %zu bytes of output buffer.", buffer_size);
|
||||||
MetaspaceShared::unrecoverable_writing_error();
|
MetaspaceShared::unrecoverable_writing_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
// buffer_bottom is the lowest address of the 2 core regions (rw, ro) when
|
// buffer_bottom is the lowest address of the 2 core regions (rw, ro) when
|
||||||
// we are copying the class metadata into the buffer.
|
// we are copying the class metadata into the buffer.
|
||||||
address buffer_bottom = (address)rs.base();
|
address buffer_bottom = (address)rs.base();
|
||||||
log_info(cds)("Reserved output buffer space at " PTR_FORMAT " [%zu bytes]",
|
aot_log_info(aot)("Reserved output buffer space at " PTR_FORMAT " [%zu bytes]",
|
||||||
p2i(buffer_bottom), buffer_size);
|
p2i(buffer_bottom), buffer_size);
|
||||||
_shared_rs = rs;
|
_shared_rs = rs;
|
||||||
|
|
||||||
@ -364,9 +365,9 @@ address ArchiveBuilder::reserve_buffer() {
|
|||||||
if (my_archive_requested_bottom < _requested_static_archive_bottom ||
|
if (my_archive_requested_bottom < _requested_static_archive_bottom ||
|
||||||
my_archive_requested_top <= _requested_static_archive_bottom) {
|
my_archive_requested_top <= _requested_static_archive_bottom) {
|
||||||
// Size overflow.
|
// Size overflow.
|
||||||
log_error(cds)("my_archive_requested_bottom = " INTPTR_FORMAT, p2i(my_archive_requested_bottom));
|
aot_log_error(aot)("my_archive_requested_bottom = " INTPTR_FORMAT, p2i(my_archive_requested_bottom));
|
||||||
log_error(cds)("my_archive_requested_top = " INTPTR_FORMAT, p2i(my_archive_requested_top));
|
aot_log_error(aot)("my_archive_requested_top = " INTPTR_FORMAT, p2i(my_archive_requested_top));
|
||||||
log_error(cds)("SharedBaseAddress (" INTPTR_FORMAT ") is too high. "
|
aot_log_error(aot)("SharedBaseAddress (" INTPTR_FORMAT ") is too high. "
|
||||||
"Please rerun java -Xshare:dump with a lower value", p2i(_requested_static_archive_bottom));
|
"Please rerun java -Xshare:dump with a lower value", p2i(_requested_static_archive_bottom));
|
||||||
MetaspaceShared::unrecoverable_writing_error();
|
MetaspaceShared::unrecoverable_writing_error();
|
||||||
}
|
}
|
||||||
@ -424,7 +425,7 @@ bool ArchiveBuilder::gather_one_source_obj(MetaspaceClosure::Ref* ref, bool read
|
|||||||
SourceObjInfo* p = _src_obj_table.put_if_absent(src_obj, src_info, &created);
|
SourceObjInfo* p = _src_obj_table.put_if_absent(src_obj, src_info, &created);
|
||||||
if (created) {
|
if (created) {
|
||||||
if (_src_obj_table.maybe_grow()) {
|
if (_src_obj_table.maybe_grow()) {
|
||||||
log_info(cds, hashtables)("Expanded _src_obj_table table to %d", _src_obj_table.table_size());
|
log_info(aot, hashtables)("Expanded _src_obj_table table to %d", _src_obj_table.table_size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -503,7 +504,7 @@ void ArchiveBuilder::remember_embedded_pointer_in_enclosing_obj(MetaspaceClosure
|
|||||||
|
|
||||||
void ArchiveBuilder::gather_source_objs() {
|
void ArchiveBuilder::gather_source_objs() {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_info(cds)("Gathering all archivable objects ... ");
|
aot_log_info(aot)("Gathering all archivable objects ... ");
|
||||||
gather_klasses_and_symbols();
|
gather_klasses_and_symbols();
|
||||||
GatherSortedSourceObjs doit(this);
|
GatherSortedSourceObjs doit(this);
|
||||||
iterate_sorted_roots(&doit);
|
iterate_sorted_roots(&doit);
|
||||||
@ -590,7 +591,7 @@ void ArchiveBuilder::sort_metadata_objs() {
|
|||||||
|
|
||||||
void ArchiveBuilder::dump_rw_metadata() {
|
void ArchiveBuilder::dump_rw_metadata() {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_info(cds)("Allocating RW objects ... ");
|
aot_log_info(aot)("Allocating RW objects ... ");
|
||||||
make_shallow_copies(&_rw_region, &_rw_src_objs);
|
make_shallow_copies(&_rw_region, &_rw_src_objs);
|
||||||
|
|
||||||
#if INCLUDE_CDS_JAVA_HEAP
|
#if INCLUDE_CDS_JAVA_HEAP
|
||||||
@ -605,7 +606,7 @@ void ArchiveBuilder::dump_rw_metadata() {
|
|||||||
|
|
||||||
void ArchiveBuilder::dump_ro_metadata() {
|
void ArchiveBuilder::dump_ro_metadata() {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_info(cds)("Allocating RO objects ... ");
|
aot_log_info(aot)("Allocating RO objects ... ");
|
||||||
|
|
||||||
start_dump_region(&_ro_region);
|
start_dump_region(&_ro_region);
|
||||||
make_shallow_copies(&_ro_region, &_ro_src_objs);
|
make_shallow_copies(&_ro_region, &_ro_src_objs);
|
||||||
@ -626,7 +627,7 @@ void ArchiveBuilder::make_shallow_copies(DumpRegion *dump_region,
|
|||||||
for (int i = 0; i < src_objs->objs()->length(); i++) {
|
for (int i = 0; i < src_objs->objs()->length(); i++) {
|
||||||
make_shallow_copy(dump_region, src_objs->objs()->at(i));
|
make_shallow_copy(dump_region, src_objs->objs()->at(i));
|
||||||
}
|
}
|
||||||
log_info(cds)("done (%d objects)", src_objs->objs()->length());
|
aot_log_info(aot)("done (%d objects)", src_objs->objs()->length());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArchiveBuilder::make_shallow_copy(DumpRegion *dump_region, SourceObjInfo* src_info) {
|
void ArchiveBuilder::make_shallow_copy(DumpRegion *dump_region, SourceObjInfo* src_info) {
|
||||||
@ -676,7 +677,7 @@ void ArchiveBuilder::make_shallow_copy(DumpRegion *dump_region, SourceObjInfo* s
|
|||||||
_buffered_to_src_table.put_if_absent((address)dest, src, &created);
|
_buffered_to_src_table.put_if_absent((address)dest, src, &created);
|
||||||
assert(created, "must be");
|
assert(created, "must be");
|
||||||
if (_buffered_to_src_table.maybe_grow()) {
|
if (_buffered_to_src_table.maybe_grow()) {
|
||||||
log_info(cds, hashtables)("Expanded _buffered_to_src_table table to %d", _buffered_to_src_table.table_size());
|
log_info(aot, hashtables)("Expanded _buffered_to_src_table table to %d", _buffered_to_src_table.table_size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -686,7 +687,7 @@ void ArchiveBuilder::make_shallow_copy(DumpRegion *dump_region, SourceObjInfo* s
|
|||||||
ArchivePtrMarker::mark_pointer((address*)dest);
|
ArchivePtrMarker::mark_pointer((address*)dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_trace(cds)("Copy: " PTR_FORMAT " ==> " PTR_FORMAT " %d", p2i(src), p2i(dest), bytes);
|
log_trace(aot)("Copy: " PTR_FORMAT " ==> " PTR_FORMAT " %d", p2i(src), p2i(dest), bytes);
|
||||||
src_info->set_buffered_addr((address)dest);
|
src_info->set_buffered_addr((address)dest);
|
||||||
|
|
||||||
_alloc_stats.record(src_info->msotype(), int(newtop - oldtop), src_info->read_only());
|
_alloc_stats.record(src_info->msotype(), int(newtop - oldtop), src_info->read_only());
|
||||||
@ -752,7 +753,7 @@ void ArchiveBuilder::relocate_embedded_pointers(ArchiveBuilder::SourceObjList* s
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ArchiveBuilder::relocate_metaspaceobj_embedded_pointers() {
|
void ArchiveBuilder::relocate_metaspaceobj_embedded_pointers() {
|
||||||
log_info(cds)("Relocating embedded pointers in core regions ... ");
|
aot_log_info(aot)("Relocating embedded pointers in core regions ... ");
|
||||||
relocate_embedded_pointers(&_rw_src_objs);
|
relocate_embedded_pointers(&_rw_src_objs);
|
||||||
relocate_embedded_pointers(&_ro_src_objs);
|
relocate_embedded_pointers(&_ro_src_objs);
|
||||||
}
|
}
|
||||||
@ -923,9 +924,9 @@ void ArchiveBuilder::make_klasses_shareable() {
|
|||||||
ik->remove_unshareable_info();
|
ik->remove_unshareable_info();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (log_is_enabled(Debug, cds, class)) {
|
if (aot_log_is_enabled(Debug, aot, class)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_debug(cds, class)("klasses[%5d] = " PTR_FORMAT " %-5s %s%s%s%s%s%s%s%s", i,
|
aot_log_debug(aot, class)("klasses[%5d] = " PTR_FORMAT " %-5s %s%s%s%s%s%s%s%s", i,
|
||||||
p2i(to_requested(k)), type, k->external_name(),
|
p2i(to_requested(k)), type, k->external_name(),
|
||||||
kind, hidden, old, unlinked, generated, aotlinked_msg, inited_msg);
|
kind, hidden, old, unlinked, generated, aotlinked_msg, inited_msg);
|
||||||
}
|
}
|
||||||
@ -934,21 +935,21 @@ void ArchiveBuilder::make_klasses_shareable() {
|
|||||||
#define STATS_FORMAT "= %5d, aot-linked = %5d, inited = %5d"
|
#define STATS_FORMAT "= %5d, aot-linked = %5d, inited = %5d"
|
||||||
#define STATS_PARAMS(x) num_ ## x, num_ ## x ## _a, num_ ## x ## _i
|
#define STATS_PARAMS(x) num_ ## x, num_ ## x ## _a, num_ ## x ## _i
|
||||||
|
|
||||||
log_info(cds)("Number of classes %d", num_instance_klasses + num_obj_array_klasses + num_type_array_klasses);
|
aot_log_info(aot)("Number of classes %d", num_instance_klasses + num_obj_array_klasses + num_type_array_klasses);
|
||||||
log_info(cds)(" instance classes " STATS_FORMAT, STATS_PARAMS(instance_klasses));
|
aot_log_info(aot)(" instance classes " STATS_FORMAT, STATS_PARAMS(instance_klasses));
|
||||||
log_info(cds)(" boot " STATS_FORMAT, STATS_PARAMS(boot_klasses));
|
aot_log_info(aot)(" boot " STATS_FORMAT, STATS_PARAMS(boot_klasses));
|
||||||
log_info(cds)(" vm " STATS_FORMAT, STATS_PARAMS(vm_klasses));
|
aot_log_info(aot)(" vm " STATS_FORMAT, STATS_PARAMS(vm_klasses));
|
||||||
log_info(cds)(" platform " STATS_FORMAT, STATS_PARAMS(platform_klasses));
|
aot_log_info(aot)(" platform " STATS_FORMAT, STATS_PARAMS(platform_klasses));
|
||||||
log_info(cds)(" app " STATS_FORMAT, STATS_PARAMS(app_klasses));
|
aot_log_info(aot)(" app " STATS_FORMAT, STATS_PARAMS(app_klasses));
|
||||||
log_info(cds)(" unregistered " STATS_FORMAT, STATS_PARAMS(unregistered_klasses));
|
aot_log_info(aot)(" unregistered " STATS_FORMAT, STATS_PARAMS(unregistered_klasses));
|
||||||
log_info(cds)(" (enum) " STATS_FORMAT, STATS_PARAMS(enum_klasses));
|
aot_log_info(aot)(" (enum) " STATS_FORMAT, STATS_PARAMS(enum_klasses));
|
||||||
log_info(cds)(" (hidden) " STATS_FORMAT, STATS_PARAMS(hidden_klasses));
|
aot_log_info(aot)(" (hidden) " STATS_FORMAT, STATS_PARAMS(hidden_klasses));
|
||||||
log_info(cds)(" (old) " STATS_FORMAT, STATS_PARAMS(old_klasses));
|
aot_log_info(aot)(" (old) " STATS_FORMAT, STATS_PARAMS(old_klasses));
|
||||||
log_info(cds)(" (unlinked) = %5d, boot = %d, plat = %d, app = %d, unreg = %d",
|
aot_log_info(aot)(" (unlinked) = %5d, boot = %d, plat = %d, app = %d, unreg = %d",
|
||||||
num_unlinked_klasses, boot_unlinked, platform_unlinked, app_unlinked, unreg_unlinked);
|
num_unlinked_klasses, boot_unlinked, platform_unlinked, app_unlinked, unreg_unlinked);
|
||||||
log_info(cds)(" obj array classes = %5d", num_obj_array_klasses);
|
aot_log_info(aot)(" obj array classes = %5d", num_obj_array_klasses);
|
||||||
log_info(cds)(" type array classes = %5d", num_type_array_klasses);
|
aot_log_info(aot)(" type array classes = %5d", num_type_array_klasses);
|
||||||
log_info(cds)(" symbols = %5d", _symbols->length());
|
aot_log_info(aot)(" symbols = %5d", _symbols->length());
|
||||||
|
|
||||||
#undef STATS_FORMAT
|
#undef STATS_FORMAT
|
||||||
#undef STATS_PARAMS
|
#undef STATS_PARAMS
|
||||||
@ -1050,7 +1051,7 @@ class RelocateBufferToRequested : public BitMapClosure {
|
|||||||
address top = _builder->buffer_top();
|
address top = _builder->buffer_top();
|
||||||
address new_bottom = bottom + _buffer_to_requested_delta;
|
address new_bottom = bottom + _buffer_to_requested_delta;
|
||||||
address new_top = top + _buffer_to_requested_delta;
|
address new_top = top + _buffer_to_requested_delta;
|
||||||
log_debug(cds)("Relocating archive from [" INTPTR_FORMAT " - " INTPTR_FORMAT "] to "
|
aot_log_debug(aot)("Relocating archive from [" INTPTR_FORMAT " - " INTPTR_FORMAT "] to "
|
||||||
"[" INTPTR_FORMAT " - " INTPTR_FORMAT "]",
|
"[" INTPTR_FORMAT " - " INTPTR_FORMAT "]",
|
||||||
p2i(bottom), p2i(top),
|
p2i(bottom), p2i(top),
|
||||||
p2i(new_bottom), p2i(new_top));
|
p2i(new_bottom), p2i(new_top));
|
||||||
@ -1574,8 +1575,8 @@ void ArchiveBuilder::write_archive(FileMapInfo* mapinfo, ArchiveHeapInfo* heap_i
|
|||||||
mapinfo->write_header();
|
mapinfo->write_header();
|
||||||
mapinfo->close();
|
mapinfo->close();
|
||||||
|
|
||||||
if (log_is_enabled(Info, cds)) {
|
if (log_is_enabled(Info, aot)) {
|
||||||
log_info(cds)("Full module graph = %s", CDSConfig::is_dumping_full_module_graph() ? "enabled" : "disabled");
|
log_info(aot)("Full module graph = %s", CDSConfig::is_dumping_full_module_graph() ? "enabled" : "disabled");
|
||||||
print_stats();
|
print_stats();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1613,12 +1614,12 @@ void ArchiveBuilder::print_region_stats(FileMapInfo *mapinfo, ArchiveHeapInfo* h
|
|||||||
print_heap_region_stats(heap_info, total_reserved);
|
print_heap_region_stats(heap_info, total_reserved);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug(cds)("total : %9zu [100.0%% of total] out of %9zu bytes [%5.1f%% used]",
|
aot_log_debug(aot)("total : %9zu [100.0%% of total] out of %9zu bytes [%5.1f%% used]",
|
||||||
total_bytes, total_reserved, total_u_perc);
|
total_bytes, total_reserved, total_u_perc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArchiveBuilder::print_bitmap_region_stats(size_t size, size_t total_size) {
|
void ArchiveBuilder::print_bitmap_region_stats(size_t size, size_t total_size) {
|
||||||
log_debug(cds)("bm space: %9zu [ %4.1f%% of total] out of %9zu bytes [100.0%% used]",
|
aot_log_debug(aot)("bm space: %9zu [ %4.1f%% of total] out of %9zu bytes [100.0%% used]",
|
||||||
size, size/double(total_size)*100.0, size);
|
size, size/double(total_size)*100.0, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1626,7 +1627,7 @@ void ArchiveBuilder::print_heap_region_stats(ArchiveHeapInfo *info, size_t total
|
|||||||
char* start = info->buffer_start();
|
char* start = info->buffer_start();
|
||||||
size_t size = info->buffer_byte_size();
|
size_t size = info->buffer_byte_size();
|
||||||
char* top = start + size;
|
char* top = start + size;
|
||||||
log_debug(cds)("hp space: %9zu [ %4.1f%% of total] out of %9zu bytes [100.0%% used] at " INTPTR_FORMAT,
|
aot_log_debug(aot)("hp space: %9zu [ %4.1f%% of total] out of %9zu bytes [100.0%% used] at " INTPTR_FORMAT,
|
||||||
size, size/double(total_size)*100.0, size, p2i(start));
|
size, size/double(total_size)*100.0, size, p2i(start));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1637,6 +1638,6 @@ void ArchiveBuilder::report_out_of_space(const char* name, size_t needed_bytes)
|
|||||||
_rw_region.print_out_of_space_msg(name, needed_bytes);
|
_rw_region.print_out_of_space_msg(name, needed_bytes);
|
||||||
_ro_region.print_out_of_space_msg(name, needed_bytes);
|
_ro_region.print_out_of_space_msg(name, needed_bytes);
|
||||||
|
|
||||||
log_error(cds)("Unable to allocate from '%s' region: Please reduce the number of shared classes.", name);
|
log_error(aot)("Unable to allocate from '%s' region: Please reduce the number of shared classes.", name);
|
||||||
MetaspaceShared::unrecoverable_writing_error();
|
MetaspaceShared::unrecoverable_writing_error();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -408,7 +408,7 @@ void ArchiveHeapLoader::finish_loaded_heap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ArchiveHeapLoader::verify_loaded_heap() {
|
void ArchiveHeapLoader::verify_loaded_heap() {
|
||||||
log_info(cds, heap)("Verify all oops and pointers in loaded heap");
|
log_info(aot, heap)("Verify all oops and pointers in loaded heap");
|
||||||
|
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
ResourceHashtable<uintptr_t, bool> table;
|
ResourceHashtable<uintptr_t, bool> table;
|
||||||
@ -459,7 +459,7 @@ void ArchiveHeapLoader::patch_native_pointers() {
|
|||||||
|
|
||||||
FileMapRegion* r = FileMapInfo::current_info()->region_at(MetaspaceShared::hp);
|
FileMapRegion* r = FileMapInfo::current_info()->region_at(MetaspaceShared::hp);
|
||||||
if (r->mapped_base() != nullptr && r->has_ptrmap()) {
|
if (r->mapped_base() != nullptr && r->has_ptrmap()) {
|
||||||
log_info(cds, heap)("Patching native pointers in heap region");
|
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(MetaspaceShared::hp);
|
||||||
PatchNativePointers patcher((Metadata**)r->mapped_base() + FileMapInfo::current_info()->heap_ptrmap_start_pos());
|
PatchNativePointers patcher((Metadata**)r->mapped_base() + FileMapInfo::current_info()->heap_ptrmap_start_pos());
|
||||||
bm.iterate(&patcher);
|
bm.iterate(&patcher);
|
||||||
|
|||||||
@ -247,7 +247,7 @@ void ArchiveHeapWriter::copy_roots_to_buffer(GrowableArrayCHeap<oop, mtClassShar
|
|||||||
root_segment_at_put(seg_oop, i, roots->at(root_index++));
|
root_segment_at_put(seg_oop, i, roots->at(root_index++));
|
||||||
}
|
}
|
||||||
|
|
||||||
log_info(cds, heap)("archived obj root segment [%d] = %zu bytes, obj = " PTR_FORMAT,
|
log_info(aot, heap)("archived obj root segment [%d] = %zu bytes, obj = " PTR_FORMAT,
|
||||||
size_elems, size_bytes, p2i(seg_oop));
|
size_elems, size_bytes, p2i(seg_oop));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,7 +396,7 @@ void ArchiveHeapWriter::maybe_fill_gc_region_gap(size_t required_byte_size) {
|
|||||||
ensure_buffer_space(filler_end);
|
ensure_buffer_space(filler_end);
|
||||||
|
|
||||||
int array_length = filler_array_length(fill_bytes);
|
int array_length = filler_array_length(fill_bytes);
|
||||||
log_info(cds, heap)("Inserting filler obj array of %d elements (%zu bytes total) @ buffer offset %zu",
|
log_info(aot, heap)("Inserting filler obj array of %d elements (%zu bytes total) @ buffer offset %zu",
|
||||||
array_length, fill_bytes, _buffer_used);
|
array_length, fill_bytes, _buffer_used);
|
||||||
HeapWord* filler = init_filler_array_at_buffer_top(array_length, fill_bytes);
|
HeapWord* filler = init_filler_array_at_buffer_top(array_length, fill_bytes);
|
||||||
_buffer_used = filler_end;
|
_buffer_used = filler_end;
|
||||||
@ -474,7 +474,7 @@ void ArchiveHeapWriter::set_requested_address(ArchiveHeapInfo* info) {
|
|||||||
if (UseCompressedOops) {
|
if (UseCompressedOops) {
|
||||||
if (UseG1GC) {
|
if (UseG1GC) {
|
||||||
address heap_end = (address)G1CollectedHeap::heap()->reserved().end();
|
address heap_end = (address)G1CollectedHeap::heap()->reserved().end();
|
||||||
log_info(cds, heap)("Heap end = %p", heap_end);
|
log_info(aot, heap)("Heap end = %p", heap_end);
|
||||||
_requested_bottom = align_down(heap_end - heap_region_byte_size, G1HeapRegion::GrainBytes);
|
_requested_bottom = align_down(heap_end - heap_region_byte_size, G1HeapRegion::GrainBytes);
|
||||||
_requested_bottom = align_down(_requested_bottom, MIN_GC_REGION_ALIGNMENT);
|
_requested_bottom = align_down(_requested_bottom, MIN_GC_REGION_ALIGNMENT);
|
||||||
assert(is_aligned(_requested_bottom, G1HeapRegion::GrainBytes), "sanity");
|
assert(is_aligned(_requested_bottom, G1HeapRegion::GrainBytes), "sanity");
|
||||||
@ -763,7 +763,7 @@ void ArchiveHeapWriter::compute_ptrmap(ArchiveHeapInfo* heap_info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
heap_info->ptrmap()->resize(max_idx + 1);
|
heap_info->ptrmap()->resize(max_idx + 1);
|
||||||
log_info(cds, heap)("calculate_ptrmap: marked %d non-null native pointers for heap region (%zu bits)",
|
log_info(aot, heap)("calculate_ptrmap: marked %d non-null native pointers for heap region (%zu bits)",
|
||||||
num_non_null_ptrs, size_t(heap_info->ptrmap()->size()));
|
num_non_null_ptrs, size_t(heap_info->ptrmap()->size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -411,7 +411,7 @@ void CDSConfig::check_aot_flags() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (FLAG_IS_DEFAULT(AOTCache) && FLAG_IS_DEFAULT(AOTConfiguration) && FLAG_IS_DEFAULT(AOTMode)) {
|
if (FLAG_IS_DEFAULT(AOTCache) && FLAG_IS_DEFAULT(AOTConfiguration) && FLAG_IS_DEFAULT(AOTMode)) {
|
||||||
// AOTCache/AOTConfiguration/AOTMode not used.
|
// AOTCache/AOTConfiguration/AOTMode not used -> using the "classic CDS" workflow.
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
_new_aot_flags_used = true;
|
_new_aot_flags_used = true;
|
||||||
|
|||||||
@ -99,7 +99,7 @@ void CDSEnumKlass::archive_static_field(int level, KlassSubGraphInfo* subgraph_i
|
|||||||
bool success = HeapShared::archive_reachable_objects_from(level, subgraph_info, oop_field);
|
bool success = HeapShared::archive_reachable_objects_from(level, subgraph_info, oop_field);
|
||||||
assert(success, "VM should have exited with unarchivable objects for _level > 1");
|
assert(success, "VM should have exited with unarchivable objects for _level > 1");
|
||||||
int root_index = HeapShared::append_root(oop_field);
|
int root_index = HeapShared::append_root(oop_field);
|
||||||
log_info(cds, heap)("Archived enum obj @%d %s::%s (" INTPTR_FORMAT ")",
|
log_info(aot, heap)("Archived enum obj @%d %s::%s (" INTPTR_FORMAT ")",
|
||||||
root_index, ik->external_name(), fd.name()->as_C_string(),
|
root_index, ik->external_name(), fd.name()->as_C_string(),
|
||||||
p2i((oopDesc*)oop_field));
|
p2i((oopDesc*)oop_field));
|
||||||
SystemDictionaryShared::add_enum_klass_static_field(ik, root_index);
|
SystemDictionaryShared::add_enum_klass_static_field(ik, root_index);
|
||||||
@ -113,9 +113,9 @@ bool CDSEnumKlass::initialize_enum_klass(InstanceKlass* k, TRAPS) {
|
|||||||
RunTimeClassInfo* info = RunTimeClassInfo::get_for(k);
|
RunTimeClassInfo* info = RunTimeClassInfo::get_for(k);
|
||||||
assert(info != nullptr, "sanity");
|
assert(info != nullptr, "sanity");
|
||||||
|
|
||||||
if (log_is_enabled(Info, cds, heap)) {
|
if (log_is_enabled(Info, aot, heap)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_info(cds, heap)("Initializing Enum class: %s", k->external_name());
|
log_info(aot, heap)("Initializing Enum class: %s", k->external_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
oop mirror = k->java_mirror();
|
oop mirror = k->java_mirror();
|
||||||
|
|||||||
@ -151,10 +151,10 @@ CDSHeapVerifier::CDSHeapVerifier() : _archived_objs(0), _problems(0)
|
|||||||
|
|
||||||
CDSHeapVerifier::~CDSHeapVerifier() {
|
CDSHeapVerifier::~CDSHeapVerifier() {
|
||||||
if (_problems > 0) {
|
if (_problems > 0) {
|
||||||
log_error(cds, heap)("Scanned %d objects. Found %d case(s) where "
|
log_error(aot, heap)("Scanned %d objects. Found %d case(s) where "
|
||||||
"an object points to a static field that "
|
"an object points to a static field that "
|
||||||
"may hold a different value at runtime.", _archived_objs, _problems);
|
"may hold a different value at runtime.", _archived_objs, _problems);
|
||||||
log_error(cds, heap)("Please see cdsHeapVerifier.cpp and aotClassInitializer.cpp for details");
|
log_error(aot, heap)("Please see cdsHeapVerifier.cpp and aotClassInitializer.cpp for details");
|
||||||
MetaspaceShared::unrecoverable_writing_error();
|
MetaspaceShared::unrecoverable_writing_error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -285,7 +285,7 @@ inline bool CDSHeapVerifier::do_entry(oop& orig_obj, HeapShared::CachedOopInfo&
|
|||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
char* class_name = info->_holder->name()->as_C_string();
|
char* class_name = info->_holder->name()->as_C_string();
|
||||||
char* field_name = info->_name->as_C_string();
|
char* field_name = info->_name->as_C_string();
|
||||||
LogStream ls(Log(cds, heap)::warning());
|
LogStream ls(Log(aot, heap)::warning());
|
||||||
ls.print_cr("Archive heap points to a static field that may hold a different value at runtime:");
|
ls.print_cr("Archive heap points to a static field that may hold a different value at runtime:");
|
||||||
ls.print_cr("Field: %s::%s", class_name, field_name);
|
ls.print_cr("Field: %s::%s", class_name, field_name);
|
||||||
ls.print("Value: ");
|
ls.print("Value: ");
|
||||||
|
|||||||
@ -52,7 +52,7 @@ void DumpAllocStats::print_stats(int ro_all, int rw_all) {
|
|||||||
const char *sep = "--------------------+---------------------------+---------------------------+--------------------------";
|
const char *sep = "--------------------+---------------------------+---------------------------+--------------------------";
|
||||||
const char *hdr = " ro_cnt ro_bytes % | rw_cnt rw_bytes % | all_cnt all_bytes %";
|
const char *hdr = " ro_cnt ro_bytes % | rw_cnt rw_bytes % | all_cnt all_bytes %";
|
||||||
|
|
||||||
LogMessage(cds) msg;
|
LogMessage(aot) msg;
|
||||||
|
|
||||||
msg.debug("Detailed metadata info (excluding heap region):");
|
msg.debug("Detailed metadata info (excluding heap region):");
|
||||||
msg.debug("%s", hdr);
|
msg.debug("%s", hdr);
|
||||||
|
|||||||
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cds/aotClassLocation.hpp"
|
#include "cds/aotClassLocation.hpp"
|
||||||
|
#include "cds/aotLogging.hpp"
|
||||||
#include "cds/archiveBuilder.hpp"
|
#include "cds/archiveBuilder.hpp"
|
||||||
#include "cds/archiveHeapLoader.inline.hpp"
|
#include "cds/archiveHeapLoader.inline.hpp"
|
||||||
#include "cds/archiveHeapWriter.hpp"
|
#include "cds/archiveHeapWriter.hpp"
|
||||||
@ -336,13 +337,13 @@ bool FileMapInfo::validate_class_location() {
|
|||||||
// the runtime image and the -cp, dynamic dumping is disabled.
|
// the runtime image and the -cp, dynamic dumping is disabled.
|
||||||
if (config->num_boot_classpaths() > 0) {
|
if (config->num_boot_classpaths() > 0) {
|
||||||
CDSConfig::disable_dumping_dynamic_archive();
|
CDSConfig::disable_dumping_dynamic_archive();
|
||||||
log_warning(cds)(
|
aot_log_warning(aot)(
|
||||||
"Dynamic archiving is disabled because base layer archive has appended boot classpath");
|
"Dynamic archiving is disabled because base layer archive has appended boot classpath");
|
||||||
}
|
}
|
||||||
if (config->num_module_paths() > 0) {
|
if (config->num_module_paths() > 0) {
|
||||||
if (has_extra_module_paths) {
|
if (has_extra_module_paths) {
|
||||||
CDSConfig::disable_dumping_dynamic_archive();
|
CDSConfig::disable_dumping_dynamic_archive();
|
||||||
log_warning(cds)(
|
aot_log_warning(aot)(
|
||||||
"Dynamic archiving is disabled because base layer archive has a different module path");
|
"Dynamic archiving is disabled because base layer archive has a different module path");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -397,7 +398,7 @@ public:
|
|||||||
assert(_archive_name != nullptr, "Archive name is null");
|
assert(_archive_name != nullptr, "Archive name is null");
|
||||||
_fd = os::open(_archive_name, O_RDONLY | O_BINARY, 0);
|
_fd = os::open(_archive_name, O_RDONLY | O_BINARY, 0);
|
||||||
if (_fd < 0) {
|
if (_fd < 0) {
|
||||||
log_info(cds)("Specified %s not found (%s)", CDSConfig::type_of_archive_being_loaded(), _archive_name);
|
aot_log_info(aot)("Specified %s not found (%s)", CDSConfig::type_of_archive_being_loaded(), _archive_name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return initialize(_fd);
|
return initialize(_fd);
|
||||||
@ -414,31 +415,31 @@ public:
|
|||||||
os::lseek(fd, 0, SEEK_SET);
|
os::lseek(fd, 0, SEEK_SET);
|
||||||
size_t n = ::read(fd, (void*)&gen_header, (unsigned int)size);
|
size_t n = ::read(fd, (void*)&gen_header, (unsigned int)size);
|
||||||
if (n != size) {
|
if (n != size) {
|
||||||
log_warning(cds)("Unable to read generic CDS file map header from %s", file_type);
|
aot_log_warning(aot)("Unable to read generic CDS file map header from %s", file_type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gen_header._magic != CDS_ARCHIVE_MAGIC &&
|
if (gen_header._magic != CDS_ARCHIVE_MAGIC &&
|
||||||
gen_header._magic != CDS_DYNAMIC_ARCHIVE_MAGIC &&
|
gen_header._magic != CDS_DYNAMIC_ARCHIVE_MAGIC &&
|
||||||
gen_header._magic != CDS_PREIMAGE_ARCHIVE_MAGIC) {
|
gen_header._magic != CDS_PREIMAGE_ARCHIVE_MAGIC) {
|
||||||
log_warning(cds)("The %s has a bad magic number: %#x", file_type, gen_header._magic);
|
aot_log_warning(aot)("The %s has a bad magic number: %#x", file_type, gen_header._magic);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gen_header._version < CDS_GENERIC_HEADER_SUPPORTED_MIN_VERSION) {
|
if (gen_header._version < CDS_GENERIC_HEADER_SUPPORTED_MIN_VERSION) {
|
||||||
log_warning(cds)("Cannot handle %s version 0x%x. Must be at least 0x%x.",
|
aot_log_warning(aot)("Cannot handle %s version 0x%x. Must be at least 0x%x.",
|
||||||
file_type, gen_header._version, CDS_GENERIC_HEADER_SUPPORTED_MIN_VERSION);
|
file_type, gen_header._version, CDS_GENERIC_HEADER_SUPPORTED_MIN_VERSION);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gen_header._version != CURRENT_CDS_ARCHIVE_VERSION) {
|
if (gen_header._version != CURRENT_CDS_ARCHIVE_VERSION) {
|
||||||
log_warning(cds)("The %s version 0x%x does not match the required version 0x%x.",
|
aot_log_warning(aot)("The %s version 0x%x does not match the required version 0x%x.",
|
||||||
file_type, gen_header._version, CURRENT_CDS_ARCHIVE_VERSION);
|
file_type, gen_header._version, CURRENT_CDS_ARCHIVE_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t filelen = os::lseek(fd, 0, SEEK_END);
|
size_t filelen = os::lseek(fd, 0, SEEK_END);
|
||||||
if (gen_header._header_size >= filelen) {
|
if (gen_header._header_size >= filelen) {
|
||||||
log_warning(cds)("Archive file header larger than archive file");
|
aot_log_warning(aot)("Archive file header larger than archive file");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,7 +449,7 @@ public:
|
|||||||
os::lseek(fd, 0, SEEK_SET);
|
os::lseek(fd, 0, SEEK_SET);
|
||||||
n = ::read(fd, (void*)_header, (unsigned int)size);
|
n = ::read(fd, (void*)_header, (unsigned int)size);
|
||||||
if (n != size) {
|
if (n != size) {
|
||||||
log_warning(cds)("Unable to read file map header from %s", file_type);
|
aot_log_warning(aot)("Unable to read file map header from %s", file_type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,9 +494,9 @@ public:
|
|||||||
FileMapHeader* header = (FileMapHeader*)_header;
|
FileMapHeader* header = (FileMapHeader*)_header;
|
||||||
int actual_crc = header->compute_crc();
|
int actual_crc = header->compute_crc();
|
||||||
if (actual_crc != header->crc()) {
|
if (actual_crc != header->crc()) {
|
||||||
log_info(cds)("_crc expected: %d", header->crc());
|
aot_log_info(aot)("_crc expected: %d", header->crc());
|
||||||
log_info(cds)(" actual: %d", actual_crc);
|
aot_log_info(aot)(" actual: %d", actual_crc);
|
||||||
log_warning(cds)("Header checksum verification failed.");
|
aot_log_warning(aot)("Header checksum verification failed.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -508,18 +509,18 @@ public:
|
|||||||
unsigned int header_size = _header->_header_size;
|
unsigned int header_size = _header->_header_size;
|
||||||
|
|
||||||
if (name_offset + name_size < name_offset) {
|
if (name_offset + name_size < name_offset) {
|
||||||
log_warning(cds)("base_archive_name offset/size overflow: " UINT32_FORMAT "/" UINT32_FORMAT,
|
aot_log_warning(aot)("base_archive_name offset/size overflow: " UINT32_FORMAT "/" UINT32_FORMAT,
|
||||||
name_offset, name_size);
|
name_offset, name_size);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_static_archive() || is_preimage_static_archive()) {
|
if (is_static_archive() || is_preimage_static_archive()) {
|
||||||
if (name_offset != 0) {
|
if (name_offset != 0) {
|
||||||
log_warning(cds)("static shared archive must have zero _base_archive_name_offset");
|
aot_log_warning(aot)("static shared archive must have zero _base_archive_name_offset");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (name_size != 0) {
|
if (name_size != 0) {
|
||||||
log_warning(cds)("static shared archive must have zero _base_archive_name_size");
|
aot_log_warning(aot)("static shared archive must have zero _base_archive_name_size");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -527,24 +528,24 @@ public:
|
|||||||
if ((name_size == 0 && name_offset != 0) ||
|
if ((name_size == 0 && name_offset != 0) ||
|
||||||
(name_size != 0 && name_offset == 0)) {
|
(name_size != 0 && name_offset == 0)) {
|
||||||
// If either is zero, both must be zero. This indicates that we are using the default base archive.
|
// If either is zero, both must be zero. This indicates that we are using the default base archive.
|
||||||
log_warning(cds)("Invalid base_archive_name offset/size: " UINT32_FORMAT "/" UINT32_FORMAT,
|
aot_log_warning(aot)("Invalid base_archive_name offset/size: " UINT32_FORMAT "/" UINT32_FORMAT,
|
||||||
name_offset, name_size);
|
name_offset, name_size);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (name_size > 0) {
|
if (name_size > 0) {
|
||||||
if (name_offset + name_size > header_size) {
|
if (name_offset + name_size > header_size) {
|
||||||
log_warning(cds)("Invalid base_archive_name offset/size (out of range): "
|
aot_log_warning(aot)("Invalid base_archive_name offset/size (out of range): "
|
||||||
UINT32_FORMAT " + " UINT32_FORMAT " > " UINT32_FORMAT ,
|
UINT32_FORMAT " + " UINT32_FORMAT " > " UINT32_FORMAT ,
|
||||||
name_offset, name_size, header_size);
|
name_offset, name_size, header_size);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const char* name = ((const char*)_header) + _header->_base_archive_name_offset;
|
const char* name = ((const char*)_header) + _header->_base_archive_name_offset;
|
||||||
if (name[name_size - 1] != '\0' || strlen(name) != name_size - 1) {
|
if (name[name_size - 1] != '\0' || strlen(name) != name_size - 1) {
|
||||||
log_warning(cds)("Base archive name is damaged");
|
aot_log_warning(aot)("Base archive name is damaged");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!os::file_exists(name)) {
|
if (!os::file_exists(name)) {
|
||||||
log_warning(cds)("Base archive %s does not exist", name);
|
aot_log_warning(aot)("Base archive %s does not exist", name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_base_archive_name = name;
|
_base_archive_name = name;
|
||||||
@ -579,7 +580,7 @@ bool FileMapInfo::get_base_archive_name_from_header(const char* archive_name,
|
|||||||
default:
|
default:
|
||||||
assert(header->_magic == CDS_ARCHIVE_MAGIC, "must be");
|
assert(header->_magic == CDS_ARCHIVE_MAGIC, "must be");
|
||||||
if (AutoCreateSharedArchive) {
|
if (AutoCreateSharedArchive) {
|
||||||
log_warning(cds)("AutoCreateSharedArchive is ignored because %s is a static archive", archive_name);
|
aot_log_warning(aot)("AutoCreateSharedArchive is ignored because %s is a static archive", archive_name);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -607,7 +608,7 @@ bool FileMapInfo::is_preimage_static_archive(const char* file) {
|
|||||||
bool FileMapInfo::init_from_file(int fd) {
|
bool FileMapInfo::init_from_file(int fd) {
|
||||||
FileHeaderHelper file_helper(_full_path, _is_static);
|
FileHeaderHelper file_helper(_full_path, _is_static);
|
||||||
if (!file_helper.initialize(fd)) {
|
if (!file_helper.initialize(fd)) {
|
||||||
log_warning(cds)("Unable to read the file header.");
|
aot_log_warning(aot)("Unable to read the file header.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
GenericCDSFileMapHeader* gen_header = file_helper.get_generic_file_header();
|
GenericCDSFileMapHeader* gen_header = file_helper.get_generic_file_header();
|
||||||
@ -619,15 +620,15 @@ bool FileMapInfo::init_from_file(int fd) {
|
|||||||
// Good
|
// Good
|
||||||
} else {
|
} else {
|
||||||
if (CDSConfig::new_aot_flags_used()) {
|
if (CDSConfig::new_aot_flags_used()) {
|
||||||
log_warning(cds)("Not a valid %s (%s)", file_type, _full_path);
|
aot_log_warning(aot)("Not a valid %s (%s)", file_type, _full_path);
|
||||||
} else {
|
} else {
|
||||||
log_warning(cds)("Not a base shared archive: %s", _full_path);
|
aot_log_warning(aot)("Not a base shared archive: %s", _full_path);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (gen_header->_magic != CDS_DYNAMIC_ARCHIVE_MAGIC) {
|
if (gen_header->_magic != CDS_DYNAMIC_ARCHIVE_MAGIC) {
|
||||||
log_warning(cds)("Not a top shared archive: %s", _full_path);
|
aot_log_warning(aot)("Not a top shared archive: %s", _full_path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -637,14 +638,14 @@ bool FileMapInfo::init_from_file(int fd) {
|
|||||||
size_t size = gen_header->_header_size;
|
size_t size = gen_header->_header_size;
|
||||||
size_t n = ::read(fd, (void*)_header, (unsigned int)size);
|
size_t n = ::read(fd, (void*)_header, (unsigned int)size);
|
||||||
if (n != size) {
|
if (n != size) {
|
||||||
log_warning(cds)("Failed to read file header from the top archive file\n");
|
aot_log_warning(aot)("Failed to read file header from the top archive file\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header()->version() != CURRENT_CDS_ARCHIVE_VERSION) {
|
if (header()->version() != CURRENT_CDS_ARCHIVE_VERSION) {
|
||||||
log_info(cds)("_version expected: 0x%x", CURRENT_CDS_ARCHIVE_VERSION);
|
aot_log_info(aot)("_version expected: 0x%x", CURRENT_CDS_ARCHIVE_VERSION);
|
||||||
log_info(cds)(" actual: 0x%x", header()->version());
|
aot_log_info(aot)(" actual: 0x%x", header()->version());
|
||||||
log_warning(cds)("The %s has the wrong version.", file_type);
|
aot_log_warning(aot)("The %s has the wrong version.", file_type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -653,10 +654,10 @@ bool FileMapInfo::init_from_file(int fd) {
|
|||||||
unsigned int header_size = header()->header_size();
|
unsigned int header_size = header()->header_size();
|
||||||
if (base_offset != 0 && name_size != 0) {
|
if (base_offset != 0 && name_size != 0) {
|
||||||
if (header_size != base_offset + name_size) {
|
if (header_size != base_offset + name_size) {
|
||||||
log_info(cds)("_header_size: " UINT32_FORMAT, header_size);
|
aot_log_info(aot)("_header_size: " UINT32_FORMAT, header_size);
|
||||||
log_info(cds)("base_archive_name_size: " UINT32_FORMAT, header()->base_archive_name_size());
|
aot_log_info(aot)("base_archive_name_size: " UINT32_FORMAT, header()->base_archive_name_size());
|
||||||
log_info(cds)("base_archive_name_offset: " UINT32_FORMAT, header()->base_archive_name_offset());
|
aot_log_info(aot)("base_archive_name_offset: " UINT32_FORMAT, header()->base_archive_name_offset());
|
||||||
log_warning(cds)("The %s has an incorrect header size.", file_type);
|
aot_log_warning(aot)("The %s has an incorrect header size.", file_type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -664,16 +665,16 @@ bool FileMapInfo::init_from_file(int fd) {
|
|||||||
const char* actual_ident = header()->jvm_ident();
|
const char* actual_ident = header()->jvm_ident();
|
||||||
|
|
||||||
if (actual_ident[JVM_IDENT_MAX-1] != 0) {
|
if (actual_ident[JVM_IDENT_MAX-1] != 0) {
|
||||||
log_warning(cds)("JVM version identifier is corrupted.");
|
aot_log_warning(aot)("JVM version identifier is corrupted.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char expected_ident[JVM_IDENT_MAX];
|
char expected_ident[JVM_IDENT_MAX];
|
||||||
get_header_version(expected_ident);
|
get_header_version(expected_ident);
|
||||||
if (strncmp(actual_ident, expected_ident, JVM_IDENT_MAX-1) != 0) {
|
if (strncmp(actual_ident, expected_ident, JVM_IDENT_MAX-1) != 0) {
|
||||||
log_info(cds)("_jvm_ident expected: %s", expected_ident);
|
aot_log_info(aot)("_jvm_ident expected: %s", expected_ident);
|
||||||
log_info(cds)(" actual: %s", actual_ident);
|
aot_log_info(aot)(" actual: %s", actual_ident);
|
||||||
log_warning(cds)("The %s was created by a different"
|
aot_log_warning(aot)("The %s was created by a different"
|
||||||
" version or build of HotSpot", file_type);
|
" version or build of HotSpot", file_type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -685,7 +686,7 @@ bool FileMapInfo::init_from_file(int fd) {
|
|||||||
for (int i = 0; i < MetaspaceShared::n_regions; i++) {
|
for (int i = 0; i < MetaspaceShared::n_regions; i++) {
|
||||||
FileMapRegion* r = region_at(i);
|
FileMapRegion* r = region_at(i);
|
||||||
if (r->file_offset() > len || len - r->file_offset() < r->used()) {
|
if (r->file_offset() > len || len - r->file_offset() < r->used()) {
|
||||||
log_warning(cds)("The %s has been truncated.", file_type);
|
aot_log_warning(aot)("The %s has been truncated.", file_type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -695,7 +696,7 @@ bool FileMapInfo::init_from_file(int fd) {
|
|||||||
|
|
||||||
void FileMapInfo::seek_to_position(size_t pos) {
|
void FileMapInfo::seek_to_position(size_t pos) {
|
||||||
if (os::lseek(_fd, (long)pos, SEEK_SET) < 0) {
|
if (os::lseek(_fd, (long)pos, SEEK_SET) < 0) {
|
||||||
log_error(cds)("Unable to seek to position %zu", pos);
|
aot_log_error(aot)("Unable to seek to position %zu", pos);
|
||||||
MetaspaceShared::unrecoverable_loading_error();
|
MetaspaceShared::unrecoverable_loading_error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -708,18 +709,18 @@ bool FileMapInfo::open_for_read() {
|
|||||||
const char* file_type = CDSConfig::type_of_archive_being_loaded();
|
const char* file_type = CDSConfig::type_of_archive_being_loaded();
|
||||||
const char* info = CDSConfig::is_dumping_final_static_archive() ?
|
const char* info = CDSConfig::is_dumping_final_static_archive() ?
|
||||||
"AOTConfiguration file " : "";
|
"AOTConfiguration file " : "";
|
||||||
log_info(cds)("trying to map %s%s", info, _full_path);
|
aot_log_info(aot)("trying to map %s%s", info, _full_path);
|
||||||
int fd = os::open(_full_path, O_RDONLY | O_BINARY, 0);
|
int fd = os::open(_full_path, O_RDONLY | O_BINARY, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
if (errno == ENOENT) {
|
if (errno == ENOENT) {
|
||||||
log_info(cds)("Specified %s not found (%s)", file_type, _full_path);
|
aot_log_info(aot)("Specified %s not found (%s)", file_type, _full_path);
|
||||||
} else {
|
} else {
|
||||||
log_warning(cds)("Failed to open %s (%s)", file_type,
|
aot_log_warning(aot)("Failed to open %s (%s)", file_type,
|
||||||
os::strerror(errno));
|
os::strerror(errno));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
log_info(cds)("Opened %s %s.", file_type, _full_path);
|
aot_log_info(aot)("Opened %s %s.", file_type, _full_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
_fd = fd;
|
_fd = fd;
|
||||||
@ -730,14 +731,14 @@ bool FileMapInfo::open_for_read() {
|
|||||||
// Write the FileMapInfo information to the file.
|
// Write the FileMapInfo information to the file.
|
||||||
|
|
||||||
void FileMapInfo::open_as_output() {
|
void FileMapInfo::open_as_output() {
|
||||||
LogMessage(cds) msg;
|
if (CDSConfig::new_aot_flags_used()) {
|
||||||
if (msg.is_info()) {
|
|
||||||
if (CDSConfig::is_dumping_preimage_static_archive()) {
|
if (CDSConfig::is_dumping_preimage_static_archive()) {
|
||||||
msg.info("Writing binary AOTConfiguration file: ");
|
log_info(aot)("Writing binary AOTConfiguration file: %s", _full_path);
|
||||||
} else {
|
} else {
|
||||||
msg.info("Dumping shared data to file: ");
|
log_info(aot)("Writing binary AOTConfiguration file: %s", _full_path);
|
||||||
}
|
}
|
||||||
msg.info(" %s", _full_path);
|
} else {
|
||||||
|
log_info(cds)("Dumping shared data to file: %s", _full_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WINDOWS // On Windows, need WRITE permission to remove the file.
|
#ifdef _WINDOWS // On Windows, need WRITE permission to remove the file.
|
||||||
@ -749,7 +750,7 @@ void FileMapInfo::open_as_output() {
|
|||||||
remove(_full_path);
|
remove(_full_path);
|
||||||
int fd = os::open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0666);
|
int fd = os::open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0666);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
log_error(cds)("Unable to create %s %s: (%s).", CDSConfig::type_of_archive_being_written(), _full_path,
|
aot_log_error(aot)("Unable to create %s %s: (%s).", CDSConfig::type_of_archive_being_written(), _full_path,
|
||||||
os::strerror(errno));
|
os::strerror(errno));
|
||||||
MetaspaceShared::writing_error();
|
MetaspaceShared::writing_error();
|
||||||
return;
|
return;
|
||||||
@ -815,7 +816,7 @@ bool FileMapRegion::check_region_crc(char* base) const {
|
|||||||
assert(base != nullptr, "must be initialized");
|
assert(base != nullptr, "must be initialized");
|
||||||
int crc = ClassLoader::crc32(0, base, (jint)sz);
|
int crc = ClassLoader::crc32(0, base, (jint)sz);
|
||||||
if (crc != this->crc()) {
|
if (crc != this->crc()) {
|
||||||
log_warning(cds)("Checksum verification failed.");
|
aot_log_warning(aot)("Checksum verification failed.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -837,7 +838,7 @@ BitMapView FileMapInfo::bitmap_view(int region_index, bool is_oopmap) {
|
|||||||
bitmap_base += is_oopmap ? r->oopmap_offset() : r->ptrmap_offset();
|
bitmap_base += is_oopmap ? r->oopmap_offset() : r->ptrmap_offset();
|
||||||
size_t size_in_bits = is_oopmap ? r->oopmap_size_in_bits() : r->ptrmap_size_in_bits();
|
size_t size_in_bits = is_oopmap ? r->oopmap_size_in_bits() : r->ptrmap_size_in_bits();
|
||||||
|
|
||||||
log_debug(cds, reloc)("mapped %s relocation %smap @ " INTPTR_FORMAT " (%zu bits)",
|
aot_log_debug(aot, reloc)("mapped %s relocation %smap @ " INTPTR_FORMAT " (%zu bits)",
|
||||||
region_name(region_index), is_oopmap ? "oop" : "ptr",
|
region_name(region_index), is_oopmap ? "oop" : "ptr",
|
||||||
p2i(bitmap_base), size_in_bits);
|
p2i(bitmap_base), size_in_bits);
|
||||||
|
|
||||||
@ -905,12 +906,12 @@ void FileMapInfo::write_region(int region, char* base, size_t size,
|
|||||||
r->set_file_offset(_file_offset);
|
r->set_file_offset(_file_offset);
|
||||||
int crc = ClassLoader::crc32(0, base, (jint)size);
|
int crc = ClassLoader::crc32(0, base, (jint)size);
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
log_info(cds)("Shared file region (%s) %d: %8zu"
|
aot_log_info(aot)("Shared file region (%s) %d: %8zu"
|
||||||
" bytes, addr " INTPTR_FORMAT " file offset 0x%08" PRIxPTR
|
" bytes, addr " INTPTR_FORMAT " file offset 0x%08" PRIxPTR
|
||||||
" crc 0x%08x",
|
" crc 0x%08x",
|
||||||
region_name(region), region, size, p2i(requested_base), _file_offset, crc);
|
region_name(region), region, size, p2i(requested_base), _file_offset, crc);
|
||||||
} else {
|
} else {
|
||||||
log_info(cds)("Shared file region (%s) %d: %8zu"
|
aot_log_info(aot)("Shared file region (%s) %d: %8zu"
|
||||||
" bytes", region_name(region), region, size);
|
" bytes", region_name(region), region, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1101,11 +1102,11 @@ bool FileMapInfo::remap_shared_readonly_as_readwrite() {
|
|||||||
close();
|
close();
|
||||||
// These have to be errors because the shared region is now unmapped.
|
// These have to be errors because the shared region is now unmapped.
|
||||||
if (base == nullptr) {
|
if (base == nullptr) {
|
||||||
log_error(cds)("Unable to remap shared readonly space (errno=%d).", errno);
|
aot_log_error(aot)("Unable to remap shared readonly space (errno=%d).", errno);
|
||||||
vm_exit(1);
|
vm_exit(1);
|
||||||
}
|
}
|
||||||
if (base != addr) {
|
if (base != addr) {
|
||||||
log_error(cds)("Unable to remap shared readonly space (errno=%d).", errno);
|
aot_log_error(aot)("Unable to remap shared readonly space (errno=%d).", errno);
|
||||||
vm_exit(1);
|
vm_exit(1);
|
||||||
}
|
}
|
||||||
r->set_read_only(false);
|
r->set_read_only(false);
|
||||||
@ -1136,7 +1137,7 @@ MapArchiveResult FileMapInfo::map_regions(int regions[], int num_regions, char*
|
|||||||
assert(r->mapped_base() == last_region->mapped_end(), "must have no gaps");
|
assert(r->mapped_base() == last_region->mapped_end(), "must have no gaps");
|
||||||
}
|
}
|
||||||
last_region = r;)
|
last_region = r;)
|
||||||
log_info(cds)("Mapped %s region #%d at base " INTPTR_FORMAT " top " INTPTR_FORMAT " (%s)", is_static() ? "static " : "dynamic",
|
aot_log_info(aot)("Mapped %s region #%d at base " INTPTR_FORMAT " top " INTPTR_FORMAT " (%s)", is_static() ? "static " : "dynamic",
|
||||||
idx, p2i(r->mapped_base()), p2i(r->mapped_end()),
|
idx, p2i(r->mapped_base()), p2i(r->mapped_end()),
|
||||||
shared_region_name[idx]);
|
shared_region_name[idx]);
|
||||||
|
|
||||||
@ -1153,11 +1154,11 @@ MapArchiveResult FileMapInfo::map_regions(int regions[], int num_regions, char*
|
|||||||
bool FileMapInfo::read_region(int i, char* base, size_t size, bool do_commit) {
|
bool FileMapInfo::read_region(int i, char* base, size_t size, bool do_commit) {
|
||||||
FileMapRegion* r = region_at(i);
|
FileMapRegion* r = region_at(i);
|
||||||
if (do_commit) {
|
if (do_commit) {
|
||||||
log_info(cds)("Commit %s region #%d at base " INTPTR_FORMAT " top " INTPTR_FORMAT " (%s)%s",
|
aot_log_info(aot)("Commit %s region #%d at base " INTPTR_FORMAT " top " INTPTR_FORMAT " (%s)%s",
|
||||||
is_static() ? "static " : "dynamic", i, p2i(base), p2i(base + size),
|
is_static() ? "static " : "dynamic", i, p2i(base), p2i(base + size),
|
||||||
shared_region_name[i], r->allow_exec() ? " exec" : "");
|
shared_region_name[i], r->allow_exec() ? " exec" : "");
|
||||||
if (!os::commit_memory(base, size, r->allow_exec())) {
|
if (!os::commit_memory(base, size, r->allow_exec())) {
|
||||||
log_error(cds)("Failed to commit %s region #%d (%s)", is_static() ? "static " : "dynamic",
|
aot_log_error(aot)("Failed to commit %s region #%d (%s)", is_static() ? "static " : "dynamic",
|
||||||
i, shared_region_name[i]);
|
i, shared_region_name[i]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1206,7 +1207,7 @@ MapArchiveResult FileMapInfo::map_region(int i, intx addr_delta, char* mapped_ba
|
|||||||
// can't mmap into a ReservedSpace, so we just ::read() the data. We're going to patch all the
|
// 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.
|
// regions anyway, so there's no benefit for mmap anyway.
|
||||||
if (!read_region(i, requested_addr, size, /* do_commit = */ true)) {
|
if (!read_region(i, requested_addr, size, /* do_commit = */ true)) {
|
||||||
log_info(cds)("Failed to read %s shared space into reserved space at " INTPTR_FORMAT,
|
aot_log_info(aot)("Failed to read %s shared space into reserved space at " INTPTR_FORMAT,
|
||||||
shared_region_name[i], p2i(requested_addr));
|
shared_region_name[i], p2i(requested_addr));
|
||||||
return MAP_ARCHIVE_OTHER_FAILURE; // oom or I/O error.
|
return MAP_ARCHIVE_OTHER_FAILURE; // oom or I/O error.
|
||||||
} else {
|
} else {
|
||||||
@ -1220,7 +1221,7 @@ MapArchiveResult FileMapInfo::map_region(int i, intx addr_delta, char* mapped_ba
|
|||||||
requested_addr, size, r->read_only(),
|
requested_addr, size, r->read_only(),
|
||||||
r->allow_exec(), mtClassShared);
|
r->allow_exec(), mtClassShared);
|
||||||
if (base != requested_addr) {
|
if (base != requested_addr) {
|
||||||
log_info(cds)("Unable to map %s shared space at " INTPTR_FORMAT,
|
aot_log_info(aot)("Unable to map %s shared space at " INTPTR_FORMAT,
|
||||||
shared_region_name[i], p2i(requested_addr));
|
shared_region_name[i], p2i(requested_addr));
|
||||||
_memory_mapping_failed = true;
|
_memory_mapping_failed = true;
|
||||||
return MAP_ARCHIVE_MMAP_FAILURE;
|
return MAP_ARCHIVE_MMAP_FAILURE;
|
||||||
@ -1260,7 +1261,7 @@ char* FileMapInfo::map_bitmap_region() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (VerifySharedSpaces && !r->check_region_crc(bitmap_base)) {
|
if (VerifySharedSpaces && !r->check_region_crc(bitmap_base)) {
|
||||||
log_error(cds)("relocation bitmap CRC error");
|
aot_log_error(aot)("relocation bitmap CRC error");
|
||||||
if (!os::unmap_memory(bitmap_base, r->used_aligned())) {
|
if (!os::unmap_memory(bitmap_base, r->used_aligned())) {
|
||||||
fatal("os::unmap_memory of relocation bitmap failed");
|
fatal("os::unmap_memory of relocation bitmap failed");
|
||||||
}
|
}
|
||||||
@ -1269,7 +1270,7 @@ char* FileMapInfo::map_bitmap_region() {
|
|||||||
|
|
||||||
r->set_mapped_from_file(true);
|
r->set_mapped_from_file(true);
|
||||||
r->set_mapped_base(bitmap_base);
|
r->set_mapped_base(bitmap_base);
|
||||||
log_info(cds)("Mapped %s region #%d at base " INTPTR_FORMAT " top " INTPTR_FORMAT " (%s)",
|
aot_log_info(aot)("Mapped %s region #%d at base " INTPTR_FORMAT " top " INTPTR_FORMAT " (%s)",
|
||||||
is_static() ? "static " : "dynamic",
|
is_static() ? "static " : "dynamic",
|
||||||
MetaspaceShared::bm, p2i(r->mapped_base()), p2i(r->mapped_end()),
|
MetaspaceShared::bm, p2i(r->mapped_base()), p2i(r->mapped_end()),
|
||||||
shared_region_name[MetaspaceShared::bm]);
|
shared_region_name[MetaspaceShared::bm]);
|
||||||
@ -1286,7 +1287,7 @@ bool FileMapInfo::map_aot_code_region(ReservedSpace rs) {
|
|||||||
char* mapped_base;
|
char* mapped_base;
|
||||||
if (MetaspaceShared::use_windows_memory_mapping()) {
|
if (MetaspaceShared::use_windows_memory_mapping()) {
|
||||||
if (!read_region(MetaspaceShared::ac, requested_base, r->used_aligned(), /* do_commit = */ true)) {
|
if (!read_region(MetaspaceShared::ac, requested_base, r->used_aligned(), /* do_commit = */ true)) {
|
||||||
log_info(cds)("Failed to read aot code shared space into reserved space at " INTPTR_FORMAT,
|
aot_log_info(aot)("Failed to read aot code shared space into reserved space at " INTPTR_FORMAT,
|
||||||
p2i(requested_base));
|
p2i(requested_base));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1299,13 +1300,13 @@ bool FileMapInfo::map_aot_code_region(ReservedSpace rs) {
|
|||||||
requested_base, r->used_aligned(), read_only, allow_exec, mtClassShared);
|
requested_base, r->used_aligned(), read_only, allow_exec, mtClassShared);
|
||||||
}
|
}
|
||||||
if (mapped_base == nullptr) {
|
if (mapped_base == nullptr) {
|
||||||
log_info(cds)("failed to map aot code region");
|
aot_log_info(aot)("failed to map aot code region");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
assert(mapped_base == requested_base, "must be");
|
assert(mapped_base == requested_base, "must be");
|
||||||
r->set_mapped_from_file(true);
|
r->set_mapped_from_file(true);
|
||||||
r->set_mapped_base(mapped_base);
|
r->set_mapped_base(mapped_base);
|
||||||
log_info(cds)("Mapped static region #%d at base " INTPTR_FORMAT " top " INTPTR_FORMAT " (%s)",
|
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()),
|
MetaspaceShared::ac, p2i(r->mapped_base()), p2i(r->mapped_end()),
|
||||||
shared_region_name[MetaspaceShared::ac]);
|
shared_region_name[MetaspaceShared::ac]);
|
||||||
return true;
|
return true;
|
||||||
@ -1341,7 +1342,7 @@ public:
|
|||||||
// This is called when we cannot map the archive at the requested[ base address (usually 0x800000000).
|
// This is called when we cannot map the archive at the requested[ base address (usually 0x800000000).
|
||||||
// We relocate all pointers in the 2 core regions (ro, rw).
|
// We relocate all pointers in the 2 core regions (ro, rw).
|
||||||
bool FileMapInfo::relocate_pointers_in_core_regions(intx addr_delta) {
|
bool FileMapInfo::relocate_pointers_in_core_regions(intx addr_delta) {
|
||||||
log_debug(cds, reloc)("runtime archive relocation start");
|
aot_log_debug(aot, reloc)("runtime archive relocation start");
|
||||||
char* bitmap_base = map_bitmap_region();
|
char* bitmap_base = map_bitmap_region();
|
||||||
|
|
||||||
if (bitmap_base == nullptr) {
|
if (bitmap_base == nullptr) {
|
||||||
@ -1388,7 +1389,7 @@ bool FileMapInfo::relocate_pointers_in_core_regions(intx addr_delta) {
|
|||||||
|
|
||||||
// The MetaspaceShared::bm region will be unmapped in MetaspaceShared::initialize_shared_spaces().
|
// The MetaspaceShared::bm region will be unmapped in MetaspaceShared::initialize_shared_spaces().
|
||||||
|
|
||||||
log_debug(cds, reloc)("runtime archive relocation done");
|
aot_log_debug(aot, reloc)("runtime archive relocation done");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1437,7 +1438,7 @@ MemRegion FileMapInfo::get_heap_region_requested_range() {
|
|||||||
|
|
||||||
address start = heap_region_requested_address();
|
address start = heap_region_requested_address();
|
||||||
address end = start + size;
|
address end = start + size;
|
||||||
log_info(cds)("Requested heap region [" INTPTR_FORMAT " - " INTPTR_FORMAT "] = %8zu bytes",
|
aot_log_info(aot)("Requested heap region [" INTPTR_FORMAT " - " INTPTR_FORMAT "] = %8zu bytes",
|
||||||
p2i(start), p2i(end), size);
|
p2i(start), p2i(end), size);
|
||||||
|
|
||||||
return MemRegion((HeapWord*)start, (HeapWord*)end);
|
return MemRegion((HeapWord*)start, (HeapWord*)end);
|
||||||
@ -1467,7 +1468,7 @@ void FileMapInfo::map_or_load_heap_region() {
|
|||||||
// all AOT-linked classes are visible.
|
// all AOT-linked classes are visible.
|
||||||
//
|
//
|
||||||
// We get here because the heap is too small. The app will fail anyway. So let's quit.
|
// We get here because the heap is too small. The app will fail anyway. So let's quit.
|
||||||
log_error(cds)("%s has aot-linked classes but the archived "
|
aot_log_error(aot)("%s has aot-linked classes but the archived "
|
||||||
"heap objects cannot be loaded. Try increasing your heap size.",
|
"heap objects cannot be loaded. Try increasing your heap size.",
|
||||||
CDSConfig::type_of_archive_being_loaded());
|
CDSConfig::type_of_archive_being_loaded());
|
||||||
MetaspaceShared::unrecoverable_loading_error();
|
MetaspaceShared::unrecoverable_loading_error();
|
||||||
@ -1501,19 +1502,19 @@ bool FileMapInfo::can_use_heap_region() {
|
|||||||
const int archive_narrow_klass_pointer_bits = header()->narrow_klass_pointer_bits();
|
const int archive_narrow_klass_pointer_bits = header()->narrow_klass_pointer_bits();
|
||||||
const int archive_narrow_klass_shift = header()->narrow_klass_shift();
|
const int archive_narrow_klass_shift = header()->narrow_klass_shift();
|
||||||
|
|
||||||
log_info(cds)("CDS archive was created with max heap size = %zuM, and the following configuration:",
|
aot_log_info(aot)("CDS archive was created with max heap size = %zuM, and the following configuration:",
|
||||||
max_heap_size()/M);
|
max_heap_size()/M);
|
||||||
log_info(cds)(" narrow_klass_base at mapping start address, narrow_klass_pointer_bits = %d, narrow_klass_shift = %d",
|
aot_log_info(aot)(" narrow_klass_base at mapping start address, narrow_klass_pointer_bits = %d, narrow_klass_shift = %d",
|
||||||
archive_narrow_klass_pointer_bits, archive_narrow_klass_shift);
|
archive_narrow_klass_pointer_bits, archive_narrow_klass_shift);
|
||||||
log_info(cds)(" narrow_oop_mode = %d, narrow_oop_base = " PTR_FORMAT ", narrow_oop_shift = %d",
|
aot_log_info(aot)(" narrow_oop_mode = %d, narrow_oop_base = " PTR_FORMAT ", narrow_oop_shift = %d",
|
||||||
narrow_oop_mode(), p2i(narrow_oop_base()), narrow_oop_shift());
|
narrow_oop_mode(), p2i(narrow_oop_base()), narrow_oop_shift());
|
||||||
log_info(cds)("The current max heap size = %zuM, G1HeapRegion::GrainBytes = %zu",
|
aot_log_info(aot)("The current max heap size = %zuM, G1HeapRegion::GrainBytes = %zu",
|
||||||
MaxHeapSize/M, G1HeapRegion::GrainBytes);
|
MaxHeapSize/M, G1HeapRegion::GrainBytes);
|
||||||
log_info(cds)(" narrow_klass_base = " PTR_FORMAT ", arrow_klass_pointer_bits = %d, narrow_klass_shift = %d",
|
aot_log_info(aot)(" narrow_klass_base = " PTR_FORMAT ", arrow_klass_pointer_bits = %d, narrow_klass_shift = %d",
|
||||||
p2i(CompressedKlassPointers::base()), CompressedKlassPointers::narrow_klass_pointer_bits(), CompressedKlassPointers::shift());
|
p2i(CompressedKlassPointers::base()), CompressedKlassPointers::narrow_klass_pointer_bits(), CompressedKlassPointers::shift());
|
||||||
log_info(cds)(" narrow_oop_mode = %d, narrow_oop_base = " PTR_FORMAT ", narrow_oop_shift = %d",
|
aot_log_info(aot)(" narrow_oop_mode = %d, narrow_oop_base = " PTR_FORMAT ", narrow_oop_shift = %d",
|
||||||
CompressedOops::mode(), p2i(CompressedOops::base()), CompressedOops::shift());
|
CompressedOops::mode(), p2i(CompressedOops::base()), CompressedOops::shift());
|
||||||
log_info(cds)(" heap range = [" PTR_FORMAT " - " PTR_FORMAT "]",
|
aot_log_info(aot)(" heap range = [" PTR_FORMAT " - " PTR_FORMAT "]",
|
||||||
UseCompressedOops ? p2i(CompressedOops::begin()) :
|
UseCompressedOops ? p2i(CompressedOops::begin()) :
|
||||||
UseG1GC ? p2i((address)G1CollectedHeap::heap()->reserved().start()) : 0L,
|
UseG1GC ? p2i((address)G1CollectedHeap::heap()->reserved().start()) : 0L,
|
||||||
UseCompressedOops ? p2i(CompressedOops::end()) :
|
UseCompressedOops ? p2i(CompressedOops::end()) :
|
||||||
@ -1631,7 +1632,7 @@ bool FileMapInfo::map_heap_region_impl() {
|
|||||||
size_t word_size = size / HeapWordSize;
|
size_t word_size = size / HeapWordSize;
|
||||||
address requested_start = heap_region_requested_address();
|
address requested_start = heap_region_requested_address();
|
||||||
|
|
||||||
log_info(cds)("Preferred address to map heap data (to avoid relocation) is " INTPTR_FORMAT, p2i(requested_start));
|
aot_log_info(aot)("Preferred address to map heap data (to avoid relocation) is " INTPTR_FORMAT, p2i(requested_start));
|
||||||
|
|
||||||
// allocate from java heap
|
// allocate from java heap
|
||||||
HeapWord* start = G1CollectedHeap::heap()->alloc_archive_region(word_size, (HeapWord*)requested_start);
|
HeapWord* start = G1CollectedHeap::heap()->alloc_archive_region(word_size, (HeapWord*)requested_start);
|
||||||
@ -1652,7 +1653,7 @@ bool FileMapInfo::map_heap_region_impl() {
|
|||||||
align_up(_mapped_heap_memregion.byte_size(), os::vm_page_size()),
|
align_up(_mapped_heap_memregion.byte_size(), os::vm_page_size()),
|
||||||
/* do_commit = */ true)) {
|
/* do_commit = */ true)) {
|
||||||
dealloc_heap_region();
|
dealloc_heap_region();
|
||||||
log_error(cds)("Failed to read archived heap region into " INTPTR_FORMAT, p2i(addr));
|
aot_log_error(aot)("Failed to read archived heap region into " INTPTR_FORMAT, p2i(addr));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Checks for VerifySharedSpaces is already done inside read_region()
|
// Checks for VerifySharedSpaces is already done inside read_region()
|
||||||
@ -1663,7 +1664,7 @@ bool FileMapInfo::map_heap_region_impl() {
|
|||||||
r->allow_exec(), mtJavaHeap);
|
r->allow_exec(), mtJavaHeap);
|
||||||
if (base == nullptr || base != addr) {
|
if (base == nullptr || base != addr) {
|
||||||
dealloc_heap_region();
|
dealloc_heap_region();
|
||||||
log_info(cds)("UseSharedSpaces: Unable to map at required address in java heap. "
|
aot_log_info(aot)("UseSharedSpaces: Unable to map at required address in java heap. "
|
||||||
INTPTR_FORMAT ", size = %zu bytes",
|
INTPTR_FORMAT ", size = %zu bytes",
|
||||||
p2i(addr), _mapped_heap_memregion.byte_size());
|
p2i(addr), _mapped_heap_memregion.byte_size());
|
||||||
return false;
|
return false;
|
||||||
@ -1701,9 +1702,9 @@ bool FileMapInfo::map_heap_region_impl() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log_info(cds)("Heap data mapped at " INTPTR_FORMAT ", size = %8zu bytes",
|
aot_log_info(aot)("Heap data mapped at " INTPTR_FORMAT ", size = %8zu bytes",
|
||||||
p2i(mapped_start), _mapped_heap_memregion.byte_size());
|
p2i(mapped_start), _mapped_heap_memregion.byte_size());
|
||||||
log_info(cds)("CDS heap data relocation delta = %zd bytes", delta);
|
aot_log_info(aot)("CDS heap data relocation delta = %zd bytes", delta);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1763,12 +1764,12 @@ void FileMapInfo::unmap_region(int i) {
|
|||||||
|
|
||||||
if (mapped_base != nullptr) {
|
if (mapped_base != nullptr) {
|
||||||
if (size > 0 && r->mapped_from_file()) {
|
if (size > 0 && r->mapped_from_file()) {
|
||||||
log_info(cds)("Unmapping region #%d at base " INTPTR_FORMAT " (%s)", i, p2i(mapped_base),
|
aot_log_info(aot)("Unmapping region #%d at base " INTPTR_FORMAT " (%s)", i, p2i(mapped_base),
|
||||||
shared_region_name[i]);
|
shared_region_name[i]);
|
||||||
if (r->in_reserved_space()) {
|
if (r->in_reserved_space()) {
|
||||||
// This region was mapped inside a ReservedSpace. Its memory will be freed when the ReservedSpace
|
// This region was mapped inside a ReservedSpace. Its memory will be freed when the ReservedSpace
|
||||||
// is released. Zero it so that we don't accidentally read its content.
|
// is released. Zero it so that we don't accidentally read its content.
|
||||||
log_info(cds)("Region #%d (%s) is in a reserved space, it will be freed when the space is released", i, shared_region_name[i]);
|
aot_log_info(aot)("Region #%d (%s) is in a reserved space, it will be freed when the space is released", i, shared_region_name[i]);
|
||||||
} else {
|
} else {
|
||||||
if (!os::unmap_memory(mapped_base, size)) {
|
if (!os::unmap_memory(mapped_base, size)) {
|
||||||
fatal("os::unmap_memory failed");
|
fatal("os::unmap_memory failed");
|
||||||
@ -1835,31 +1836,31 @@ bool FileMapInfo::validate_aot_class_linking() {
|
|||||||
const char* archive_type = CDSConfig::type_of_archive_being_loaded();
|
const char* archive_type = CDSConfig::type_of_archive_being_loaded();
|
||||||
CDSConfig::set_has_aot_linked_classes(true);
|
CDSConfig::set_has_aot_linked_classes(true);
|
||||||
if (JvmtiExport::should_post_class_file_load_hook()) {
|
if (JvmtiExport::should_post_class_file_load_hook()) {
|
||||||
log_error(cds)("%s has aot-linked classes. It cannot be used when JVMTI ClassFileLoadHook is in use.",
|
aot_log_error(aot)("%s has aot-linked classes. It cannot be used when JVMTI ClassFileLoadHook is in use.",
|
||||||
archive_type);
|
archive_type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (JvmtiExport::has_early_vmstart_env()) {
|
if (JvmtiExport::has_early_vmstart_env()) {
|
||||||
log_error(cds)("%s has aot-linked classes. It cannot be used when JVMTI early vm start is in use.",
|
aot_log_error(aot)("%s has aot-linked classes. It cannot be used when JVMTI early vm start is in use.",
|
||||||
archive_type);
|
archive_type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!CDSConfig::is_using_full_module_graph()) {
|
if (!CDSConfig::is_using_full_module_graph()) {
|
||||||
log_error(cds)("%s has aot-linked classes. It cannot be used when archived full module graph is not used.",
|
aot_log_error(aot)("%s has aot-linked classes. It cannot be used when archived full module graph is not used.",
|
||||||
archive_type);
|
archive_type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* prop = Arguments::get_property("java.security.manager");
|
const char* prop = Arguments::get_property("java.security.manager");
|
||||||
if (prop != nullptr && strcmp(prop, "disallow") != 0) {
|
if (prop != nullptr && strcmp(prop, "disallow") != 0) {
|
||||||
log_error(cds)("%s has aot-linked classes. It cannot be used with -Djava.security.manager=%s.",
|
aot_log_error(aot)("%s has aot-linked classes. It cannot be used with -Djava.security.manager=%s.",
|
||||||
archive_type, prop);
|
archive_type, prop);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if INCLUDE_JVMTI
|
#if INCLUDE_JVMTI
|
||||||
if (Arguments::has_jdwp_agent()) {
|
if (Arguments::has_jdwp_agent()) {
|
||||||
log_error(cds)("%s has aot-linked classes. It cannot be used with JDWP agent", archive_type);
|
aot_log_error(aot)("%s has aot-linked classes. It cannot be used with JDWP agent", archive_type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1901,13 +1902,13 @@ int FileMapHeader::compute_crc() {
|
|||||||
bool FileMapHeader::validate() {
|
bool FileMapHeader::validate() {
|
||||||
const char* file_type = CDSConfig::type_of_archive_being_loaded();
|
const char* file_type = CDSConfig::type_of_archive_being_loaded();
|
||||||
if (_obj_alignment != ObjectAlignmentInBytes) {
|
if (_obj_alignment != ObjectAlignmentInBytes) {
|
||||||
log_info(cds)("The %s's ObjectAlignmentInBytes of %d"
|
aot_log_info(aot)("The %s's ObjectAlignmentInBytes of %d"
|
||||||
" does not equal the current ObjectAlignmentInBytes of %d.",
|
" does not equal the current ObjectAlignmentInBytes of %d.",
|
||||||
file_type, _obj_alignment, ObjectAlignmentInBytes);
|
file_type, _obj_alignment, ObjectAlignmentInBytes);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (_compact_strings != CompactStrings) {
|
if (_compact_strings != CompactStrings) {
|
||||||
log_info(cds)("The %s's CompactStrings setting (%s)"
|
aot_log_info(aot)("The %s's CompactStrings setting (%s)"
|
||||||
" does not equal the current CompactStrings setting (%s).", file_type,
|
" does not equal the current CompactStrings setting (%s).", file_type,
|
||||||
_compact_strings ? "enabled" : "disabled",
|
_compact_strings ? "enabled" : "disabled",
|
||||||
CompactStrings ? "enabled" : "disabled");
|
CompactStrings ? "enabled" : "disabled");
|
||||||
@ -1919,11 +1920,11 @@ bool FileMapHeader::validate() {
|
|||||||
const char* prop = Arguments::get_property("java.system.class.loader");
|
const char* prop = Arguments::get_property("java.system.class.loader");
|
||||||
if (prop != nullptr) {
|
if (prop != nullptr) {
|
||||||
if (has_aot_linked_classes()) {
|
if (has_aot_linked_classes()) {
|
||||||
log_error(cds)("%s has aot-linked classes. It cannot be used when the "
|
aot_log_error(aot)("%s has aot-linked classes. It cannot be used when the "
|
||||||
"java.system.class.loader property is specified.", CDSConfig::type_of_archive_being_loaded());
|
"java.system.class.loader property is specified.", CDSConfig::type_of_archive_being_loaded());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
log_warning(cds)("Archived non-system classes are disabled because the "
|
aot_log_warning(aot)("Archived non-system classes are disabled because the "
|
||||||
"java.system.class.loader property is specified (value = \"%s\"). "
|
"java.system.class.loader property is specified (value = \"%s\"). "
|
||||||
"To use archived non-system classes, this property must not be set", prop);
|
"To use archived non-system classes, this property must not be set", prop);
|
||||||
_has_platform_or_app_classes = false;
|
_has_platform_or_app_classes = false;
|
||||||
@ -1932,7 +1933,7 @@ bool FileMapHeader::validate() {
|
|||||||
|
|
||||||
if (!_verify_local && BytecodeVerificationLocal) {
|
if (!_verify_local && BytecodeVerificationLocal) {
|
||||||
// we cannot load boot classes, so there's no point of using the CDS archive
|
// we cannot load boot classes, so there's no point of using the CDS archive
|
||||||
log_info(cds)("The %s's BytecodeVerificationLocal setting (%s)"
|
aot_log_info(aot)("The %s's BytecodeVerificationLocal setting (%s)"
|
||||||
" does not equal the current BytecodeVerificationLocal setting (%s).", file_type,
|
" does not equal the current BytecodeVerificationLocal setting (%s).", file_type,
|
||||||
_verify_local ? "enabled" : "disabled",
|
_verify_local ? "enabled" : "disabled",
|
||||||
BytecodeVerificationLocal ? "enabled" : "disabled");
|
BytecodeVerificationLocal ? "enabled" : "disabled");
|
||||||
@ -1944,7 +1945,7 @@ bool FileMapHeader::validate() {
|
|||||||
if (_has_platform_or_app_classes
|
if (_has_platform_or_app_classes
|
||||||
&& !_verify_remote // we didn't verify the archived platform/app classes
|
&& !_verify_remote // we didn't verify the archived platform/app classes
|
||||||
&& BytecodeVerificationRemote) { // but we want to verify all loaded platform/app classes
|
&& BytecodeVerificationRemote) { // but we want to verify all loaded platform/app classes
|
||||||
log_info(cds)("The %s was created with less restrictive "
|
aot_log_info(aot)("The %s was created with less restrictive "
|
||||||
"verification setting than the current setting.", file_type);
|
"verification setting than the current setting.", file_type);
|
||||||
// Pretend that we didn't have any archived platform/app classes, so they won't be loaded
|
// Pretend that we didn't have any archived platform/app classes, so they won't be loaded
|
||||||
// by SystemDictionaryShared.
|
// by SystemDictionaryShared.
|
||||||
@ -1956,26 +1957,26 @@ bool FileMapHeader::validate() {
|
|||||||
// Note: _allow_archiving_with_java_agent is set in the shared archive during dump time
|
// Note: _allow_archiving_with_java_agent is set in the shared archive during dump time
|
||||||
// while AllowArchivingWithJavaAgent is set during the current run.
|
// while AllowArchivingWithJavaAgent is set during the current run.
|
||||||
if (_allow_archiving_with_java_agent && !AllowArchivingWithJavaAgent) {
|
if (_allow_archiving_with_java_agent && !AllowArchivingWithJavaAgent) {
|
||||||
log_warning(cds)("The setting of the AllowArchivingWithJavaAgent is different "
|
aot_log_warning(aot)("The setting of the AllowArchivingWithJavaAgent is different "
|
||||||
"from the setting in the %s.", file_type);
|
"from the setting in the %s.", file_type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_allow_archiving_with_java_agent) {
|
if (_allow_archiving_with_java_agent) {
|
||||||
log_warning(cds)("This %s was created with AllowArchivingWithJavaAgent. It should be used "
|
aot_log_warning(aot)("This %s was created with AllowArchivingWithJavaAgent. It should be used "
|
||||||
"for testing purposes only and should not be used in a production environment", file_type);
|
"for testing purposes only and should not be used in a production environment", file_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_info(cds)("The %s was created with UseCompressedOops = %d, UseCompressedClassPointers = %d, UseCompactObjectHeaders = %d",
|
aot_log_info(aot)("The %s was created with UseCompressedOops = %d, UseCompressedClassPointers = %d, UseCompactObjectHeaders = %d",
|
||||||
file_type, compressed_oops(), compressed_class_pointers(), compact_headers());
|
file_type, compressed_oops(), compressed_class_pointers(), compact_headers());
|
||||||
if (compressed_oops() != UseCompressedOops || compressed_class_pointers() != UseCompressedClassPointers) {
|
if (compressed_oops() != UseCompressedOops || compressed_class_pointers() != UseCompressedClassPointers) {
|
||||||
log_warning(cds)("Unable to use %s.\nThe saved state of UseCompressedOops and UseCompressedClassPointers is "
|
aot_log_warning(aot)("Unable to use %s.\nThe saved state of UseCompressedOops and UseCompressedClassPointers is "
|
||||||
"different from runtime, CDS will be disabled.", file_type);
|
"different from runtime, CDS will be disabled.", file_type);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compact_headers() != UseCompactObjectHeaders) {
|
if (compact_headers() != UseCompactObjectHeaders) {
|
||||||
log_warning(cds)("Unable to use %s.\nThe %s's UseCompactObjectHeaders setting (%s)"
|
aot_log_warning(aot)("Unable to use %s.\nThe %s's UseCompactObjectHeaders setting (%s)"
|
||||||
" does not equal the current UseCompactObjectHeaders setting (%s).", file_type, file_type,
|
" does not equal the current UseCompactObjectHeaders setting (%s).", file_type, file_type,
|
||||||
_compact_headers ? "enabled" : "disabled",
|
_compact_headers ? "enabled" : "disabled",
|
||||||
UseCompactObjectHeaders ? "enabled" : "disabled");
|
UseCompactObjectHeaders ? "enabled" : "disabled");
|
||||||
@ -1984,7 +1985,7 @@ bool FileMapHeader::validate() {
|
|||||||
|
|
||||||
if (!_use_optimized_module_handling && !CDSConfig::is_dumping_final_static_archive()) {
|
if (!_use_optimized_module_handling && !CDSConfig::is_dumping_final_static_archive()) {
|
||||||
CDSConfig::stop_using_optimized_module_handling();
|
CDSConfig::stop_using_optimized_module_handling();
|
||||||
log_info(cds)("optimized module handling: disabled because archive was created without optimized module handling");
|
aot_log_info(aot)("optimized module handling: disabled because archive was created without optimized module handling");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_static()) {
|
if (is_static()) {
|
||||||
@ -2072,7 +2073,7 @@ ClassFileStream* FileMapInfo::open_stream_for_jvmti(InstanceKlass* ik, Handle cl
|
|||||||
cfs = cpe->open_stream_for_loader(THREAD, file_name, loader_data);
|
cfs = cpe->open_stream_for_loader(THREAD, file_name, loader_data);
|
||||||
}
|
}
|
||||||
assert(cfs != nullptr, "must be able to read the classfile data of shared classes for built-in loaders.");
|
assert(cfs != nullptr, "must be able to read the classfile data of shared classes for built-in loaders.");
|
||||||
log_debug(cds, jvmti)("classfile data for %s [%d: %s] = %d bytes", class_name, path_index,
|
log_debug(aot, jvmti)("classfile data for %s [%d: %s] = %d bytes", class_name, path_index,
|
||||||
cfs->source(), cfs->length());
|
cfs->source(), cfs->length());
|
||||||
return cfs;
|
return cfs;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -181,9 +181,9 @@ void FinalImageRecipes::load_all_classes(TRAPS) {
|
|||||||
Klass* actual = SystemDictionary::resolve_or_fail(ik->name(), class_loader, true, CHECK);
|
Klass* actual = SystemDictionary::resolve_or_fail(ik->name(), class_loader, true, CHECK);
|
||||||
if (actual != ik) {
|
if (actual != ik) {
|
||||||
ResourceMark rm(THREAD);
|
ResourceMark rm(THREAD);
|
||||||
log_error(cds)("Unable to resolve class from CDS archive: %s", ik->external_name());
|
log_error(aot)("Unable to resolve class from CDS archive: %s", ik->external_name());
|
||||||
log_error(cds)("Expected: " INTPTR_FORMAT ", actual: " INTPTR_FORMAT, p2i(ik), p2i(actual));
|
log_error(aot)("Expected: " INTPTR_FORMAT ", actual: " INTPTR_FORMAT, p2i(ik), p2i(actual));
|
||||||
log_error(cds)("Please check if your VM command-line is the same as in the training run");
|
log_error(aot)("Please check if your VM command-line is the same as in the training run");
|
||||||
MetaspaceShared::unrecoverable_writing_error();
|
MetaspaceShared::unrecoverable_writing_error();
|
||||||
}
|
}
|
||||||
assert(ik->is_loaded(), "must be");
|
assert(ik->is_loaded(), "must be");
|
||||||
@ -205,9 +205,9 @@ void FinalImageRecipes::apply_recipes(TRAPS) {
|
|||||||
if (_final_image_recipes != nullptr) {
|
if (_final_image_recipes != nullptr) {
|
||||||
_final_image_recipes->apply_recipes_impl(THREAD);
|
_final_image_recipes->apply_recipes_impl(THREAD);
|
||||||
if (HAS_PENDING_EXCEPTION) {
|
if (HAS_PENDING_EXCEPTION) {
|
||||||
log_error(cds)("%s: %s", PENDING_EXCEPTION->klass()->external_name(),
|
log_error(aot)("%s: %s", PENDING_EXCEPTION->klass()->external_name(),
|
||||||
java_lang_String::as_utf8_string(java_lang_Throwable::message(PENDING_EXCEPTION)));
|
java_lang_String::as_utf8_string(java_lang_Throwable::message(PENDING_EXCEPTION)));
|
||||||
log_error(cds)("Please check if your VM command-line is the same as in the training run");
|
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:cds,exceptions=trace for detail");
|
MetaspaceShared::unrecoverable_writing_error("Unexpected exception, use -Xlog:cds,exceptions=trace for detail");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
#include "cds/aotArtifactFinder.hpp"
|
#include "cds/aotArtifactFinder.hpp"
|
||||||
#include "cds/aotClassInitializer.hpp"
|
#include "cds/aotClassInitializer.hpp"
|
||||||
#include "cds/aotClassLocation.hpp"
|
#include "cds/aotClassLocation.hpp"
|
||||||
|
#include "cds/aotLogging.hpp"
|
||||||
#include "cds/aotReferenceObjSupport.hpp"
|
#include "cds/aotReferenceObjSupport.hpp"
|
||||||
#include "cds/archiveBuilder.hpp"
|
#include "cds/archiveBuilder.hpp"
|
||||||
#include "cds/archiveHeapLoader.hpp"
|
#include "cds/archiveHeapLoader.hpp"
|
||||||
@ -174,9 +175,9 @@ static void reset_states(oop obj, TRAPS) {
|
|||||||
Method* method = klass->find_method(method_name, method_sig);
|
Method* method = klass->find_method(method_name, method_sig);
|
||||||
if (method != nullptr) {
|
if (method != nullptr) {
|
||||||
assert(method->is_private(), "must be");
|
assert(method->is_private(), "must be");
|
||||||
if (log_is_enabled(Debug, cds)) {
|
if (log_is_enabled(Debug, aot)) {
|
||||||
ResourceMark rm(THREAD);
|
ResourceMark rm(THREAD);
|
||||||
log_debug(cds)(" calling %s", method->name_and_sig_as_C_string());
|
log_debug(aot)(" calling %s", method->name_and_sig_as_C_string());
|
||||||
}
|
}
|
||||||
JavaValue result(T_VOID);
|
JavaValue result(T_VOID);
|
||||||
JavaCalls::call_special(&result, h_obj, klass,
|
JavaCalls::call_special(&result, h_obj, klass,
|
||||||
@ -188,9 +189,9 @@ static void reset_states(oop obj, TRAPS) {
|
|||||||
|
|
||||||
void HeapShared::reset_archived_object_states(TRAPS) {
|
void HeapShared::reset_archived_object_states(TRAPS) {
|
||||||
assert(CDSConfig::is_dumping_heap(), "dump-time only");
|
assert(CDSConfig::is_dumping_heap(), "dump-time only");
|
||||||
log_debug(cds)("Resetting platform loader");
|
log_debug(aot)("Resetting platform loader");
|
||||||
reset_states(SystemDictionary::java_platform_loader(), CHECK);
|
reset_states(SystemDictionary::java_platform_loader(), CHECK);
|
||||||
log_debug(cds)("Resetting system loader");
|
log_debug(aot)("Resetting system loader");
|
||||||
reset_states(SystemDictionary::java_system_loader(), CHECK);
|
reset_states(SystemDictionary::java_system_loader(), CHECK);
|
||||||
|
|
||||||
// Clean up jdk.internal.loader.ClassLoaders::bootLoader(), which is not
|
// Clean up jdk.internal.loader.ClassLoaders::bootLoader(), which is not
|
||||||
@ -200,7 +201,7 @@ void HeapShared::reset_archived_object_states(TRAPS) {
|
|||||||
// Note, this object is non-null, and is not the same as
|
// Note, this object is non-null, and is not the same as
|
||||||
// ClassLoaderData::the_null_class_loader_data()->class_loader(),
|
// ClassLoaderData::the_null_class_loader_data()->class_loader(),
|
||||||
// which is null.
|
// which is null.
|
||||||
log_debug(cds)("Resetting boot loader");
|
log_debug(aot)("Resetting boot loader");
|
||||||
JavaValue result(T_OBJECT);
|
JavaValue result(T_OBJECT);
|
||||||
JavaCalls::call_static(&result,
|
JavaCalls::call_static(&result,
|
||||||
vmClasses::jdk_internal_loader_ClassLoaders_klass(),
|
vmClasses::jdk_internal_loader_ClassLoaders_klass(),
|
||||||
@ -277,9 +278,9 @@ void HeapShared::clear_root(int index) {
|
|||||||
if (ArchiveHeapLoader::is_in_use()) {
|
if (ArchiveHeapLoader::is_in_use()) {
|
||||||
int seg_idx, int_idx;
|
int seg_idx, int_idx;
|
||||||
get_segment_indexes(index, seg_idx, int_idx);
|
get_segment_indexes(index, seg_idx, int_idx);
|
||||||
if (log_is_enabled(Debug, cds, heap)) {
|
if (log_is_enabled(Debug, aot, heap)) {
|
||||||
oop old = root_segment(seg_idx)->obj_at(int_idx);
|
oop old = root_segment(seg_idx)->obj_at(int_idx);
|
||||||
log_debug(cds, heap)("Clearing root %d: was " PTR_FORMAT, index, p2i(old));
|
log_debug(aot, heap)("Clearing root %d: was " PTR_FORMAT, index, p2i(old));
|
||||||
}
|
}
|
||||||
root_segment(seg_idx)->obj_at_put(int_idx, nullptr);
|
root_segment(seg_idx)->obj_at_put(int_idx, nullptr);
|
||||||
}
|
}
|
||||||
@ -294,7 +295,7 @@ bool HeapShared::archive_object(oop obj, oop referrer, KlassSubGraphInfo* subgra
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ArchiveHeapWriter::is_too_large_to_archive(obj->size())) {
|
if (ArchiveHeapWriter::is_too_large_to_archive(obj->size())) {
|
||||||
log_debug(cds, heap)("Cannot archive, object (" PTR_FORMAT ") is too large: %zu",
|
log_debug(aot, heap)("Cannot archive, object (" PTR_FORMAT ") is too large: %zu",
|
||||||
p2i(obj), obj->size());
|
p2i(obj), obj->size());
|
||||||
debug_trace();
|
debug_trace();
|
||||||
return false;
|
return false;
|
||||||
@ -342,9 +343,9 @@ bool HeapShared::archive_object(oop obj, oop referrer, KlassSubGraphInfo* subgra
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (log_is_enabled(Debug, cds, heap)) {
|
if (log_is_enabled(Debug, aot, heap)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
LogTarget(Debug, cds, heap) log;
|
LogTarget(Debug, aot, heap) log;
|
||||||
LogStream out(log);
|
LogStream out(log);
|
||||||
out.print("Archived heap object " PTR_FORMAT " : %s ",
|
out.print("Archived heap object " PTR_FORMAT " : %s ",
|
||||||
p2i(obj), obj->klass()->external_name());
|
p2i(obj), obj->klass()->external_name());
|
||||||
@ -569,9 +570,9 @@ void HeapShared::copy_and_rescan_aot_inited_mirror(InstanceKlass* ik) {
|
|||||||
assert(success, "sanity");
|
assert(success, "sanity");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (log_is_enabled(Debug, cds, init)) {
|
if (log_is_enabled(Debug, aot, init)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_debug(cds, init)("copied %3d field(s) in aot-initialized mirror %s%s%s", nfields, ik->external_name(),
|
log_debug(aot, init)("copied %3d field(s) in aot-initialized mirror %s%s%s", nfields, ik->external_name(),
|
||||||
ik->is_hidden() ? " (hidden)" : "",
|
ik->is_hidden() ? " (hidden)" : "",
|
||||||
ik->is_enum_subclass() ? " (enum)" : "");
|
ik->is_enum_subclass() ? " (enum)" : "");
|
||||||
}
|
}
|
||||||
@ -654,7 +655,7 @@ void HeapShared::start_scanning_for_oops() {
|
|||||||
create_archived_object_cache();
|
create_archived_object_cache();
|
||||||
|
|
||||||
if (UseCompressedOops || UseG1GC) {
|
if (UseCompressedOops || UseG1GC) {
|
||||||
log_info(cds)("Heap range = [" PTR_FORMAT " - " PTR_FORMAT "]",
|
aot_log_info(aot)("Heap range = [" PTR_FORMAT " - " PTR_FORMAT "]",
|
||||||
UseCompressedOops ? p2i(CompressedOops::begin()) :
|
UseCompressedOops ? p2i(CompressedOops::begin()) :
|
||||||
p2i((address)G1CollectedHeap::heap()->reserved().start()),
|
p2i((address)G1CollectedHeap::heap()->reserved().start()),
|
||||||
UseCompressedOops ? p2i(CompressedOops::end()) :
|
UseCompressedOops ? p2i(CompressedOops::end()) :
|
||||||
@ -817,10 +818,10 @@ void KlassSubGraphInfo::add_subgraph_object_klass(Klass* orig_k) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (log_is_enabled(Debug, cds, heap)) {
|
if (log_is_enabled(Debug, aot, heap)) {
|
||||||
if (!_subgraph_object_klasses->contains(orig_k)) {
|
if (!_subgraph_object_klasses->contains(orig_k)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_debug(cds, heap)("Adding klass %s", orig_k->external_name());
|
log_debug(aot, heap)("Adding klass %s", orig_k->external_name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -863,7 +864,7 @@ void KlassSubGraphInfo::check_allowed_klass(InstanceKlass* ik) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_error(cds, heap)("Class %s not allowed in archive heap. Must be in java.base%s%s",
|
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);
|
ik->external_name(), lambda_msg, testcls_msg);
|
||||||
MetaspaceShared::unrecoverable_writing_error();
|
MetaspaceShared::unrecoverable_writing_error();
|
||||||
}
|
}
|
||||||
@ -875,7 +876,7 @@ bool KlassSubGraphInfo::is_non_early_klass(Klass* k) {
|
|||||||
if (k->is_instance_klass()) {
|
if (k->is_instance_klass()) {
|
||||||
if (!SystemDictionaryShared::is_early_klass(InstanceKlass::cast(k))) {
|
if (!SystemDictionaryShared::is_early_klass(InstanceKlass::cast(k))) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_info(cds, heap)("non-early: %s", k->external_name());
|
log_info(aot, heap)("non-early: %s", k->external_name());
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@ -903,7 +904,7 @@ void ArchivedKlassSubGraphInfoRecord::init(KlassSubGraphInfo* info) {
|
|||||||
|
|
||||||
if (_has_non_early_klasses) {
|
if (_has_non_early_klasses) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_info(cds, heap)(
|
log_info(aot, heap)(
|
||||||
"Subgraph of klass %s has non-early klasses and cannot be used when JVMTI ClassFileLoadHook is enabled",
|
"Subgraph of klass %s has non-early klasses and cannot be used when JVMTI ClassFileLoadHook is enabled",
|
||||||
_k->external_name());
|
_k->external_name());
|
||||||
}
|
}
|
||||||
@ -942,13 +943,13 @@ void ArchivedKlassSubGraphInfoRecord::init(KlassSubGraphInfo* info) {
|
|||||||
if (subgraph_k->has_aot_initialized_mirror()) {
|
if (subgraph_k->has_aot_initialized_mirror()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (log_is_enabled(Info, cds, heap)) {
|
if (log_is_enabled(Info, aot, heap)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
const char* owner_name = is_special ? "<special>" : _k->external_name();
|
const char* owner_name = is_special ? "<special>" : _k->external_name();
|
||||||
if (subgraph_k->is_instance_klass()) {
|
if (subgraph_k->is_instance_klass()) {
|
||||||
InstanceKlass* src_ik = InstanceKlass::cast(ArchiveBuilder::current()->get_source_addr(subgraph_k));
|
InstanceKlass* src_ik = InstanceKlass::cast(ArchiveBuilder::current()->get_source_addr(subgraph_k));
|
||||||
}
|
}
|
||||||
log_info(cds, heap)(
|
log_info(aot, heap)(
|
||||||
"Archived object klass %s (%2d) => %s",
|
"Archived object klass %s (%2d) => %s",
|
||||||
owner_name, n, subgraph_k->external_name());
|
owner_name, n, subgraph_k->external_name());
|
||||||
}
|
}
|
||||||
@ -1017,7 +1018,7 @@ void HeapShared::write_subgraph_info_table() {
|
|||||||
_archived_ArchiveHeapTestClass = array;
|
_archived_ArchiveHeapTestClass = array;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (log_is_enabled(Info, cds, heap)) {
|
if (log_is_enabled(Info, aot, heap)) {
|
||||||
print_stats();
|
print_stats();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1052,7 +1053,7 @@ void HeapShared::serialize_tables(SerializeClosure* soc) {
|
|||||||
static void verify_the_heap(Klass* k, const char* which) {
|
static void verify_the_heap(Klass* k, const char* which) {
|
||||||
if (VerifyArchivedFields > 0) {
|
if (VerifyArchivedFields > 0) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_info(cds, heap)("Verify heap %s initializing static field(s) in %s",
|
log_info(aot, heap)("Verify heap %s initializing static field(s) in %s",
|
||||||
which, k->external_name());
|
which, k->external_name());
|
||||||
|
|
||||||
VM_Verify verify_op;
|
VM_Verify verify_op;
|
||||||
@ -1066,7 +1067,7 @@ static void verify_the_heap(Klass* k, const char* which) {
|
|||||||
//
|
//
|
||||||
// -XX:VerifyArchivedFields=2 force a GC to happen in such an early stage
|
// -XX:VerifyArchivedFields=2 force a GC to happen in such an early stage
|
||||||
// to check for GC safety.
|
// to check for GC safety.
|
||||||
log_info(cds, heap)("Trigger GC %s initializing static field(s) in %s",
|
log_info(aot, heap)("Trigger GC %s initializing static field(s) in %s",
|
||||||
which, k->external_name());
|
which, k->external_name());
|
||||||
FlagSetting fs1(VerifyBeforeGC, true);
|
FlagSetting fs1(VerifyBeforeGC, true);
|
||||||
FlagSetting fs2(VerifyDuringGC, true);
|
FlagSetting fs2(VerifyDuringGC, true);
|
||||||
@ -1185,7 +1186,7 @@ void HeapShared::initialize_from_archived_subgraph(JavaThread* current, Klass* k
|
|||||||
AOTClassLocationConfig::runtime()->num_module_paths() > 0) {
|
AOTClassLocationConfig::runtime()->num_module_paths() > 0) {
|
||||||
// ArchivedModuleGraph was created with a --module-path that's different than the runtime --module-path.
|
// ArchivedModuleGraph was created with a --module-path that's different than the runtime --module-path.
|
||||||
// Thus, it might contain references to modules that do not exist at runtime. We cannot use it.
|
// Thus, it might contain references to modules that do not exist at runtime. We cannot use it.
|
||||||
log_info(cds, heap)("Skip initializing ArchivedModuleGraph subgraph: is_using_optimized_module_handling=%s num_module_paths=%d",
|
log_info(aot, heap)("Skip initializing ArchivedModuleGraph subgraph: is_using_optimized_module_handling=%s num_module_paths=%d",
|
||||||
BOOL_TO_STR(CDSConfig::is_using_optimized_module_handling()),
|
BOOL_TO_STR(CDSConfig::is_using_optimized_module_handling()),
|
||||||
AOTClassLocationConfig::runtime()->num_module_paths());
|
AOTClassLocationConfig::runtime()->num_module_paths());
|
||||||
return;
|
return;
|
||||||
@ -1228,34 +1229,34 @@ HeapShared::resolve_or_init_classes_for_subgraph_of(Klass* k, bool do_init, TRAP
|
|||||||
// Initialize from archived data. Currently this is done only
|
// Initialize from archived data. Currently this is done only
|
||||||
// during VM initialization time. No lock is needed.
|
// during VM initialization time. No lock is needed.
|
||||||
if (record == nullptr) {
|
if (record == nullptr) {
|
||||||
if (log_is_enabled(Info, cds, heap)) {
|
if (log_is_enabled(Info, aot, heap)) {
|
||||||
ResourceMark rm(THREAD);
|
ResourceMark rm(THREAD);
|
||||||
log_info(cds, heap)("subgraph %s is not recorded",
|
log_info(aot, heap)("subgraph %s is not recorded",
|
||||||
k->external_name());
|
k->external_name());
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
} else {
|
} else {
|
||||||
if (record->is_full_module_graph() && !CDSConfig::is_using_full_module_graph()) {
|
if (record->is_full_module_graph() && !CDSConfig::is_using_full_module_graph()) {
|
||||||
if (log_is_enabled(Info, cds, heap)) {
|
if (log_is_enabled(Info, aot, heap)) {
|
||||||
ResourceMark rm(THREAD);
|
ResourceMark rm(THREAD);
|
||||||
log_info(cds, heap)("subgraph %s cannot be used because full module graph is disabled",
|
log_info(aot, heap)("subgraph %s cannot be used because full module graph is disabled",
|
||||||
k->external_name());
|
k->external_name());
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (record->has_non_early_klasses() && JvmtiExport::should_post_class_file_load_hook()) {
|
if (record->has_non_early_klasses() && JvmtiExport::should_post_class_file_load_hook()) {
|
||||||
if (log_is_enabled(Info, cds, heap)) {
|
if (log_is_enabled(Info, aot, heap)) {
|
||||||
ResourceMark rm(THREAD);
|
ResourceMark rm(THREAD);
|
||||||
log_info(cds, heap)("subgraph %s cannot be used because JVMTI ClassFileLoadHook is enabled",
|
log_info(aot, heap)("subgraph %s cannot be used because JVMTI ClassFileLoadHook is enabled",
|
||||||
k->external_name());
|
k->external_name());
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (log_is_enabled(Info, cds, heap)) {
|
if (log_is_enabled(Info, aot, heap)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_info(cds, heap)("%s subgraph %s ", do_init ? "init" : "resolve", k->external_name());
|
log_info(aot, heap)("%s subgraph %s ", do_init ? "init" : "resolve", k->external_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve_or_init(k, do_init, CHECK_NULL);
|
resolve_or_init(k, do_init, CHECK_NULL);
|
||||||
@ -1327,14 +1328,14 @@ void HeapShared::init_archived_fields_for(Klass* k, const ArchivedKlassSubGraphI
|
|||||||
} else {
|
} else {
|
||||||
m->obj_field_put(field_offset, v);
|
m->obj_field_put(field_offset, v);
|
||||||
}
|
}
|
||||||
log_debug(cds, heap)(" " PTR_FORMAT " init field @ %2d = " PTR_FORMAT, p2i(k), field_offset, p2i(v));
|
log_debug(aot, heap)(" " PTR_FORMAT " init field @ %2d = " PTR_FORMAT, p2i(k), field_offset, p2i(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done. Java code can see the archived sub-graphs referenced from k's
|
// Done. Java code can see the archived sub-graphs referenced from k's
|
||||||
// mirror after this point.
|
// mirror after this point.
|
||||||
if (log_is_enabled(Info, cds, heap)) {
|
if (log_is_enabled(Info, aot, heap)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_info(cds, heap)("initialize_from_archived_subgraph %s " PTR_FORMAT "%s%s",
|
log_info(aot, heap)("initialize_from_archived_subgraph %s " PTR_FORMAT "%s%s",
|
||||||
k->external_name(), p2i(k), JvmtiExport::is_early_phase() ? " (early)" : "",
|
k->external_name(), p2i(k), JvmtiExport::is_early_phase() ? " (early)" : "",
|
||||||
k->has_aot_initialized_mirror() ? " (aot-inited)" : "");
|
k->has_aot_initialized_mirror() ? " (aot-inited)" : "");
|
||||||
}
|
}
|
||||||
@ -1406,13 +1407,13 @@ class HeapShared::OopFieldPusher: public BasicOopIterateClosure {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_record_klasses_only && log_is_enabled(Debug, cds, heap)) {
|
if (!_record_klasses_only && log_is_enabled(Debug, aot, heap)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_debug(cds, heap)("(%d) %s[%d] ==> " PTR_FORMAT " size %zu %s", _level,
|
log_debug(aot, heap)("(%d) %s[%d] ==> " PTR_FORMAT " size %zu %s", _level,
|
||||||
_referencing_obj->klass()->external_name(), field_offset,
|
_referencing_obj->klass()->external_name(), field_offset,
|
||||||
p2i(obj), obj->size() * HeapWordSize, obj->klass()->external_name());
|
p2i(obj), obj->size() * HeapWordSize, obj->klass()->external_name());
|
||||||
if (log_is_enabled(Trace, cds, heap)) {
|
if (log_is_enabled(Trace, aot, heap)) {
|
||||||
LogTarget(Trace, cds, heap) log;
|
LogTarget(Trace, aot, heap) log;
|
||||||
LogStream out(log);
|
LogStream out(log);
|
||||||
obj->print_on(&out);
|
obj->print_on(&out);
|
||||||
}
|
}
|
||||||
@ -1499,14 +1500,14 @@ bool HeapShared::walk_one_object(PendingOopStack* stack, int level, KlassSubGrap
|
|||||||
// If you get an error here, you probably made a change in the JDK library that has added
|
// If you get an error here, you probably made a change in the JDK library that has added
|
||||||
// these objects that are referenced (directly or indirectly) by static fields.
|
// these objects that are referenced (directly or indirectly) by static fields.
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_error(cds, heap)("Cannot archive object " PTR_FORMAT " of class %s", p2i(orig_obj), orig_obj->klass()->external_name());
|
log_error(aot, heap)("Cannot archive object " PTR_FORMAT " of class %s", p2i(orig_obj), orig_obj->klass()->external_name());
|
||||||
debug_trace();
|
debug_trace();
|
||||||
MetaspaceShared::unrecoverable_writing_error();
|
MetaspaceShared::unrecoverable_writing_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (log_is_enabled(Debug, cds, heap) && java_lang_Class::is_instance(orig_obj)) {
|
if (log_is_enabled(Debug, aot, heap) && java_lang_Class::is_instance(orig_obj)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
LogTarget(Debug, cds, heap) log;
|
LogTarget(Debug, aot, heap) log;
|
||||||
LogStream out(log);
|
LogStream out(log);
|
||||||
out.print("Found java mirror " PTR_FORMAT " ", p2i(orig_obj));
|
out.print("Found java mirror " PTR_FORMAT " ", p2i(orig_obj));
|
||||||
Klass* k = java_lang_Class::as_Klass(orig_obj);
|
Klass* k = java_lang_Class::as_Klass(orig_obj);
|
||||||
@ -1545,7 +1546,7 @@ bool HeapShared::walk_one_object(PendingOopStack* stack, int level, KlassSubGrap
|
|||||||
// If you get an error here, you probably made a change in the JDK library that has added a Class
|
// If you get an error here, you probably made a change in the JDK library that has added a Class
|
||||||
// object that is referenced (directly or indirectly) by an ArchivableStaticFieldInfo
|
// object that is referenced (directly or indirectly) by an ArchivableStaticFieldInfo
|
||||||
// defined at the top of this file.
|
// defined at the top of this file.
|
||||||
log_error(cds, heap)("(%d) Unknown java.lang.Class object is in the archived sub-graph", level);
|
log_error(aot, heap)("(%d) Unknown java.lang.Class object is in the archived sub-graph", level);
|
||||||
debug_trace();
|
debug_trace();
|
||||||
MetaspaceShared::unrecoverable_writing_error();
|
MetaspaceShared::unrecoverable_writing_error();
|
||||||
}
|
}
|
||||||
@ -1565,7 +1566,7 @@ bool HeapShared::walk_one_object(PendingOopStack* stack, int level, KlassSubGrap
|
|||||||
if (!archive_object(orig_obj, referrer, subgraph_info)) {
|
if (!archive_object(orig_obj, referrer, subgraph_info)) {
|
||||||
// Skip archiving the sub-graph referenced from the current entry field.
|
// Skip archiving the sub-graph referenced from the current entry field.
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_error(cds, heap)(
|
log_error(aot, heap)(
|
||||||
"Cannot archive the sub-graph referenced from %s object ("
|
"Cannot archive the sub-graph referenced from %s object ("
|
||||||
PTR_FORMAT ") size %zu, skipped.",
|
PTR_FORMAT ") size %zu, skipped.",
|
||||||
orig_obj->klass()->external_name(), p2i(orig_obj), orig_obj->size() * HeapWordSize);
|
orig_obj->klass()->external_name(), p2i(orig_obj), orig_obj->size() * HeapWordSize);
|
||||||
@ -1650,25 +1651,25 @@ void HeapShared::archive_reachable_objects_from_static_field(InstanceKlass *k,
|
|||||||
KlassSubGraphInfo* subgraph_info = get_subgraph_info(k);
|
KlassSubGraphInfo* subgraph_info = get_subgraph_info(k);
|
||||||
oop f = m->obj_field(field_offset);
|
oop f = m->obj_field(field_offset);
|
||||||
|
|
||||||
log_debug(cds, heap)("Start archiving from: %s::%s (" PTR_FORMAT ")", klass_name, field_name, p2i(f));
|
log_debug(aot, heap)("Start archiving from: %s::%s (" PTR_FORMAT ")", klass_name, field_name, p2i(f));
|
||||||
|
|
||||||
if (!CompressedOops::is_null(f)) {
|
if (!CompressedOops::is_null(f)) {
|
||||||
if (log_is_enabled(Trace, cds, heap)) {
|
if (log_is_enabled(Trace, aot, heap)) {
|
||||||
LogTarget(Trace, cds, heap) log;
|
LogTarget(Trace, aot, heap) log;
|
||||||
LogStream out(log);
|
LogStream out(log);
|
||||||
f->print_on(&out);
|
f->print_on(&out);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool success = archive_reachable_objects_from(1, subgraph_info, f);
|
bool success = archive_reachable_objects_from(1, subgraph_info, f);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
log_error(cds, heap)("Archiving failed %s::%s (some reachable objects cannot be archived)",
|
log_error(aot, heap)("Archiving failed %s::%s (some reachable objects cannot be archived)",
|
||||||
klass_name, field_name);
|
klass_name, field_name);
|
||||||
} else {
|
} else {
|
||||||
// Note: the field value is not preserved in the archived mirror.
|
// Note: the field value is not preserved in the archived mirror.
|
||||||
// Record the field as a new subGraph entry point. The recorded
|
// Record the field as a new subGraph entry point. The recorded
|
||||||
// information is restored from the archive at runtime.
|
// information is restored from the archive at runtime.
|
||||||
subgraph_info->add_subgraph_entry_field(field_offset, f);
|
subgraph_info->add_subgraph_entry_field(field_offset, f);
|
||||||
log_info(cds, heap)("Archived field %s::%s => " PTR_FORMAT, klass_name, field_name, p2i(f));
|
log_info(aot, heap)("Archived field %s::%s => " PTR_FORMAT, klass_name, field_name, p2i(f));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// The field contains null, we still need to record the entry point,
|
// The field contains null, we still need to record the entry point,
|
||||||
@ -1787,7 +1788,7 @@ void HeapShared::set_has_been_seen_during_subgraph_recording(oop obj) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HeapShared::start_recording_subgraph(InstanceKlass *k, const char* class_name, bool is_full_module_graph) {
|
void HeapShared::start_recording_subgraph(InstanceKlass *k, const char* class_name, bool is_full_module_graph) {
|
||||||
log_info(cds, heap)("Start recording subgraph(s) for archived fields in %s", class_name);
|
log_info(aot, heap)("Start recording subgraph(s) for archived fields in %s", class_name);
|
||||||
init_subgraph_info(k, is_full_module_graph);
|
init_subgraph_info(k, is_full_module_graph);
|
||||||
init_seen_objects_table();
|
init_seen_objects_table();
|
||||||
_num_new_walked_objs = 0;
|
_num_new_walked_objs = 0;
|
||||||
@ -1798,7 +1799,7 @@ void HeapShared::start_recording_subgraph(InstanceKlass *k, const char* class_na
|
|||||||
void HeapShared::done_recording_subgraph(InstanceKlass *k, const char* class_name) {
|
void HeapShared::done_recording_subgraph(InstanceKlass *k, const char* class_name) {
|
||||||
int num_new_recorded_klasses = get_subgraph_info(k)->num_subgraph_object_klasses() -
|
int num_new_recorded_klasses = get_subgraph_info(k)->num_subgraph_object_klasses() -
|
||||||
_num_old_recorded_klasses;
|
_num_old_recorded_klasses;
|
||||||
log_info(cds, heap)("Done recording subgraph(s) for archived fields in %s: "
|
log_info(aot, heap)("Done recording subgraph(s) for archived fields in %s: "
|
||||||
"walked %d objs, archived %d new objs, recorded %d classes",
|
"walked %d objs, archived %d new objs, recorded %d classes",
|
||||||
class_name, _num_new_walked_objs, _num_new_archived_objs,
|
class_name, _num_new_walked_objs, _num_new_archived_objs,
|
||||||
num_new_recorded_klasses);
|
num_new_recorded_klasses);
|
||||||
@ -1850,7 +1851,7 @@ void HeapShared::init_subgraph_entry_fields(ArchivableStaticFieldInfo fields[],
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (is_test_class) {
|
if (is_test_class) {
|
||||||
log_warning(cds)("Loading ArchiveHeapTestClass %s ...", test_class_name);
|
log_warning(aot)("Loading ArchiveHeapTestClass %s ...", test_class_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Klass* k = SystemDictionary::resolve_or_fail(klass_name, true, THREAD);
|
Klass* k = SystemDictionary::resolve_or_fail(klass_name, true, THREAD);
|
||||||
@ -1898,7 +1899,7 @@ void HeapShared::init_subgraph_entry_fields(ArchivableStaticFieldInfo fields[],
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_test_class) {
|
if (is_test_class) {
|
||||||
log_warning(cds)("Initializing ArchiveHeapTestClass %s ...", test_class_name);
|
log_warning(aot)("Initializing ArchiveHeapTestClass %s ...", test_class_name);
|
||||||
}
|
}
|
||||||
ik->initialize(CHECK);
|
ik->initialize(CHECK);
|
||||||
|
|
||||||
@ -2047,18 +2048,18 @@ void HeapShared::archive_object_subgraphs(ArchivableStaticFieldInfo fields[],
|
|||||||
done_recording_subgraph(info->klass, klass_name);
|
done_recording_subgraph(info->klass, klass_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_info(cds, heap)("Archived subgraph records = %d",
|
log_info(aot, heap)("Archived subgraph records = %d",
|
||||||
_num_total_subgraph_recordings);
|
_num_total_subgraph_recordings);
|
||||||
log_info(cds, heap)(" Walked %d objects", _num_total_walked_objs);
|
log_info(aot, heap)(" Walked %d objects", _num_total_walked_objs);
|
||||||
log_info(cds, heap)(" Archived %d objects", _num_total_archived_objs);
|
log_info(aot, heap)(" Archived %d objects", _num_total_archived_objs);
|
||||||
log_info(cds, heap)(" Recorded %d klasses", _num_total_recorded_klasses);
|
log_info(aot, heap)(" Recorded %d klasses", _num_total_recorded_klasses);
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
for (int i = 0; fields[i].valid(); i++) {
|
for (int i = 0; fields[i].valid(); i++) {
|
||||||
ArchivableStaticFieldInfo* f = &fields[i];
|
ArchivableStaticFieldInfo* f = &fields[i];
|
||||||
verify_subgraph_from_static_field(f->klass, f->offset);
|
verify_subgraph_from_static_field(f->klass, f->offset);
|
||||||
}
|
}
|
||||||
log_info(cds, heap)(" Verified %d references", _num_total_verifications);
|
log_info(aot, heap)(" Verified %d references", _num_total_verifications);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2085,7 +2086,7 @@ void HeapShared::debug_trace() {
|
|||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
oop referrer = _object_being_archived.referrer();
|
oop referrer = _object_being_archived.referrer();
|
||||||
if (referrer != nullptr) {
|
if (referrer != nullptr) {
|
||||||
LogStream ls(Log(cds, heap)::error());
|
LogStream ls(Log(aot, heap)::error());
|
||||||
ls.print_cr("Reference trace");
|
ls.print_cr("Reference trace");
|
||||||
CDSHeapVerifier::trace_to_root(&ls, referrer);
|
CDSHeapVerifier::trace_to_root(&ls, referrer);
|
||||||
}
|
}
|
||||||
@ -2158,18 +2159,18 @@ void HeapShared::print_stats() {
|
|||||||
size_t byte_size_limit = (size_t(1) << i) * HeapWordSize;
|
size_t byte_size_limit = (size_t(1) << i) * HeapWordSize;
|
||||||
size_t count = _alloc_count[i];
|
size_t count = _alloc_count[i];
|
||||||
size_t size = _alloc_size[i];
|
size_t size = _alloc_size[i];
|
||||||
log_info(cds, heap)("%8zu objects are <= %-6zu"
|
log_info(aot, heap)("%8zu objects are <= %-6zu"
|
||||||
" bytes (total %8zu bytes, avg %8.1f bytes)",
|
" bytes (total %8zu bytes, avg %8.1f bytes)",
|
||||||
count, byte_size_limit, size * HeapWordSize, avg_size(size, count));
|
count, byte_size_limit, size * HeapWordSize, avg_size(size, count));
|
||||||
huge_count -= count;
|
huge_count -= count;
|
||||||
huge_size -= size;
|
huge_size -= size;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_info(cds, heap)("%8zu huge objects (total %8zu bytes"
|
log_info(aot, heap)("%8zu huge objects (total %8zu bytes"
|
||||||
", avg %8.1f bytes)",
|
", avg %8.1f bytes)",
|
||||||
huge_count, huge_size * HeapWordSize,
|
huge_count, huge_size * HeapWordSize,
|
||||||
avg_size(huge_size, huge_count));
|
avg_size(huge_size, huge_count));
|
||||||
log_info(cds, heap)("%8zu total objects (total %8zu bytes"
|
log_info(aot, heap)("%8zu total objects (total %8zu bytes"
|
||||||
", avg %8.1f bytes)",
|
", avg %8.1f bytes)",
|
||||||
_total_obj_count, _total_obj_size * HeapWordSize,
|
_total_obj_count, _total_obj_size * HeapWordSize,
|
||||||
avg_size(_total_obj_size, _total_obj_count));
|
avg_size(_total_obj_size, _total_obj_count));
|
||||||
|
|||||||
@ -83,10 +83,10 @@ void LambdaFormInvokers::append(char* line) {
|
|||||||
class PrintLambdaFormMessage {
|
class PrintLambdaFormMessage {
|
||||||
public:
|
public:
|
||||||
PrintLambdaFormMessage() {
|
PrintLambdaFormMessage() {
|
||||||
log_info(cds)("Regenerate MethodHandle Holder classes...");
|
log_info(aot)("Regenerate MethodHandle Holder classes...");
|
||||||
}
|
}
|
||||||
~PrintLambdaFormMessage() {
|
~PrintLambdaFormMessage() {
|
||||||
log_info(cds)("Regenerate MethodHandle Holder classes...done");
|
log_info(aot)("Regenerate MethodHandle Holder classes...done");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ void LambdaFormInvokers::regenerate_holder_classes(TRAPS) {
|
|||||||
|
|
||||||
PrintLambdaFormMessage plm;
|
PrintLambdaFormMessage plm;
|
||||||
if (_lambdaform_lines == nullptr || _lambdaform_lines->length() == 0) {
|
if (_lambdaform_lines == nullptr || _lambdaform_lines->length() == 0) {
|
||||||
log_info(cds)("Nothing to regenerate for holder classes");
|
log_info(aot)("Nothing to regenerate for holder classes");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,9 +153,9 @@ void LambdaFormInvokers::regenerate_holder_classes(TRAPS) {
|
|||||||
log_error(cds)("%s: %s", PENDING_EXCEPTION->klass()->external_name(),
|
log_error(cds)("%s: %s", PENDING_EXCEPTION->klass()->external_name(),
|
||||||
java_lang_String::as_utf8_string(java_lang_Throwable::message(PENDING_EXCEPTION)));
|
java_lang_String::as_utf8_string(java_lang_Throwable::message(PENDING_EXCEPTION)));
|
||||||
if (CDSConfig::is_dumping_static_archive()) {
|
if (CDSConfig::is_dumping_static_archive()) {
|
||||||
log_error(cds)("Failed to generate LambdaForm holder classes. Is your classlist out of date?");
|
log_error(aot)("Failed to generate LambdaForm holder classes. Is your classlist out of date?");
|
||||||
} else {
|
} else {
|
||||||
log_error(cds)("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?");
|
log_error(aot)("Failed to generate LambdaForm holder classes. Was the base archive generated with an outdated classlist?");
|
||||||
}
|
}
|
||||||
CLEAR_PENDING_EXCEPTION;
|
CLEAR_PENDING_EXCEPTION;
|
||||||
}
|
}
|
||||||
@ -226,7 +226,7 @@ void LambdaFormInvokers::regenerate_class(char* class_name, ClassFileStream& st,
|
|||||||
if (!klass->is_shared()) {
|
if (!klass->is_shared()) {
|
||||||
SystemDictionaryShared::set_excluded(InstanceKlass::cast(klass)); // exclude the existing class from dump
|
SystemDictionaryShared::set_excluded(InstanceKlass::cast(klass)); // exclude the existing class from dump
|
||||||
}
|
}
|
||||||
log_info(cds, lambda)("Regenerated class %s, old: " INTPTR_FORMAT " new: " INTPTR_FORMAT,
|
log_info(aot, lambda)("Regenerated class %s, old: " INTPTR_FORMAT " new: " INTPTR_FORMAT,
|
||||||
class_name, p2i(klass), p2i(result));
|
class_name, p2i(klass), p2i(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ void LambdaFormInvokers::dump_static_archive_invokers() {
|
|||||||
}
|
}
|
||||||
assert(index == count, "Should match");
|
assert(index == count, "Should match");
|
||||||
}
|
}
|
||||||
log_debug(cds)("Total LF lines stored into %s: %d", CDSConfig::type_of_archive_being_written(), count);
|
log_debug(aot)("Total LF lines stored into %s: %d", CDSConfig::type_of_archive_being_written(), count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ void LambdaFormInvokers::read_static_archive_invokers() {
|
|||||||
char* str = line->adr_at(0);
|
char* str = line->adr_at(0);
|
||||||
append(str);
|
append(str);
|
||||||
}
|
}
|
||||||
log_debug(cds)("Total LF lines read from %s: %d", CDSConfig::type_of_archive_being_loaded(), _static_archive_invokers->length());
|
log_debug(aot)("Total LF lines read from %s: %d", CDSConfig::type_of_archive_being_loaded(), _static_archive_invokers->length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@
|
|||||||
#include "cds/aotClassLocation.hpp"
|
#include "cds/aotClassLocation.hpp"
|
||||||
#include "cds/aotConstantPoolResolver.hpp"
|
#include "cds/aotConstantPoolResolver.hpp"
|
||||||
#include "cds/aotLinkedClassBulkLoader.hpp"
|
#include "cds/aotLinkedClassBulkLoader.hpp"
|
||||||
|
#include "cds/aotLogging.hpp"
|
||||||
#include "cds/aotReferenceObjSupport.hpp"
|
#include "cds/aotReferenceObjSupport.hpp"
|
||||||
#include "cds/archiveBuilder.hpp"
|
#include "cds/archiveBuilder.hpp"
|
||||||
#include "cds/archiveHeapLoader.hpp"
|
#include "cds/archiveHeapLoader.hpp"
|
||||||
@ -186,7 +187,7 @@ class DumpClassListCLDClosure : public CLDClosure {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_dumped_classes.maybe_grow()) {
|
if (_dumped_classes.maybe_grow()) {
|
||||||
log_info(cds, hashtables)("Expanded _dumped_classes table to %d", _dumped_classes.table_size());
|
log_info(aot, hashtables)("Expanded _dumped_classes table to %d", _dumped_classes.table_size());
|
||||||
}
|
}
|
||||||
if (ik->java_super()) {
|
if (ik->java_super()) {
|
||||||
dump(ik->java_super());
|
dump(ik->java_super());
|
||||||
@ -257,7 +258,7 @@ static char* compute_shared_base(size_t cds_max) {
|
|||||||
: nullptr;
|
: nullptr;
|
||||||
|
|
||||||
if (aligned_base != specified_base) {
|
if (aligned_base != specified_base) {
|
||||||
log_info(cds)("SharedBaseAddress (" INTPTR_FORMAT ") aligned up to " INTPTR_FORMAT,
|
aot_log_info(aot)("SharedBaseAddress (" INTPTR_FORMAT ") aligned up to " INTPTR_FORMAT,
|
||||||
p2i(specified_base), p2i(aligned_base));
|
p2i(specified_base), p2i(aligned_base));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +276,7 @@ static char* compute_shared_base(size_t cds_max) {
|
|||||||
// Arguments::default_SharedBaseAddress() is hard-coded in cds_globals.hpp. It must be carefully
|
// Arguments::default_SharedBaseAddress() is hard-coded in cds_globals.hpp. It must be carefully
|
||||||
// picked that (a) the align_up() below will always return a valid value; (b) none of
|
// picked that (a) the align_up() below will always return a valid value; (b) none of
|
||||||
// the following asserts will fail.
|
// the following asserts will fail.
|
||||||
log_warning(cds)("SharedBaseAddress (" INTPTR_FORMAT ") is %s. Reverted to " INTPTR_FORMAT,
|
aot_log_warning(aot)("SharedBaseAddress (" INTPTR_FORMAT ") is %s. Reverted to " INTPTR_FORMAT,
|
||||||
p2i((void*)SharedBaseAddress), err,
|
p2i((void*)SharedBaseAddress), err,
|
||||||
p2i((void*)Arguments::default_SharedBaseAddress()));
|
p2i((void*)Arguments::default_SharedBaseAddress()));
|
||||||
|
|
||||||
@ -290,7 +291,7 @@ static char* compute_shared_base(size_t cds_max) {
|
|||||||
|
|
||||||
void MetaspaceShared::initialize_for_static_dump() {
|
void MetaspaceShared::initialize_for_static_dump() {
|
||||||
assert(CDSConfig::is_dumping_static_archive(), "sanity");
|
assert(CDSConfig::is_dumping_static_archive(), "sanity");
|
||||||
log_info(cds)("Core region alignment: %zu", core_region_alignment());
|
aot_log_info(aot)("Core region alignment: %zu", core_region_alignment());
|
||||||
// The max allowed size for CDS archive. We use this to limit SharedBaseAddress
|
// The max allowed size for CDS archive. We use this to limit SharedBaseAddress
|
||||||
// to avoid address space wrap around.
|
// to avoid address space wrap around.
|
||||||
size_t cds_max;
|
size_t cds_max;
|
||||||
@ -314,7 +315,7 @@ void MetaspaceShared::initialize_for_static_dump() {
|
|||||||
os::vm_page_size(),
|
os::vm_page_size(),
|
||||||
mtClassShared);
|
mtClassShared);
|
||||||
if (!_symbol_rs.is_reserved()) {
|
if (!_symbol_rs.is_reserved()) {
|
||||||
log_error(cds)("Unable to reserve memory for symbols: %zu bytes.", symbol_rs_size);
|
aot_log_error(aot)("Unable to reserve memory for symbols: %zu bytes.", symbol_rs_size);
|
||||||
MetaspaceShared::unrecoverable_writing_error();
|
MetaspaceShared::unrecoverable_writing_error();
|
||||||
}
|
}
|
||||||
_symbol_region.init(&_symbol_rs, &_symbol_vs);
|
_symbol_region.init(&_symbol_rs, &_symbol_vs);
|
||||||
@ -350,7 +351,7 @@ void MetaspaceShared::read_extra_data(JavaThread* current, const char* filename)
|
|||||||
ResourceMark rm(current);
|
ResourceMark rm(current);
|
||||||
if (utf8_length == 0x7fffffff) {
|
if (utf8_length == 0x7fffffff) {
|
||||||
// buf_len will overflown 32-bit value.
|
// buf_len will overflown 32-bit value.
|
||||||
log_error(cds)("string length too large: %d", utf8_length);
|
aot_log_error(aot)("string length too large: %d", utf8_length);
|
||||||
MetaspaceShared::unrecoverable_loading_error();
|
MetaspaceShared::unrecoverable_loading_error();
|
||||||
}
|
}
|
||||||
int buf_len = utf8_length+1;
|
int buf_len = utf8_length+1;
|
||||||
@ -367,13 +368,13 @@ void MetaspaceShared::read_extra_data(JavaThread* current, const char* filename)
|
|||||||
oop str = StringTable::intern(utf8_buffer, THREAD);
|
oop str = StringTable::intern(utf8_buffer, THREAD);
|
||||||
|
|
||||||
if (HAS_PENDING_EXCEPTION) {
|
if (HAS_PENDING_EXCEPTION) {
|
||||||
log_warning(cds, heap)("[line %d] extra interned string allocation failed; size too large: %d",
|
log_warning(aot, heap)("[line %d] extra interned string allocation failed; size too large: %d",
|
||||||
reader.last_line_no(), utf8_length);
|
reader.last_line_no(), utf8_length);
|
||||||
CLEAR_PENDING_EXCEPTION;
|
CLEAR_PENDING_EXCEPTION;
|
||||||
} else {
|
} else {
|
||||||
#if INCLUDE_CDS_JAVA_HEAP
|
#if INCLUDE_CDS_JAVA_HEAP
|
||||||
if (ArchiveHeapWriter::is_string_too_large_to_archive(str)) {
|
if (ArchiveHeapWriter::is_string_too_large_to_archive(str)) {
|
||||||
log_warning(cds, heap)("[line %d] extra interned string ignored; size too large: %d",
|
log_warning(aot, heap)("[line %d] extra interned string ignored; size too large: %d",
|
||||||
reader.last_line_no(), utf8_length);
|
reader.last_line_no(), utf8_length);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -407,7 +408,7 @@ void MetaspaceShared::write_method_handle_intrinsics() {
|
|||||||
word_size += m->constants()->cache()->size();
|
word_size += m->constants()->cache()->size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log_info(cds)("Archived %d method handle intrinsics (%d bytes)", len, word_size * BytesPerWord);
|
log_info(aot)("Archived %d method handle intrinsics (%d bytes)", len, word_size * BytesPerWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
// About "serialize" --
|
// About "serialize" --
|
||||||
@ -539,7 +540,7 @@ private:
|
|||||||
|
|
||||||
void dump_java_heap_objects();
|
void dump_java_heap_objects();
|
||||||
void dump_shared_symbol_table(GrowableArray<Symbol*>* symbols) {
|
void dump_shared_symbol_table(GrowableArray<Symbol*>* symbols) {
|
||||||
log_info(cds)("Dumping symbol table ...");
|
log_info(aot)("Dumping symbol table ...");
|
||||||
SymbolTable::write_to_archive(symbols);
|
SymbolTable::write_to_archive(symbols);
|
||||||
}
|
}
|
||||||
char* dump_early_read_only_tables();
|
char* dump_early_read_only_tables();
|
||||||
@ -656,7 +657,7 @@ void VM_PopulateDumpSharedSpace::doit() {
|
|||||||
_builder.dump_ro_metadata();
|
_builder.dump_ro_metadata();
|
||||||
_builder.relocate_metaspaceobj_embedded_pointers();
|
_builder.relocate_metaspaceobj_embedded_pointers();
|
||||||
|
|
||||||
log_info(cds)("Make classes shareable");
|
log_info(aot)("Make classes shareable");
|
||||||
_builder.make_klasses_shareable();
|
_builder.make_klasses_shareable();
|
||||||
MetaspaceShared::make_method_handle_intrinsics_shareable();
|
MetaspaceShared::make_method_handle_intrinsics_shareable();
|
||||||
|
|
||||||
@ -668,7 +669,7 @@ void VM_PopulateDumpSharedSpace::doit() {
|
|||||||
char* serialized_data = dump_read_only_tables(cl_config);
|
char* serialized_data = dump_read_only_tables(cl_config);
|
||||||
|
|
||||||
if (CDSConfig::is_dumping_lambdas_in_legacy_mode()) {
|
if (CDSConfig::is_dumping_lambdas_in_legacy_mode()) {
|
||||||
log_info(cds)("Adjust lambda proxy class dictionary");
|
log_info(aot)("Adjust lambda proxy class dictionary");
|
||||||
LambdaProxyClassDictionary::adjust_dumptime_table();
|
LambdaProxyClassDictionary::adjust_dumptime_table();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -794,11 +795,11 @@ void MetaspaceShared::preload_and_dump(TRAPS) {
|
|||||||
preload_and_dump_impl(builder, THREAD);
|
preload_and_dump_impl(builder, THREAD);
|
||||||
if (HAS_PENDING_EXCEPTION) {
|
if (HAS_PENDING_EXCEPTION) {
|
||||||
if (PENDING_EXCEPTION->is_a(vmClasses::OutOfMemoryError_klass())) {
|
if (PENDING_EXCEPTION->is_a(vmClasses::OutOfMemoryError_klass())) {
|
||||||
log_error(cds)("Out of memory. Please run with a larger Java heap, current MaxHeapSize = "
|
aot_log_error(aot)("Out of memory. Please run with a larger Java heap, current MaxHeapSize = "
|
||||||
"%zuM", MaxHeapSize/M);
|
"%zuM", MaxHeapSize/M);
|
||||||
MetaspaceShared::writing_error();
|
MetaspaceShared::writing_error();
|
||||||
} else {
|
} else {
|
||||||
log_error(cds)("%s: %s", PENDING_EXCEPTION->klass()->external_name(),
|
aot_log_error(aot)("%s: %s", PENDING_EXCEPTION->klass()->external_name(),
|
||||||
java_lang_String::as_utf8_string(java_lang_Throwable::message(PENDING_EXCEPTION)));
|
java_lang_String::as_utf8_string(java_lang_Throwable::message(PENDING_EXCEPTION)));
|
||||||
MetaspaceShared::writing_error("Unexpected exception, use -Xlog:cds,exceptions=trace for detail");
|
MetaspaceShared::writing_error("Unexpected exception, use -Xlog:cds,exceptions=trace for detail");
|
||||||
}
|
}
|
||||||
@ -837,15 +838,15 @@ void MetaspaceShared::adjust_heap_sizes_for_dumping() {
|
|||||||
julong max_heap_size = (julong)(4 * G);
|
julong max_heap_size = (julong)(4 * G);
|
||||||
|
|
||||||
if (MinHeapSize > max_heap_size) {
|
if (MinHeapSize > max_heap_size) {
|
||||||
log_debug(cds)("Setting MinHeapSize to 4G for CDS dumping, original size = %zuM", MinHeapSize/M);
|
log_debug(aot)("Setting MinHeapSize to 4G for CDS dumping, original size = %zuM", MinHeapSize/M);
|
||||||
FLAG_SET_ERGO(MinHeapSize, max_heap_size);
|
FLAG_SET_ERGO(MinHeapSize, max_heap_size);
|
||||||
}
|
}
|
||||||
if (InitialHeapSize > max_heap_size) {
|
if (InitialHeapSize > max_heap_size) {
|
||||||
log_debug(cds)("Setting InitialHeapSize to 4G for CDS dumping, original size = %zuM", InitialHeapSize/M);
|
log_debug(aot)("Setting InitialHeapSize to 4G for CDS dumping, original size = %zuM", InitialHeapSize/M);
|
||||||
FLAG_SET_ERGO(InitialHeapSize, max_heap_size);
|
FLAG_SET_ERGO(InitialHeapSize, max_heap_size);
|
||||||
}
|
}
|
||||||
if (MaxHeapSize > max_heap_size) {
|
if (MaxHeapSize > max_heap_size) {
|
||||||
log_debug(cds)("Setting MaxHeapSize to 4G for CDS dumping, original size = %zuM", MaxHeapSize/M);
|
log_debug(aot)("Setting MaxHeapSize to 4G for CDS dumping, original size = %zuM", MaxHeapSize/M);
|
||||||
FLAG_SET_ERGO(MaxHeapSize, max_heap_size);
|
FLAG_SET_ERGO(MaxHeapSize, max_heap_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -868,7 +869,7 @@ void MetaspaceShared::preload_classes(TRAPS) {
|
|||||||
classlist_path = SharedClassListFile;
|
classlist_path = SharedClassListFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_info(cds)("Loading classes to share ...");
|
aot_log_info(aot)("Loading classes to share ...");
|
||||||
ClassListParser::parse_classlist(classlist_path,
|
ClassListParser::parse_classlist(classlist_path,
|
||||||
ClassListParser::_parse_all, CHECK);
|
ClassListParser::_parse_all, CHECK);
|
||||||
if (ExtraSharedClassListFile) {
|
if (ExtraSharedClassListFile) {
|
||||||
@ -889,7 +890,7 @@ void MetaspaceShared::preload_classes(TRAPS) {
|
|||||||
// are archived.
|
// are archived.
|
||||||
exercise_runtime_cds_code(CHECK);
|
exercise_runtime_cds_code(CHECK);
|
||||||
|
|
||||||
log_info(cds)("Loading classes to share: done.");
|
aot_log_info(aot)("Loading classes to share: done.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetaspaceShared::exercise_runtime_cds_code(TRAPS) {
|
void MetaspaceShared::exercise_runtime_cds_code(TRAPS) {
|
||||||
@ -907,14 +908,14 @@ void MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder& builder, TRAPS
|
|||||||
preload_classes(CHECK);
|
preload_classes(CHECK);
|
||||||
|
|
||||||
if (SharedArchiveConfigFile) {
|
if (SharedArchiveConfigFile) {
|
||||||
log_info(cds)("Reading extra data from %s ...", SharedArchiveConfigFile);
|
log_info(aot)("Reading extra data from %s ...", SharedArchiveConfigFile);
|
||||||
read_extra_data(THREAD, SharedArchiveConfigFile);
|
read_extra_data(THREAD, SharedArchiveConfigFile);
|
||||||
log_info(cds)("Reading extra data: done.");
|
log_info(aot)("Reading extra data: done.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CDSConfig::is_dumping_preimage_static_archive()) {
|
if (CDSConfig::is_dumping_preimage_static_archive()) {
|
||||||
log_info(cds)("Reading lambda form invokers from JDK default classlist ...");
|
log_info(aot)("Reading lambda form invokers from JDK default classlist ...");
|
||||||
char default_classlist[JVM_MAXPATHLEN];
|
char default_classlist[JVM_MAXPATHLEN];
|
||||||
get_default_classlist(default_classlist, JVM_MAXPATHLEN);
|
get_default_classlist(default_classlist, JVM_MAXPATHLEN);
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
@ -938,21 +939,21 @@ void MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder& builder, TRAPS
|
|||||||
|
|
||||||
if (CDSConfig::is_dumping_final_static_archive()) {
|
if (CDSConfig::is_dumping_final_static_archive()) {
|
||||||
if (ExtraSharedClassListFile) {
|
if (ExtraSharedClassListFile) {
|
||||||
log_info(cds)("Loading extra classes from %s ...", ExtraSharedClassListFile);
|
log_info(aot)("Loading extra classes from %s ...", ExtraSharedClassListFile);
|
||||||
ClassListParser::parse_classlist(ExtraSharedClassListFile,
|
ClassListParser::parse_classlist(ExtraSharedClassListFile,
|
||||||
ClassListParser::_parse_all, CHECK);
|
ClassListParser::_parse_all, CHECK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rewrite and link classes
|
// Rewrite and link classes
|
||||||
log_info(cds)("Rewriting and linking classes ...");
|
log_info(aot)("Rewriting and linking classes ...");
|
||||||
|
|
||||||
// Link any classes which got missed. This would happen if we have loaded classes that
|
// Link any classes which got missed. This would happen if we have loaded classes that
|
||||||
// were not explicitly specified in the classlist. E.g., if an interface implemented by class K
|
// were not explicitly specified in the classlist. E.g., if an interface implemented by class K
|
||||||
// fails verification, all other interfaces that were not specified in the classlist but
|
// fails verification, all other interfaces that were not specified in the classlist but
|
||||||
// are implemented by K are not verified.
|
// are implemented by K are not verified.
|
||||||
link_shared_classes(CHECK);
|
link_shared_classes(CHECK);
|
||||||
log_info(cds)("Rewriting and linking classes: done");
|
log_info(aot)("Rewriting and linking classes: done");
|
||||||
|
|
||||||
if (CDSConfig::is_dumping_regenerated_lambdaform_invokers()) {
|
if (CDSConfig::is_dumping_regenerated_lambdaform_invokers()) {
|
||||||
LambdaFormInvokers::regenerate_holder_classes(CHECK);
|
LambdaFormInvokers::regenerate_holder_classes(CHECK);
|
||||||
@ -973,7 +974,7 @@ void MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder& builder, TRAPS
|
|||||||
if (CDSConfig::is_initing_classes_at_dump_time()) {
|
if (CDSConfig::is_initing_classes_at_dump_time()) {
|
||||||
// java.lang.Class::reflectionFactory cannot be archived yet. We set this field
|
// java.lang.Class::reflectionFactory cannot be archived yet. We set this field
|
||||||
// to null, and it will be initialized again at runtime.
|
// to null, and it will be initialized again at runtime.
|
||||||
log_debug(cds)("Resetting Class::reflectionFactory");
|
log_debug(aot)("Resetting Class::reflectionFactory");
|
||||||
TempNewSymbol method_name = SymbolTable::new_symbol("resetArchivedStates");
|
TempNewSymbol method_name = SymbolTable::new_symbol("resetArchivedStates");
|
||||||
Symbol* method_sig = vmSymbols::void_method_signature();
|
Symbol* method_sig = vmSymbols::void_method_signature();
|
||||||
JavaValue result(T_VOID);
|
JavaValue result(T_VOID);
|
||||||
@ -988,7 +989,7 @@ void MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder& builder, TRAPS
|
|||||||
// some new strings may be added to the intern table.
|
// some new strings may be added to the intern table.
|
||||||
StringTable::allocate_shared_strings_array(CHECK);
|
StringTable::allocate_shared_strings_array(CHECK);
|
||||||
} else {
|
} else {
|
||||||
log_info(cds)("Not dumping heap, reset CDSConfig::_is_using_optimized_module_handling");
|
log_info(aot)("Not dumping heap, reset CDSConfig::_is_using_optimized_module_handling");
|
||||||
CDSConfig::stop_using_optimized_module_handling();
|
CDSConfig::stop_using_optimized_module_handling();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1024,7 +1025,7 @@ bool MetaspaceShared::write_static_archive(ArchiveBuilder* builder, FileMapInfo*
|
|||||||
builder->write_archive(map_info, heap_info);
|
builder->write_archive(map_info, heap_info);
|
||||||
|
|
||||||
if (AllowArchivingWithJavaAgent) {
|
if (AllowArchivingWithJavaAgent) {
|
||||||
log_warning(cds)("This %s was created with AllowArchivingWithJavaAgent. It should be used "
|
aot_log_warning(aot)("This %s was created with AllowArchivingWithJavaAgent. It should be used "
|
||||||
"for testing purposes only and should not be used in a production environment", CDSConfig::type_of_archive_being_loaded());
|
"for testing purposes only and should not be used in a production environment", CDSConfig::type_of_archive_being_loaded());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -1057,7 +1058,7 @@ bool MetaspaceShared::try_link_class(JavaThread* current, InstanceKlass* ik) {
|
|||||||
ik->link_class(THREAD);
|
ik->link_class(THREAD);
|
||||||
if (HAS_PENDING_EXCEPTION) {
|
if (HAS_PENDING_EXCEPTION) {
|
||||||
ResourceMark rm(THREAD);
|
ResourceMark rm(THREAD);
|
||||||
log_warning(cds)("Preload Warning: Verification failed for %s",
|
aot_log_warning(aot)("Preload Warning: Verification failed for %s",
|
||||||
ik->external_name());
|
ik->external_name());
|
||||||
CLEAR_PENDING_EXCEPTION;
|
CLEAR_PENDING_EXCEPTION;
|
||||||
SystemDictionaryShared::set_class_has_failed_verification(ik);
|
SystemDictionaryShared::set_class_has_failed_verification(ik);
|
||||||
@ -1109,7 +1110,7 @@ bool MetaspaceShared::is_shared_static(void* p) {
|
|||||||
// - When -XX:+RequireSharedSpaces is specified, AND the JVM cannot load the archive(s) due
|
// - When -XX:+RequireSharedSpaces is specified, AND the JVM cannot load the archive(s) due
|
||||||
// to version or classpath mismatch.
|
// to version or classpath mismatch.
|
||||||
void MetaspaceShared::unrecoverable_loading_error(const char* message) {
|
void MetaspaceShared::unrecoverable_loading_error(const char* message) {
|
||||||
report_loading_error(message);
|
report_loading_error("%s", message);
|
||||||
|
|
||||||
if (CDSConfig::is_dumping_final_static_archive()) {
|
if (CDSConfig::is_dumping_final_static_archive()) {
|
||||||
vm_exit_during_initialization("Must be a valid AOT configuration generated by the current JVM", AOTConfiguration);
|
vm_exit_during_initialization("Must be a valid AOT configuration generated by the current JVM", AOTConfiguration);
|
||||||
@ -1121,27 +1122,30 @@ void MetaspaceShared::unrecoverable_loading_error(const char* message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MetaspaceShared::report_loading_error(const char* format, ...) {
|
void MetaspaceShared::report_loading_error(const char* format, ...) {
|
||||||
// If the user doesn't specify any CDS options, we will try to load the default CDS archive, which
|
// When using AOT cache, errors messages are always printed on the error channel.
|
||||||
// may fail due to incompatible VM options. Print at the info level to avoid excessive verbosity.
|
LogStream ls_aot(LogLevel::Error, LogTagSetMapping<LOG_TAGS(aot)>::tagset());
|
||||||
|
|
||||||
|
// If we are loading load the default CDS archive, it may fail due to incompatible VM options.
|
||||||
|
// Print at the info level to avoid excessive verbosity.
|
||||||
// However, if the user has specified a CDS archive (or AOT cache), they would be interested in
|
// However, if the user has specified a CDS archive (or AOT cache), they would be interested in
|
||||||
// knowing that the loading fails, so we print at the error level.
|
// knowing that the loading fails, so we print at the error level.
|
||||||
Log(cds) log;
|
LogLevelType level = (!CDSConfig::is_using_archive() || CDSConfig::is_using_only_default_archive()) ?
|
||||||
LogStream ls_error(log.error());
|
LogLevel::Info : LogLevel::Error;
|
||||||
LogStream ls_info(log.info());
|
LogStream ls_cds(level, LogTagSetMapping<LOG_TAGS(cds)>::tagset());
|
||||||
LogStream& ls = (!CDSConfig::is_using_archive()) || CDSConfig::is_using_only_default_archive() ? ls_info : ls_error;
|
|
||||||
|
LogStream& ls = CDSConfig::new_aot_flags_used() ? ls_aot : ls_cds;
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, format);
|
||||||
|
|
||||||
static bool printed_error = false;
|
static bool printed_error = false;
|
||||||
if (!printed_error) { // No need for locks. Loading error checks happen only in main thread.
|
if (!printed_error) { // No need for locks. Loading error checks happen only in main thread.
|
||||||
ls.print_cr("An error has occurred while processing the %s. Run with -Xlog:cds for details.", CDSConfig::type_of_archive_being_loaded());
|
ls.print_cr("An error has occurred while processing the %s. Run with -Xlog:%s for details.",
|
||||||
|
CDSConfig::type_of_archive_being_loaded(), CDSConfig::new_aot_flags_used() ? "aot" : "aot,cds");
|
||||||
printed_error = true;
|
printed_error = true;
|
||||||
}
|
}
|
||||||
|
ls.vprint_cr(format, ap);
|
||||||
|
|
||||||
if (format != nullptr) {
|
va_end(ap);
|
||||||
va_list ap;
|
|
||||||
va_start(ap, format);
|
|
||||||
ls.vprint_cr(format, ap);
|
|
||||||
va_end(ap);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is called when the JVM is unable to write the specified CDS archive due to an
|
// This function is called when the JVM is unable to write the specified CDS archive due to an
|
||||||
@ -1154,9 +1158,9 @@ void MetaspaceShared::unrecoverable_writing_error(const char* message) {
|
|||||||
// This function is called when the JVM is unable to write the specified CDS archive due to a
|
// 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
|
// an error. The error will be propagated
|
||||||
void MetaspaceShared::writing_error(const char* message) {
|
void MetaspaceShared::writing_error(const char* message) {
|
||||||
log_error(cds)("An error has occurred while writing the shared archive file.");
|
aot_log_error(aot)("An error has occurred while writing the shared archive file.");
|
||||||
if (message != nullptr) {
|
if (message != nullptr) {
|
||||||
log_error(cds)("%s", message);
|
aot_log_error(aot)("%s", message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1168,17 +1172,17 @@ void MetaspaceShared::initialize_runtime_shared_and_meta_spaces() {
|
|||||||
FileMapInfo* dynamic_mapinfo = nullptr;
|
FileMapInfo* dynamic_mapinfo = nullptr;
|
||||||
|
|
||||||
if (static_mapinfo != nullptr) {
|
if (static_mapinfo != nullptr) {
|
||||||
log_info(cds)("Core region alignment: %zu", static_mapinfo->core_region_alignment());
|
aot_log_info(aot)("Core region alignment: %zu", static_mapinfo->core_region_alignment());
|
||||||
dynamic_mapinfo = open_dynamic_archive();
|
dynamic_mapinfo = open_dynamic_archive();
|
||||||
|
|
||||||
log_info(cds)("ArchiveRelocationMode: %d", ArchiveRelocationMode);
|
aot_log_info(aot)("ArchiveRelocationMode: %d", ArchiveRelocationMode);
|
||||||
|
|
||||||
// First try to map at the requested address
|
// First try to map at the requested address
|
||||||
result = map_archives(static_mapinfo, dynamic_mapinfo, true);
|
result = map_archives(static_mapinfo, dynamic_mapinfo, true);
|
||||||
if (result == MAP_ARCHIVE_MMAP_FAILURE) {
|
if (result == MAP_ARCHIVE_MMAP_FAILURE) {
|
||||||
// Mapping has failed (probably due to ASLR). Let's map at an address chosen
|
// Mapping has failed (probably due to ASLR). Let's map at an address chosen
|
||||||
// by the OS.
|
// by the OS.
|
||||||
log_info(cds)("Try to map archive(s) at an alternative address");
|
aot_log_info(aot)("Try to map archive(s) at an alternative address");
|
||||||
result = map_archives(static_mapinfo, dynamic_mapinfo, false);
|
result = map_archives(static_mapinfo, dynamic_mapinfo, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1199,7 +1203,7 @@ void MetaspaceShared::initialize_runtime_shared_and_meta_spaces() {
|
|||||||
} else {
|
} else {
|
||||||
set_shared_metaspace_range(nullptr, nullptr, nullptr);
|
set_shared_metaspace_range(nullptr, nullptr, nullptr);
|
||||||
if (CDSConfig::is_dumping_dynamic_archive()) {
|
if (CDSConfig::is_dumping_dynamic_archive()) {
|
||||||
log_warning(cds)("-XX:ArchiveClassesAtExit is unsupported when base CDS archive is not loaded. Run with -Xlog:cds for more info.");
|
aot_log_warning(aot)("-XX:ArchiveClassesAtExit is unsupported when base CDS archive is not loaded. Run with -Xlog:cds for more info.");
|
||||||
}
|
}
|
||||||
UseSharedSpaces = false;
|
UseSharedSpaces = false;
|
||||||
// The base archive cannot be mapped. We cannot dump the dynamic shared archive.
|
// The base archive cannot be mapped. We cannot dump the dynamic shared archive.
|
||||||
@ -1268,7 +1272,7 @@ FileMapInfo* MetaspaceShared::open_dynamic_archive() {
|
|||||||
MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, FileMapInfo* dynamic_mapinfo,
|
MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, FileMapInfo* dynamic_mapinfo,
|
||||||
bool use_requested_addr) {
|
bool use_requested_addr) {
|
||||||
if (use_requested_addr && static_mapinfo->requested_base_address() == nullptr) {
|
if (use_requested_addr && static_mapinfo->requested_base_address() == nullptr) {
|
||||||
log_info(cds)("Archive(s) were created with -XX:SharedBaseAddress=0. Always map at os-selected address.");
|
aot_log_info(aot)("Archive(s) were created with -XX:SharedBaseAddress=0. Always map at os-selected address.");
|
||||||
return MAP_ARCHIVE_MMAP_FAILURE;
|
return MAP_ARCHIVE_MMAP_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1276,12 +1280,12 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File
|
|||||||
// For product build only -- this is for benchmarking the cost of doing relocation.
|
// For product build only -- this is for benchmarking the cost of doing relocation.
|
||||||
// For debug builds, the check is done below, after reserving the space, for better test coverage
|
// For debug builds, the check is done below, after reserving the space, for better test coverage
|
||||||
// (see comment below).
|
// (see comment below).
|
||||||
log_info(cds)("ArchiveRelocationMode == 1: always map archive(s) at an alternative address");
|
aot_log_info(aot)("ArchiveRelocationMode == 1: always map archive(s) at an alternative address");
|
||||||
return MAP_ARCHIVE_MMAP_FAILURE;
|
return MAP_ARCHIVE_MMAP_FAILURE;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ArchiveRelocationMode == 2 && !use_requested_addr) {
|
if (ArchiveRelocationMode == 2 && !use_requested_addr) {
|
||||||
log_info(cds)("ArchiveRelocationMode == 2: never map archive(s) at an alternative address");
|
aot_log_info(aot)("ArchiveRelocationMode == 2: never map archive(s) at an alternative address");
|
||||||
return MAP_ARCHIVE_MMAP_FAILURE;
|
return MAP_ARCHIVE_MMAP_FAILURE;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1302,7 +1306,7 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File
|
|||||||
class_space_rs);
|
class_space_rs);
|
||||||
if (mapped_base_address == nullptr) {
|
if (mapped_base_address == nullptr) {
|
||||||
result = MAP_ARCHIVE_MMAP_FAILURE;
|
result = MAP_ARCHIVE_MMAP_FAILURE;
|
||||||
log_debug(cds)("Failed to reserve spaces (use_requested_addr=%u)", (unsigned)use_requested_addr);
|
aot_log_debug(aot)("Failed to reserve spaces (use_requested_addr=%u)", (unsigned)use_requested_addr);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (Metaspace::using_class_space()) {
|
if (Metaspace::using_class_space()) {
|
||||||
@ -1332,10 +1336,10 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File
|
|||||||
}
|
}
|
||||||
#endif // ASSERT
|
#endif // ASSERT
|
||||||
|
|
||||||
log_info(cds)("Reserved archive_space_rs [" INTPTR_FORMAT " - " INTPTR_FORMAT "] (%zu) bytes%s",
|
aot_log_info(aot)("Reserved archive_space_rs [" INTPTR_FORMAT " - " INTPTR_FORMAT "] (%zu) bytes%s",
|
||||||
p2i(archive_space_rs.base()), p2i(archive_space_rs.end()), archive_space_rs.size(),
|
p2i(archive_space_rs.base()), p2i(archive_space_rs.end()), archive_space_rs.size(),
|
||||||
(prot_zone_size > 0 ? " (includes protection zone)" : ""));
|
(prot_zone_size > 0 ? " (includes protection zone)" : ""));
|
||||||
log_info(cds)("Reserved class_space_rs [" INTPTR_FORMAT " - " INTPTR_FORMAT "] (%zu) bytes",
|
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());
|
p2i(class_space_rs.base()), p2i(class_space_rs.end()), class_space_rs.size());
|
||||||
|
|
||||||
if (MetaspaceShared::use_windows_memory_mapping()) {
|
if (MetaspaceShared::use_windows_memory_mapping()) {
|
||||||
@ -1357,7 +1361,7 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File
|
|||||||
// pointers anyway so there's no benefit to mmap.
|
// pointers anyway so there's no benefit to mmap.
|
||||||
if (use_requested_addr) {
|
if (use_requested_addr) {
|
||||||
assert(!total_space_rs.is_reserved(), "Should not be reserved for Windows");
|
assert(!total_space_rs.is_reserved(), "Should not be reserved for Windows");
|
||||||
log_info(cds)("Windows mmap workaround: releasing archive space.");
|
aot_log_info(aot)("Windows mmap workaround: releasing archive space.");
|
||||||
MemoryReserver::release(archive_space_rs);
|
MemoryReserver::release(archive_space_rs);
|
||||||
// Mark as not reserved
|
// Mark as not reserved
|
||||||
archive_space_rs = {};
|
archive_space_rs = {};
|
||||||
@ -1374,7 +1378,7 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File
|
|||||||
mtClassShared);
|
mtClassShared);
|
||||||
assert(p == mapped_base_address || p == nullptr, "must be");
|
assert(p == mapped_base_address || p == nullptr, "must be");
|
||||||
if (p == nullptr) {
|
if (p == nullptr) {
|
||||||
log_debug(cds)("Failed to re-reserve protection zone");
|
aot_log_debug(aot)("Failed to re-reserve protection zone");
|
||||||
return MAP_ARCHIVE_MMAP_FAILURE;
|
return MAP_ARCHIVE_MMAP_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1399,7 +1403,7 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File
|
|||||||
// debug builds, we do it here (after all archives have possibly been
|
// debug builds, we do it here (after all archives have possibly been
|
||||||
// mapped), so we can thoroughly test the code for failure handling
|
// mapped), so we can thoroughly test the code for failure handling
|
||||||
// (releasing all allocated resource, etc).
|
// (releasing all allocated resource, etc).
|
||||||
log_info(cds)("ArchiveRelocationMode == 1: always map archive(s) at an alternative address");
|
aot_log_info(aot)("ArchiveRelocationMode == 1: always map archive(s) at an alternative address");
|
||||||
if (static_result == MAP_ARCHIVE_SUCCESS) {
|
if (static_result == MAP_ARCHIVE_SUCCESS) {
|
||||||
static_result = MAP_ARCHIVE_MMAP_FAILURE;
|
static_result = MAP_ARCHIVE_MMAP_FAILURE;
|
||||||
}
|
}
|
||||||
@ -1468,8 +1472,8 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File
|
|||||||
static_mapinfo->map_or_load_heap_region();
|
static_mapinfo->map_or_load_heap_region();
|
||||||
}
|
}
|
||||||
#endif // _LP64
|
#endif // _LP64
|
||||||
log_info(cds)("initial optimized module handling: %s", CDSConfig::is_using_optimized_module_handling() ? "enabled" : "disabled");
|
log_info(aot)("initial optimized module handling: %s", CDSConfig::is_using_optimized_module_handling() ? "enabled" : "disabled");
|
||||||
log_info(cds)("initial full module graph: %s", CDSConfig::is_using_full_module_graph() ? "enabled" : "disabled");
|
log_info(aot)("initial full module graph: %s", CDSConfig::is_using_full_module_graph() ? "enabled" : "disabled");
|
||||||
} else {
|
} else {
|
||||||
unmap_archive(static_mapinfo);
|
unmap_archive(static_mapinfo);
|
||||||
unmap_archive(dynamic_mapinfo);
|
unmap_archive(dynamic_mapinfo);
|
||||||
@ -1615,7 +1619,7 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma
|
|||||||
const int precomputed_narrow_klass_shift = ArchiveBuilder::precomputed_narrow_klass_shift();
|
const int precomputed_narrow_klass_shift = ArchiveBuilder::precomputed_narrow_klass_shift();
|
||||||
if (!CompressedKlassPointers::check_klass_decode_mode(base_address, precomputed_narrow_klass_shift,
|
if (!CompressedKlassPointers::check_klass_decode_mode(base_address, precomputed_narrow_klass_shift,
|
||||||
total_range_size)) {
|
total_range_size)) {
|
||||||
log_info(cds)("CDS initialization: Cannot use SharedBaseAddress " PTR_FORMAT " with precomputed shift %d.",
|
aot_log_info(aot)("CDS initialization: Cannot use SharedBaseAddress " PTR_FORMAT " with precomputed shift %d.",
|
||||||
p2i(base_address), precomputed_narrow_klass_shift);
|
p2i(base_address), precomputed_narrow_klass_shift);
|
||||||
use_archive_base_addr = false;
|
use_archive_base_addr = false;
|
||||||
}
|
}
|
||||||
@ -1699,17 +1703,17 @@ void MetaspaceShared::release_reserved_spaces(ReservedSpace& total_space_rs,
|
|||||||
ReservedSpace& archive_space_rs,
|
ReservedSpace& archive_space_rs,
|
||||||
ReservedSpace& class_space_rs) {
|
ReservedSpace& class_space_rs) {
|
||||||
if (total_space_rs.is_reserved()) {
|
if (total_space_rs.is_reserved()) {
|
||||||
log_debug(cds)("Released shared space (archive + class) " INTPTR_FORMAT, p2i(total_space_rs.base()));
|
aot_log_debug(aot)("Released shared space (archive + class) " INTPTR_FORMAT, p2i(total_space_rs.base()));
|
||||||
MemoryReserver::release(total_space_rs);
|
MemoryReserver::release(total_space_rs);
|
||||||
total_space_rs = {};
|
total_space_rs = {};
|
||||||
} else {
|
} else {
|
||||||
if (archive_space_rs.is_reserved()) {
|
if (archive_space_rs.is_reserved()) {
|
||||||
log_debug(cds)("Released shared space (archive) " INTPTR_FORMAT, p2i(archive_space_rs.base()));
|
aot_log_debug(aot)("Released shared space (archive) " INTPTR_FORMAT, p2i(archive_space_rs.base()));
|
||||||
MemoryReserver::release(archive_space_rs);
|
MemoryReserver::release(archive_space_rs);
|
||||||
archive_space_rs = {};
|
archive_space_rs = {};
|
||||||
}
|
}
|
||||||
if (class_space_rs.is_reserved()) {
|
if (class_space_rs.is_reserved()) {
|
||||||
log_debug(cds)("Released shared space (classes) " INTPTR_FORMAT, p2i(class_space_rs.base()));
|
aot_log_debug(aot)("Released shared space (classes) " INTPTR_FORMAT, p2i(class_space_rs.base()));
|
||||||
MemoryReserver::release(class_space_rs);
|
MemoryReserver::release(class_space_rs);
|
||||||
class_space_rs = {};
|
class_space_rs = {};
|
||||||
}
|
}
|
||||||
@ -1819,7 +1823,7 @@ void MetaspaceShared::initialize_shared_spaces() {
|
|||||||
dynamic_mapinfo->unmap_region(MetaspaceShared::bm);
|
dynamic_mapinfo->unmap_region(MetaspaceShared::bm);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogStreamHandle(Info, cds) lsh;
|
LogStreamHandle(Info, aot) lsh;
|
||||||
if (lsh.is_enabled()) {
|
if (lsh.is_enabled()) {
|
||||||
lsh.print("Using AOT-linked classes: %s (static archive: %s aot-linked classes",
|
lsh.print("Using AOT-linked classes: %s (static archive: %s aot-linked classes",
|
||||||
BOOL_TO_STR(CDSConfig::is_using_aot_linked_classes()),
|
BOOL_TO_STR(CDSConfig::is_using_aot_linked_classes()),
|
||||||
|
|||||||
@ -110,7 +110,7 @@ public:
|
|||||||
static bool is_shared_dynamic(void* p) NOT_CDS_RETURN_(false);
|
static bool is_shared_dynamic(void* p) NOT_CDS_RETURN_(false);
|
||||||
static bool is_shared_static(void* p) NOT_CDS_RETURN_(false);
|
static bool is_shared_static(void* p) NOT_CDS_RETURN_(false);
|
||||||
|
|
||||||
static void unrecoverable_loading_error(const char* message = nullptr) ATTRIBUTE_PRINTF(1, 0);
|
static void unrecoverable_loading_error(const char* message = "unrecoverable error");
|
||||||
static void report_loading_error(const char* format, ...) ATTRIBUTE_PRINTF(1, 0);
|
static void report_loading_error(const char* format, ...) ATTRIBUTE_PRINTF(1, 0);
|
||||||
static void unrecoverable_writing_error(const char* message = nullptr);
|
static void unrecoverable_writing_error(const char* message = nullptr);
|
||||||
static void writing_error(const char* message = nullptr);
|
static void writing_error(const char* message = nullptr);
|
||||||
|
|||||||
@ -1206,7 +1206,7 @@ bool java_lang_Class::restore_archived_mirror(Klass *k,
|
|||||||
k->clear_archived_mirror_index();
|
k->clear_archived_mirror_index();
|
||||||
|
|
||||||
// mirror is archived, restore
|
// mirror is archived, restore
|
||||||
log_debug(cds, mirror)("Archived mirror is: " PTR_FORMAT, p2i(m));
|
log_debug(aot, mirror)("Archived mirror is: " PTR_FORMAT, p2i(m));
|
||||||
assert(as_Klass(m) == k, "must be");
|
assert(as_Klass(m) == k, "must be");
|
||||||
Handle mirror(THREAD, m);
|
Handle mirror(THREAD, m);
|
||||||
|
|
||||||
@ -1231,9 +1231,9 @@ bool java_lang_Class::restore_archived_mirror(Klass *k,
|
|||||||
|
|
||||||
set_mirror_module_field(THREAD, k, mirror, module);
|
set_mirror_module_field(THREAD, k, mirror, module);
|
||||||
|
|
||||||
if (log_is_enabled(Trace, cds, heap, mirror)) {
|
if (log_is_enabled(Trace, aot, heap, mirror)) {
|
||||||
ResourceMark rm(THREAD);
|
ResourceMark rm(THREAD);
|
||||||
log_trace(cds, heap, mirror)(
|
log_trace(aot, heap, mirror)(
|
||||||
"Restored %s archived mirror " PTR_FORMAT, k->external_name(), p2i(mirror()));
|
"Restored %s archived mirror " PTR_FORMAT, k->external_name(), p2i(mirror()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -792,9 +792,9 @@ void Klass::remove_unshareable_info() {
|
|||||||
assert(CDSConfig::is_dumping_archive(),
|
assert(CDSConfig::is_dumping_archive(),
|
||||||
"only called during CDS dump time");
|
"only called during CDS dump time");
|
||||||
JFR_ONLY(REMOVE_ID(this);)
|
JFR_ONLY(REMOVE_ID(this);)
|
||||||
if (log_is_enabled(Trace, cds, unshareable)) {
|
if (log_is_enabled(Trace, aot, unshareable)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_trace(cds, unshareable)("remove: %s", external_name());
|
log_trace(aot, unshareable)("remove: %s", external_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
// _secondary_super_cache may be updated by an is_subtype_of() call
|
// _secondary_super_cache may be updated by an is_subtype_of() call
|
||||||
@ -818,9 +818,9 @@ void Klass::remove_unshareable_info() {
|
|||||||
|
|
||||||
void Klass::remove_java_mirror() {
|
void Klass::remove_java_mirror() {
|
||||||
assert(CDSConfig::is_dumping_archive(), "sanity");
|
assert(CDSConfig::is_dumping_archive(), "sanity");
|
||||||
if (log_is_enabled(Trace, cds, unshareable)) {
|
if (log_is_enabled(Trace, aot, unshareable)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
log_trace(cds, unshareable)("remove java_mirror: %s", external_name());
|
log_trace(aot, unshareable)("remove java_mirror: %s", external_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if INCLUDE_CDS_JAVA_HEAP
|
#if INCLUDE_CDS_JAVA_HEAP
|
||||||
@ -856,10 +856,10 @@ void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protec
|
|||||||
assert(is_shared(), "must be set");
|
assert(is_shared(), "must be set");
|
||||||
assert(secondary_supers()->length() >= (int)population_count(_secondary_supers_bitmap), "must be");
|
assert(secondary_supers()->length() >= (int)population_count(_secondary_supers_bitmap), "must be");
|
||||||
JFR_ONLY(RESTORE_ID(this);)
|
JFR_ONLY(RESTORE_ID(this);)
|
||||||
if (log_is_enabled(Trace, cds, unshareable)) {
|
if (log_is_enabled(Trace, aot, unshareable)) {
|
||||||
ResourceMark rm(THREAD);
|
ResourceMark rm(THREAD);
|
||||||
oop class_loader = loader_data->class_loader();
|
oop class_loader = loader_data->class_loader();
|
||||||
log_trace(cds, unshareable)("restore: %s with class loader: %s", external_name(),
|
log_trace(aot, unshareable)("restore: %s with class loader: %s", external_name(),
|
||||||
class_loader != nullptr ? class_loader->klass()->external_name() : "boot");
|
class_loader != nullptr ? class_loader->klass()->external_name() : "boot");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -892,7 +892,7 @@ void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protec
|
|||||||
|
|
||||||
if (this->has_archived_mirror_index()) {
|
if (this->has_archived_mirror_index()) {
|
||||||
ResourceMark rm(THREAD);
|
ResourceMark rm(THREAD);
|
||||||
log_debug(cds, mirror)("%s has raw archived mirror", external_name());
|
log_debug(aot, mirror)("%s has raw archived mirror", external_name());
|
||||||
if (ArchiveHeapLoader::is_in_use()) {
|
if (ArchiveHeapLoader::is_in_use()) {
|
||||||
bool present = java_lang_Class::restore_archived_mirror(this, loader, module_handle,
|
bool present = java_lang_Class::restore_archived_mirror(this, loader, module_handle,
|
||||||
protection_domain,
|
protection_domain,
|
||||||
@ -903,7 +903,7 @@ void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protec
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No archived mirror data
|
// No archived mirror data
|
||||||
log_debug(cds, mirror)("No archived mirror data for %s", external_name());
|
log_debug(aot, mirror)("No archived mirror data for %s", external_name());
|
||||||
clear_java_mirror_handle();
|
clear_java_mirror_handle();
|
||||||
this->clear_archived_mirror_index();
|
this->clear_archived_mirror_index();
|
||||||
}
|
}
|
||||||
@ -912,7 +912,7 @@ void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protec
|
|||||||
// gotten an OOM later but keep the mirror if it was created.
|
// gotten an OOM later but keep the mirror if it was created.
|
||||||
if (java_mirror() == nullptr) {
|
if (java_mirror() == nullptr) {
|
||||||
ResourceMark rm(THREAD);
|
ResourceMark rm(THREAD);
|
||||||
log_trace(cds, mirror)("Recreate mirror for %s", external_name());
|
log_trace(aot, mirror)("Recreate mirror for %s", external_name());
|
||||||
java_lang_Class::create_mirror(this, loader, module_handle, protection_domain, Handle(), CHECK);
|
java_lang_Class::create_mirror(this, loader, module_handle, protection_domain, Handle(), CHECK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -954,7 +954,7 @@ void IterateOverHeapObjectClosure::do_object(oop o) {
|
|||||||
|
|
||||||
// skip if object is a dormant shared object whose mirror hasn't been loaded
|
// skip if object is a dormant shared object whose mirror hasn't been loaded
|
||||||
if (o != nullptr && o->klass()->java_mirror() == nullptr) {
|
if (o != nullptr && o->klass()->java_mirror() == nullptr) {
|
||||||
log_debug(cds, heap)("skipped dormant archived object " INTPTR_FORMAT " (%s)", p2i(o),
|
log_debug(aot, heap)("skipped dormant archived object " INTPTR_FORMAT " (%s)", p2i(o),
|
||||||
o->klass()->external_name());
|
o->klass()->external_name());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1040,7 +1040,7 @@ void IterateThroughHeapObjectClosure::do_object(oop obj) {
|
|||||||
|
|
||||||
// skip if object is a dormant shared object whose mirror hasn't been loaded
|
// skip if object is a dormant shared object whose mirror hasn't been loaded
|
||||||
if (obj != nullptr && obj->klass()->java_mirror() == nullptr) {
|
if (obj != nullptr && obj->klass()->java_mirror() == nullptr) {
|
||||||
log_debug(cds, heap)("skipped dormant archived object " INTPTR_FORMAT " (%s)", p2i(obj),
|
log_debug(aot, heap)("skipped dormant archived object " INTPTR_FORMAT " (%s)", p2i(obj),
|
||||||
obj->klass()->external_name());
|
obj->klass()->external_name());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "cds/aotLogging.hpp"
|
||||||
#include "cds/cds_globals.hpp"
|
#include "cds/cds_globals.hpp"
|
||||||
#include "cds/cdsConfig.hpp"
|
#include "cds/cdsConfig.hpp"
|
||||||
#include "classfile/classLoader.hpp"
|
#include "classfile/classLoader.hpp"
|
||||||
@ -1362,7 +1363,7 @@ void Arguments::set_mode_flags(Mode mode) {
|
|||||||
// incompatible command line options were chosen.
|
// incompatible command line options were chosen.
|
||||||
void Arguments::no_shared_spaces(const char* message) {
|
void Arguments::no_shared_spaces(const char* message) {
|
||||||
if (RequireSharedSpaces) {
|
if (RequireSharedSpaces) {
|
||||||
log_error(cds)("%s is incompatible with other specified options.",
|
aot_log_error(aot)("%s is incompatible with other specified options.",
|
||||||
CDSConfig::new_aot_flags_used() ? "AOT cache" : "CDS");
|
CDSConfig::new_aot_flags_used() ? "AOT cache" : "CDS");
|
||||||
if (CDSConfig::new_aot_flags_used()) {
|
if (CDSConfig::new_aot_flags_used()) {
|
||||||
vm_exit_during_initialization("Unable to use AOT cache", message);
|
vm_exit_during_initialization("Unable to use AOT cache", message);
|
||||||
@ -1371,7 +1372,7 @@ void Arguments::no_shared_spaces(const char* message) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (CDSConfig::new_aot_flags_used()) {
|
if (CDSConfig::new_aot_flags_used()) {
|
||||||
log_warning(cds)("Unable to use AOT cache: %s", message);
|
log_warning(aot)("Unable to use AOT cache: %s", message);
|
||||||
} else {
|
} else {
|
||||||
log_info(cds)("Unable to use shared archive: %s", message);
|
log_info(cds)("Unable to use shared archive: %s", message);
|
||||||
}
|
}
|
||||||
@ -1562,7 +1563,7 @@ void Arguments::set_heap_size() {
|
|||||||
// was not specified.
|
// was not specified.
|
||||||
if (reasonable_max > max_coop_heap) {
|
if (reasonable_max > max_coop_heap) {
|
||||||
if (FLAG_IS_ERGO(UseCompressedOops) && override_coop_limit) {
|
if (FLAG_IS_ERGO(UseCompressedOops) && override_coop_limit) {
|
||||||
log_info(cds)("UseCompressedOops and UseCompressedClassPointers have been disabled due to"
|
aot_log_info(aot)("UseCompressedOops and UseCompressedClassPointers have been disabled due to"
|
||||||
" max heap %zu > compressed oop heap %zu. "
|
" max heap %zu > compressed oop heap %zu. "
|
||||||
"Please check the setting of MaxRAMPercentage %5.2f."
|
"Please check the setting of MaxRAMPercentage %5.2f."
|
||||||
,(size_t)reasonable_max, (size_t)max_coop_heap, MaxRAMPercentage);
|
,(size_t)reasonable_max, (size_t)max_coop_heap, MaxRAMPercentage);
|
||||||
|
|||||||
@ -794,14 +794,14 @@ class DumperSupport : AllStatic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void report_dormant_archived_object(oop o, oop ref_obj) {
|
static void report_dormant_archived_object(oop o, oop ref_obj) {
|
||||||
if (log_is_enabled(Trace, cds, heap)) {
|
if (log_is_enabled(Trace, aot, heap)) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
if (ref_obj != nullptr) {
|
if (ref_obj != nullptr) {
|
||||||
log_trace(cds, heap)("skipped dormant archived object " INTPTR_FORMAT " (%s) referenced by " INTPTR_FORMAT " (%s)",
|
log_trace(aot, heap)("skipped dormant archived object " INTPTR_FORMAT " (%s) referenced by " INTPTR_FORMAT " (%s)",
|
||||||
p2i(o), o->klass()->external_name(),
|
p2i(o), o->klass()->external_name(),
|
||||||
p2i(ref_obj), ref_obj->klass()->external_name());
|
p2i(ref_obj), ref_obj->klass()->external_name());
|
||||||
} else {
|
} else {
|
||||||
log_trace(cds, heap)("skipped dormant archived object " INTPTR_FORMAT " (%s)",
|
log_trace(aot, heap)("skipped dormant archived object " INTPTR_FORMAT " (%s)",
|
||||||
p2i(o), o->klass()->external_name());
|
p2i(o), o->klass()->external_name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2677,7 +2677,7 @@ int HeapDumper::dump(const char* path, outputStream* out, int compression, bool
|
|||||||
event.set_compression(compression);
|
event.set_compression(compression);
|
||||||
event.commit();
|
event.commit();
|
||||||
} else {
|
} else {
|
||||||
log_debug(cds, heap)("Error %s while dumping heap", error());
|
log_debug(aot, heap)("Error %s while dumping heap", error());
|
||||||
}
|
}
|
||||||
|
|
||||||
// print message in interactive case
|
// print message in interactive case
|
||||||
|
|||||||
@ -56,7 +56,7 @@ public class AOTFlags {
|
|||||||
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||||
"-XX:AOTMode=record",
|
"-XX:AOTMode=record",
|
||||||
"-XX:AOTConfiguration=" + aotConfigFile,
|
"-XX:AOTConfiguration=" + aotConfigFile,
|
||||||
"-Xlog:cds=debug",
|
"-Xlog:aot=debug",
|
||||||
"-cp", appJar, helloClass);
|
"-cp", appJar, helloClass);
|
||||||
|
|
||||||
OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "train");
|
OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "train");
|
||||||
@ -70,18 +70,18 @@ public class AOTFlags {
|
|||||||
"-XX:AOTMode=create",
|
"-XX:AOTMode=create",
|
||||||
"-XX:AOTConfiguration=" + aotConfigFile,
|
"-XX:AOTConfiguration=" + aotConfigFile,
|
||||||
"-XX:AOTCache=" + aotCacheFile,
|
"-XX:AOTCache=" + aotCacheFile,
|
||||||
"-Xlog:cds",
|
"-Xlog:aot",
|
||||||
"-cp", appJar);
|
"-cp", appJar);
|
||||||
out = CDSTestUtils.executeAndLog(pb, "asm");
|
out = CDSTestUtils.executeAndLog(pb, "asm");
|
||||||
out.shouldContain("Dumping shared data to file:");
|
out.shouldContain("AOTCache creation is complete");
|
||||||
out.shouldMatch("cds.*hello[.]aot");
|
out.shouldMatch("hello[.]aot");
|
||||||
out.shouldHaveExitValue(0);
|
out.shouldHaveExitValue(0);
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
printTestCase("Production Run with AOTCache");
|
printTestCase("Production Run with AOTCache");
|
||||||
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||||
"-XX:AOTCache=" + aotCacheFile,
|
"-XX:AOTCache=" + aotCacheFile,
|
||||||
"-Xlog:cds",
|
"-Xlog:aot",
|
||||||
"-cp", appJar, helloClass);
|
"-cp", appJar, helloClass);
|
||||||
out = CDSTestUtils.executeAndLog(pb, "prod");
|
out = CDSTestUtils.executeAndLog(pb, "prod");
|
||||||
out.shouldContain("Using AOT-linked classes: true (static archive: has aot-linked classes)");
|
out.shouldContain("Using AOT-linked classes: true (static archive: has aot-linked classes)");
|
||||||
@ -94,7 +94,7 @@ public class AOTFlags {
|
|||||||
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||||
"-XX:AOTCache=" + aotCacheFile,
|
"-XX:AOTCache=" + aotCacheFile,
|
||||||
"--show-version",
|
"--show-version",
|
||||||
"-Xlog:cds",
|
"-Xlog:aot",
|
||||||
"-XX:AOTMode=off",
|
"-XX:AOTMode=off",
|
||||||
"-cp", appJar, helloClass);
|
"-cp", appJar, helloClass);
|
||||||
out = CDSTestUtils.executeAndLog(pb, "prod");
|
out = CDSTestUtils.executeAndLog(pb, "prod");
|
||||||
@ -108,7 +108,7 @@ public class AOTFlags {
|
|||||||
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||||
"-XX:AOTCache=" + aotCacheFile,
|
"-XX:AOTCache=" + aotCacheFile,
|
||||||
"--show-version",
|
"--show-version",
|
||||||
"-Xlog:cds",
|
"-Xlog:aot",
|
||||||
"-XX:AOTMode=auto",
|
"-XX:AOTMode=auto",
|
||||||
"-cp", appJar, helloClass);
|
"-cp", appJar, helloClass);
|
||||||
out = CDSTestUtils.executeAndLog(pb, "prod");
|
out = CDSTestUtils.executeAndLog(pb, "prod");
|
||||||
@ -122,7 +122,7 @@ public class AOTFlags {
|
|||||||
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||||
"-XX:AOTCache=" + aotCacheFile,
|
"-XX:AOTCache=" + aotCacheFile,
|
||||||
"--show-version",
|
"--show-version",
|
||||||
"-Xlog:cds",
|
"-Xlog:aot",
|
||||||
"-XX:AOTMode=on",
|
"-XX:AOTMode=on",
|
||||||
"-cp", appJar, helloClass);
|
"-cp", appJar, helloClass);
|
||||||
out = CDSTestUtils.executeAndLog(pb, "prod");
|
out = CDSTestUtils.executeAndLog(pb, "prod");
|
||||||
@ -138,18 +138,18 @@ public class AOTFlags {
|
|||||||
"-XX:-AOTClassLinking",
|
"-XX:-AOTClassLinking",
|
||||||
"-XX:AOTConfiguration=" + aotConfigFile,
|
"-XX:AOTConfiguration=" + aotConfigFile,
|
||||||
"-XX:AOTCache=" + aotCacheFile,
|
"-XX:AOTCache=" + aotCacheFile,
|
||||||
"-Xlog:cds",
|
"-Xlog:aot",
|
||||||
"-cp", appJar);
|
"-cp", appJar);
|
||||||
out = CDSTestUtils.executeAndLog(pb, "asm");
|
out = CDSTestUtils.executeAndLog(pb, "asm");
|
||||||
out.shouldContain("Dumping shared data to file:");
|
out.shouldContain("AOTCache creation is complete");
|
||||||
out.shouldMatch("cds.*hello[.]aot");
|
out.shouldMatch("hello[.]aot");
|
||||||
out.shouldHaveExitValue(0);
|
out.shouldHaveExitValue(0);
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
printTestCase("Production Run with AOTCache, which was created with -XX:-AOTClassLinking");
|
printTestCase("Production Run with AOTCache, which was created with -XX:-AOTClassLinking");
|
||||||
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||||
"-XX:AOTCache=" + aotCacheFile,
|
"-XX:AOTCache=" + aotCacheFile,
|
||||||
"-Xlog:cds",
|
"-Xlog:aot",
|
||||||
"-cp", appJar, helloClass);
|
"-cp", appJar, helloClass);
|
||||||
out = CDSTestUtils.executeAndLog(pb, "prod");
|
out = CDSTestUtils.executeAndLog(pb, "prod");
|
||||||
out.shouldContain("Using AOT-linked classes: false (static archive: no aot-linked classes)");
|
out.shouldContain("Using AOT-linked classes: false (static archive: no aot-linked classes)");
|
||||||
@ -345,7 +345,7 @@ public class AOTFlags {
|
|||||||
out.shouldHaveExitValue(0);
|
out.shouldHaveExitValue(0);
|
||||||
|
|
||||||
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||||
"-Xlog:cds",
|
"-Xlog:aot",
|
||||||
"-XX:AOTMode=on",
|
"-XX:AOTMode=on",
|
||||||
"-XX:AOTCache=" + dynamicArchive,
|
"-XX:AOTCache=" + dynamicArchive,
|
||||||
"--version");
|
"--version");
|
||||||
|
|||||||
@ -64,7 +64,7 @@ public class ArchiveRelocationTest {
|
|||||||
String maybeRelocation = "-XX:ArchiveRelocationMode=0";
|
String maybeRelocation = "-XX:ArchiveRelocationMode=0";
|
||||||
String alwaysRelocation = "-XX:ArchiveRelocationMode=1";
|
String alwaysRelocation = "-XX:ArchiveRelocationMode=1";
|
||||||
String runRelocArg = run_reloc ? alwaysRelocation : maybeRelocation;
|
String runRelocArg = run_reloc ? alwaysRelocation : maybeRelocation;
|
||||||
String logArg = "-Xlog:cds=debug,cds+reloc=debug,cds+heap";
|
String logArg = "-Xlog:cds=debug,cds+reloc=debug,aot+heap";
|
||||||
String unlockArg = "-XX:+UnlockDiagnosticVMOptions";
|
String unlockArg = "-XX:+UnlockDiagnosticVMOptions";
|
||||||
String nmtArg = "-XX:NativeMemoryTracking=detail";
|
String nmtArg = "-XX:NativeMemoryTracking=detail";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -41,7 +41,7 @@ public class ClassListFormatBase {
|
|||||||
System.out.println("------------------------------");
|
System.out.println("------------------------------");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
OutputAnalyzer output = TestCommon.dump(appJar, appClasses, "-Xlog:cds+lambda=debug");
|
OutputAnalyzer output = TestCommon.dump(appJar, appClasses, "-Xlog:aot+lambda=debug");
|
||||||
output.shouldHaveExitValue(1);
|
output.shouldHaveExitValue(1);
|
||||||
for (String s : expected_errors) {
|
for (String s : expected_errors) {
|
||||||
output.shouldContain(s);
|
output.shouldContain(s);
|
||||||
@ -63,7 +63,7 @@ public class ClassListFormatBase {
|
|||||||
System.out.println("------------------------------");
|
System.out.println("------------------------------");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
OutputAnalyzer output = TestCommon.dump(appJar, appClasses, "-Xlog:cds", "-Xlog:cds+lambda=debug");
|
OutputAnalyzer output = TestCommon.dump(appJar, appClasses, "-Xlog:cds", "-Xlog:aot", "-Xlog:aot+lambda=debug");
|
||||||
output.shouldHaveExitValue(0);
|
output.shouldHaveExitValue(0);
|
||||||
output.shouldContain("Dumping");
|
output.shouldContain("Dumping");
|
||||||
for (String s : expected_msgs) {
|
for (String s : expected_msgs) {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -94,7 +94,7 @@ public class DumpingWithNoCoops {
|
|||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
final String noCoops = "-XX:-UseCompressedOops";
|
final String noCoops = "-XX:-UseCompressedOops";
|
||||||
final String logArg = "-Xlog:gc+heap=trace,cds=debug";
|
final String logArg = "-Xlog:gc+heap=trace,cds=debug,aot=debug";
|
||||||
JarBuilder.getOrCreateHelloJar();
|
JarBuilder.getOrCreateHelloJar();
|
||||||
String appJar = TestCommon.getTestJar("hello.jar");
|
String appJar = TestCommon.getTestJar("hello.jar");
|
||||||
String appClasses[] = TestCommon.list("Hello");
|
String appClasses[] = TestCommon.list("Hello");
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -81,7 +81,7 @@ public class LambdaWithJavaAgent {
|
|||||||
|
|
||||||
// run with archive
|
// run with archive
|
||||||
CDSOptions runOpts = (new CDSOptions())
|
CDSOptions runOpts = (new CDSOptions())
|
||||||
.addPrefix("-cp", appJar, "-Xlog:class+load,cds=debug",
|
.addPrefix("-cp", appJar, "-Xlog:class+load=debug,cds=debug,class+path=debug",
|
||||||
"-XX:+UnlockDiagnosticVMOptions",
|
"-XX:+UnlockDiagnosticVMOptions",
|
||||||
"-XX:+AllowArchivingWithJavaAgent",
|
"-XX:+AllowArchivingWithJavaAgent",
|
||||||
useJavaAgent)
|
useJavaAgent)
|
||||||
|
|||||||
@ -60,15 +60,15 @@ public class AOTCacheSupportForCustomLoaders {
|
|||||||
|
|
||||||
SimpleCDSAppTester.of("AOTCacheSupportForCustomLoaders")
|
SimpleCDSAppTester.of("AOTCacheSupportForCustomLoaders")
|
||||||
.classpath("app.jar")
|
.classpath("app.jar")
|
||||||
.addVmArgs("-Xlog:cds+class=debug", "-Xlog:cds",
|
.addVmArgs("-Xlog:aot+class=debug", "-Xlog:aot", "-Xlog:cds",
|
||||||
"--module-path=" + modulePath,
|
"--module-path=" + modulePath,
|
||||||
"--add-modules=com.test")
|
"--add-modules=com.test")
|
||||||
.appCommandLine("AppWithCustomLoaders", modulePath)
|
.appCommandLine("AppWithCustomLoaders", modulePath)
|
||||||
.setAssemblyChecker((OutputAnalyzer out) -> {
|
.setAssemblyChecker((OutputAnalyzer out) -> {
|
||||||
out.shouldMatch("cds,class.*unreg AppWithCustomLoaders[$]MyLoadeeA")
|
out.shouldMatch(",class.*unreg AppWithCustomLoaders[$]MyLoadeeA")
|
||||||
.shouldMatch("cds,class.*unreg com.test.Foo")
|
.shouldMatch(",class.*unreg com.test.Foo")
|
||||||
.shouldMatch("cds,class.*array \\[LAppWithCustomLoaders[$]MyLoadeeA;")
|
.shouldMatch(",class.*array \\[LAppWithCustomLoaders[$]MyLoadeeA;")
|
||||||
.shouldNotMatch("cds,class.* ReturnIntegerAsString");
|
.shouldNotMatch(",class.* ReturnIntegerAsString");
|
||||||
})
|
})
|
||||||
.setProductionChecker((OutputAnalyzer out) -> {
|
.setProductionChecker((OutputAnalyzer out) -> {
|
||||||
out.shouldContain("Using AOT-linked classes: true");
|
out.shouldContain("Using AOT-linked classes: true");
|
||||||
|
|||||||
@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 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
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @summary when AOT cache options are used, old "cds" logs should be aliased to "aot".
|
||||||
|
* @requires vm.cds
|
||||||
|
* @requires vm.flagless
|
||||||
|
* @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds/test-classes
|
||||||
|
* @build Hello
|
||||||
|
* @run driver jdk.test.lib.helpers.ClassFileInstaller -jar hello.jar Hello
|
||||||
|
* @run driver AOTLoggingTag
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import jdk.test.lib.cds.CDSTestUtils;
|
||||||
|
import jdk.test.lib.helpers.ClassFileInstaller;
|
||||||
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
|
import jdk.test.lib.process.ProcessTools;
|
||||||
|
|
||||||
|
public class AOTLoggingTag {
|
||||||
|
static String appJar = ClassFileInstaller.getJarPath("hello.jar");
|
||||||
|
static String aotConfigFile = "hello.aotconfig";
|
||||||
|
static String aotCacheFile = "hello.aot";
|
||||||
|
static String helloClass = "Hello";
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
ProcessBuilder pb;
|
||||||
|
OutputAnalyzer out;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
printTestCase("Training Run");
|
||||||
|
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||||
|
"-XX:AOTMode=record",
|
||||||
|
"-XX:AOTConfiguration=" + aotConfigFile,
|
||||||
|
"-Xlog:aot",
|
||||||
|
"-cp", appJar, helloClass);
|
||||||
|
|
||||||
|
out = CDSTestUtils.executeAndLog(pb, "train");
|
||||||
|
out.shouldContain("[info][aot] Writing binary AOTConfiguration file:");
|
||||||
|
out.shouldHaveExitValue(0);
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
printTestCase("Assembly Phase");
|
||||||
|
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||||
|
"-XX:AOTMode=create",
|
||||||
|
"-XX:AOTConfiguration=" + aotConfigFile,
|
||||||
|
"-XX:AOTCache=" + aotCacheFile,
|
||||||
|
"-Xlog:aot",
|
||||||
|
"-cp", appJar);
|
||||||
|
out = CDSTestUtils.executeAndLog(pb, "asm");
|
||||||
|
out.shouldContain("[info][aot] Opened AOT configuration file hello.aotconfig");
|
||||||
|
out.shouldHaveExitValue(0);
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
printTestCase("Production Run with AOTCache");
|
||||||
|
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||||
|
"-XX:AOTCache=" + aotCacheFile,
|
||||||
|
"-Xlog:aot",
|
||||||
|
"-cp", appJar, helloClass);
|
||||||
|
out = CDSTestUtils.executeAndLog(pb, "prod");
|
||||||
|
out.shouldContain("[info][aot] Opened AOT cache hello.aot");
|
||||||
|
out.shouldHaveExitValue(0);
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
printTestCase("All old -Xlog:cds+heap logs have been changed to -Xlog:aot+heap should alias to -Xlog:cds+heap");
|
||||||
|
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||||
|
"-XX:AOTCache=" + aotCacheFile,
|
||||||
|
"-Xlog:aot+heap",
|
||||||
|
"-cp", appJar, helloClass);
|
||||||
|
out = CDSTestUtils.executeAndLog(pb, "prod");
|
||||||
|
out.shouldNotContain("No tag set matches selection: aot+heap");
|
||||||
|
out.shouldContain("[info][aot,heap] resolve subgraph java.lang.Integer$IntegerCache");
|
||||||
|
out.shouldHaveExitValue(0);
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
printTestCase("Production Run: errors should be printed with [aot] decoration");
|
||||||
|
pb = ProcessTools.createLimitedTestJavaProcessBuilder(
|
||||||
|
"-XX:AOTCache=nosuchfile.aot",
|
||||||
|
"-XX:AOTMode=on",
|
||||||
|
"-cp", appJar, helloClass);
|
||||||
|
out = CDSTestUtils.executeAndLog(pb, "prod");
|
||||||
|
out.shouldContain("[error][aot] An error has occurred while processing the AOT cache. Run with -Xlog:aot for details.");
|
||||||
|
out.shouldNotHaveExitValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int testNum = 0;
|
||||||
|
static void printTestCase(String s) {
|
||||||
|
System.out.println("vvvvvvv TEST CASE " + testNum + ": " + s + " starts here vvvvvvv");
|
||||||
|
testNum++;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -41,7 +41,7 @@ import jdk.test.lib.process.OutputAnalyzer;
|
|||||||
public class VerifierFailOver {
|
public class VerifierFailOver {
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
SimpleCDSAppTester.of("VerifierFailOver")
|
SimpleCDSAppTester.of("VerifierFailOver")
|
||||||
.addVmArgs("-Xlog:cds+class=debug")
|
.addVmArgs("-Xlog:aot+class=debug")
|
||||||
.classpath("app.jar")
|
.classpath("app.jar")
|
||||||
.appCommandLine("VerifierFailOverApp")
|
.appCommandLine("VerifierFailOverApp")
|
||||||
.setTrainingChecker((OutputAnalyzer out) -> {
|
.setTrainingChecker((OutputAnalyzer out) -> {
|
||||||
|
|||||||
@ -42,7 +42,7 @@ import jdk.test.lib.process.OutputAnalyzer;
|
|||||||
public class AOTCacheWithZGC {
|
public class AOTCacheWithZGC {
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
SimpleCDSAppTester.of("AOTCacheWithZGC")
|
SimpleCDSAppTester.of("AOTCacheWithZGC")
|
||||||
.addVmArgs("-XX:+UseZGC", "-Xlog:cds")
|
.addVmArgs("-XX:+UseZGC", "-Xlog:cds", "-Xlog:aot")
|
||||||
.classpath("app.jar")
|
.classpath("app.jar")
|
||||||
.appCommandLine("AOTCacheWithZGCApp")
|
.appCommandLine("AOTCacheWithZGCApp")
|
||||||
.setProductionChecker((OutputAnalyzer out) -> {
|
.setProductionChecker((OutputAnalyzer out) -> {
|
||||||
|
|||||||
@ -124,12 +124,14 @@ public class AOTClassLinkingVMOptions {
|
|||||||
"--module-path", modulePath,
|
"--module-path", modulePath,
|
||||||
"-XX:+AOTClassLinking",
|
"-XX:+AOTClassLinking",
|
||||||
"-m", MAIN_MODULE);
|
"-m", MAIN_MODULE);
|
||||||
TestCommon.run("-Xlog:cds",
|
TestCommon.run("-Xlog:aot",
|
||||||
|
"-Xlog:cds",
|
||||||
"--module-path", modulePath,
|
"--module-path", modulePath,
|
||||||
"-m", MAIN_MODULE)
|
"-m", MAIN_MODULE)
|
||||||
.assertNormalExit("Using AOT-linked classes: true");
|
.assertNormalExit("Using AOT-linked classes: true");
|
||||||
|
|
||||||
TestCommon.run("-Xlog:cds",
|
TestCommon.run("-Xlog:aot",
|
||||||
|
"-Xlog:cds",
|
||||||
"--module-path", modulePath + "/bad",
|
"--module-path", modulePath + "/bad",
|
||||||
"-m", MAIN_MODULE)
|
"-m", MAIN_MODULE)
|
||||||
.assertAbnormalExit("shared archive file has aot-linked classes. It cannot be used when archived full module graph is not used.");
|
.assertAbnormalExit("shared archive file has aot-linked classes. It cannot be used when archived full module graph is not used.");
|
||||||
@ -139,7 +141,8 @@ public class AOTClassLinkingVMOptions {
|
|||||||
"--module-path", modulePath,
|
"--module-path", modulePath,
|
||||||
"-XX:+AOTClassLinking",
|
"-XX:+AOTClassLinking",
|
||||||
"--add-modules", MAIN_MODULE);
|
"--add-modules", MAIN_MODULE);
|
||||||
TestCommon.run("-Xlog:cds",
|
TestCommon.run("-Xlog:aot",
|
||||||
|
"-Xlog:cds",
|
||||||
"--module-path", modulePath,
|
"--module-path", modulePath,
|
||||||
"--add-modules", MAIN_MODULE,
|
"--add-modules", MAIN_MODULE,
|
||||||
MAIN_CLASS)
|
MAIN_CLASS)
|
||||||
|
|||||||
@ -137,7 +137,7 @@ public class BulkLoaderTest {
|
|||||||
@Override
|
@Override
|
||||||
public String[] vmArgs(RunMode runMode) {
|
public String[] vmArgs(RunMode runMode) {
|
||||||
return new String[] {
|
return new String[] {
|
||||||
"-Xlog:cds,cds+aot+load,cds+class=debug",
|
"-Xlog:cds,aot+load,cds+class=debug,aot+class=debug",
|
||||||
"-XX:+AOTClassLinking",
|
"-XX:+AOTClassLinking",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ public class BulkLoaderTest {
|
|||||||
|
|
||||||
if (isDumping(runMode)) {
|
if (isDumping(runMode)) {
|
||||||
// Check that we are archiving classes for custom class loaders.
|
// Check that we are archiving classes for custom class loaders.
|
||||||
out.shouldMatch("cds,class.* SimpleCusty");
|
out.shouldMatch(",class.* SimpleCusty");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,7 +73,9 @@ public class FakeCodeLocation {
|
|||||||
@Override
|
@Override
|
||||||
public String[] vmArgs(RunMode runMode) {
|
public String[] vmArgs(RunMode runMode) {
|
||||||
String[] args = new String[] {
|
String[] args = new String[] {
|
||||||
|
"-Xlog:aot",
|
||||||
"-Xlog:cds",
|
"-Xlog:cds",
|
||||||
|
"-Xlog:aot+class=debug",
|
||||||
"-Xlog:cds+class=debug",
|
"-Xlog:cds+class=debug",
|
||||||
"-Xlog:class+load",
|
"-Xlog:class+load",
|
||||||
};
|
};
|
||||||
@ -94,9 +96,9 @@ public class FakeCodeLocation {
|
|||||||
@Override
|
@Override
|
||||||
public void checkExecution(OutputAnalyzer out, RunMode runMode) throws Exception {
|
public void checkExecution(OutputAnalyzer out, RunMode runMode) throws Exception {
|
||||||
if (isDumping(runMode)) {
|
if (isDumping(runMode)) {
|
||||||
out.shouldMatch("cds,class.* FakeCodeLocationApp");
|
out.shouldMatch(",class.* FakeCodeLocationApp");
|
||||||
out.shouldNotMatch("cds,class.* ClassNotInJar1");
|
out.shouldNotMatch(",class.* ClassNotInJar1");
|
||||||
out.shouldNotMatch("cds,class.* ClassNotInJar2");
|
out.shouldNotMatch(",class.* ClassNotInJar2");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runMode.isProductionRun()) {
|
if (runMode.isProductionRun()) {
|
||||||
|
|||||||
@ -125,7 +125,7 @@ public class AOTCodeCompressedOopsTest {
|
|||||||
case RunMode.ASSEMBLY: {
|
case RunMode.ASSEMBLY: {
|
||||||
List<String> args = getVMArgsForHeapConfig(zeroBaseInAsmPhase, zeroShiftInAsmPhase);
|
List<String> args = getVMArgsForHeapConfig(zeroBaseInAsmPhase, zeroShiftInAsmPhase);
|
||||||
args.addAll(List.of("-XX:+UnlockDiagnosticVMOptions",
|
args.addAll(List.of("-XX:+UnlockDiagnosticVMOptions",
|
||||||
"-Xlog:cds=info",
|
"-Xlog:aot=info",
|
||||||
"-Xlog:aot+codecache+init=debug",
|
"-Xlog:aot+codecache+init=debug",
|
||||||
"-Xlog:aot+codecache+exit=debug"));
|
"-Xlog:aot+codecache+exit=debug"));
|
||||||
return args.toArray(new String[0]);
|
return args.toArray(new String[0]);
|
||||||
@ -133,7 +133,7 @@ public class AOTCodeCompressedOopsTest {
|
|||||||
case RunMode.PRODUCTION: {
|
case RunMode.PRODUCTION: {
|
||||||
List<String> args = getVMArgsForHeapConfig(zeroBaseInProdPhase, zeroShiftInProdPhase);
|
List<String> args = getVMArgsForHeapConfig(zeroBaseInProdPhase, zeroShiftInProdPhase);
|
||||||
args.addAll(List.of("-XX:+UnlockDiagnosticVMOptions",
|
args.addAll(List.of("-XX:+UnlockDiagnosticVMOptions",
|
||||||
"-Xlog:cds=info", // we need this to parse CompressedOops settings
|
"-Xlog:aot=info", // we need this to parse CompressedOops settings
|
||||||
"-Xlog:aot+codecache+init=debug",
|
"-Xlog:aot+codecache+init=debug",
|
||||||
"-Xlog:aot+codecache+exit=debug"));
|
"-Xlog:aot+codecache+exit=debug"));
|
||||||
return args.toArray(new String[0]);
|
return args.toArray(new String[0]);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -77,7 +77,7 @@ public class ArchiveHeapTestClass {
|
|||||||
extraOpts = TestCommon.concat(extraOpts,
|
extraOpts = TestCommon.concat(extraOpts,
|
||||||
"-Xbootclasspath/a:" + bootJar,
|
"-Xbootclasspath/a:" + bootJar,
|
||||||
"-XX:ArchiveHeapTestClass=" + bootClass,
|
"-XX:ArchiveHeapTestClass=" + bootClass,
|
||||||
"-Xlog:cds+heap");
|
"-Xlog:aot+heap");
|
||||||
return TestCommon.dump(appJar, classlist, extraOpts);
|
return TestCommon.dump(appJar, classlist, extraOpts);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,13 +109,13 @@ public class ArchiveHeapTestClass {
|
|||||||
testCase("Simple positive case");
|
testCase("Simple positive case");
|
||||||
output = dumpBootAndHello(CDSTestClassA_name);
|
output = dumpBootAndHello(CDSTestClassA_name);
|
||||||
mustSucceed(output, CDSTestClassA.getOutput()); // make sure <clinit> is executed
|
mustSucceed(output, CDSTestClassA.getOutput()); // make sure <clinit> is executed
|
||||||
output.shouldMatch("warning.*cds.*Loading ArchiveHeapTestClass " + CDSTestClassA_name);
|
output.shouldMatch("warning.*aot.*Loading ArchiveHeapTestClass " + CDSTestClassA_name);
|
||||||
output.shouldMatch("warning.*cds.*Initializing ArchiveHeapTestClass " + CDSTestClassA_name);
|
output.shouldMatch("warning.*aot.*Initializing ArchiveHeapTestClass " + CDSTestClassA_name);
|
||||||
output.shouldContain("Archived field " + CDSTestClassA_name + "::" + ARCHIVE_TEST_FIELD_NAME);
|
output.shouldContain("Archived field " + CDSTestClassA_name + "::" + ARCHIVE_TEST_FIELD_NAME);
|
||||||
output.shouldMatch("Archived object klass CDSTestClassA .*\\[LCDSTestClassA;");
|
output.shouldMatch("Archived object klass CDSTestClassA .*\\[LCDSTestClassA;");
|
||||||
output.shouldMatch("Archived object klass CDSTestClassA .*CDSTestClassA\\$YY");
|
output.shouldMatch("Archived object klass CDSTestClassA .*CDSTestClassA\\$YY");
|
||||||
|
|
||||||
TestCommon.run("-Xbootclasspath/a:" + bootJar, "-cp", appJar, "-Xlog:cds+heap", CDSTestClassA_name)
|
TestCommon.run("-Xbootclasspath/a:" + bootJar, "-cp", appJar, "-Xlog:aot+heap", CDSTestClassA_name)
|
||||||
.assertNormalExit(CDSTestClassA.getOutput(),
|
.assertNormalExit(CDSTestClassA.getOutput(),
|
||||||
"resolve subgraph " + CDSTestClassA_name);
|
"resolve subgraph " + CDSTestClassA_name);
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ public class ArchiveHeapTestClass {
|
|||||||
output = dumpBootAndHello(CDSTestClassG_name, "-XX:+AOTClassLinking", "-Xlog:cds+class=debug");
|
output = dumpBootAndHello(CDSTestClassG_name, "-XX:+AOTClassLinking", "-Xlog:cds+class=debug");
|
||||||
mustSucceed(output);
|
mustSucceed(output);
|
||||||
|
|
||||||
TestCommon.run("-Xbootclasspath/a:" + bootJar, "-cp", appJar, "-Xlog:cds+heap,cds+init",
|
TestCommon.run("-Xbootclasspath/a:" + bootJar, "-cp", appJar, "-Xlog:aot+heap,cds+init",
|
||||||
CDSTestClassG_name)
|
CDSTestClassG_name)
|
||||||
.assertNormalExit("init subgraph " + CDSTestClassG_name,
|
.assertNormalExit("init subgraph " + CDSTestClassG_name,
|
||||||
"Initialized from CDS");
|
"Initialized from CDS");
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -47,7 +47,7 @@ public class ArrayKlasses extends DynamicArchiveTestBase {
|
|||||||
final String appJar = ClassFileInstaller.getJarPath("ArrayKlasses.jar");
|
final String appJar = ClassFileInstaller.getJarPath("ArrayKlasses.jar");
|
||||||
final String mainClass = "ArrayKlassesApp";
|
final String mainClass = "ArrayKlassesApp";
|
||||||
final String runtimeLogOptions =
|
final String runtimeLogOptions =
|
||||||
"-Xlog:class+load,class+load+array=debug,cds+dynamic=debug,cds=debug,cds+unshareable=trace";
|
"-Xlog:class+load,class+load+array=debug,cds+dynamic=debug,cds=debug,aot+unshareable=trace";
|
||||||
|
|
||||||
// Case 1
|
// Case 1
|
||||||
// Create a dynamic archive with the ArrayKlassesApp app class and its
|
// Create a dynamic archive with the ArrayKlassesApp app class and its
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -77,7 +77,7 @@ public class DynamicLotsOfClasses extends DynamicArchiveTestBase {
|
|||||||
"ALL-SYSTEM",
|
"ALL-SYSTEM",
|
||||||
"-Xlog:hashtables",
|
"-Xlog:hashtables",
|
||||||
"-Xmx500m",
|
"-Xmx500m",
|
||||||
"-Xlog:cds=debug", // test detailed metadata info printing
|
"-Xlog:cds=debug,aot=debug", // test detailed metadata info printing
|
||||||
"-Xlog:cds+dynamic=info",
|
"-Xlog:cds+dynamic=info",
|
||||||
bootClassPath,
|
bootClassPath,
|
||||||
"-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
|
"-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
|
||||||
|
|||||||
@ -71,7 +71,7 @@ public class ExactOptionMatch {
|
|||||||
TestCommon.dumpBaseArchive(archiveName, o.cmdLine(), o.valueA())
|
TestCommon.dumpBaseArchive(archiveName, o.cmdLine(), o.valueA())
|
||||||
.shouldHaveExitValue(0);
|
.shouldHaveExitValue(0);
|
||||||
|
|
||||||
TestCommon.execCommon("-Xlog:cds", "--version")
|
TestCommon.execCommon("-Xlog:aot", "-Xlog:cds", "--version")
|
||||||
.shouldMatch("Mismatched values for property " + o.property() + ": j.*specified during dump time but not during runtime")
|
.shouldMatch("Mismatched values for property " + o.property() + ": j.*specified during dump time but not during runtime")
|
||||||
.shouldContain(FMG_DISABLED);
|
.shouldContain(FMG_DISABLED);
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ public class ExactOptionMatch {
|
|||||||
TestCommon.dumpBaseArchive(archiveName)
|
TestCommon.dumpBaseArchive(archiveName)
|
||||||
.shouldHaveExitValue(0);
|
.shouldHaveExitValue(0);
|
||||||
|
|
||||||
TestCommon.execCommon("-Xlog:cds", o.cmdLine(), o.valueA(), "--version")
|
TestCommon.execCommon("-Xlog:aot", "-Xlog:cds", o.cmdLine(), o.valueA(), "--version")
|
||||||
.shouldMatch("Mismatched values for property " + o.property() + ": j.*specified during runtime but not during dump time")
|
.shouldMatch("Mismatched values for property " + o.property() + ": j.*specified during runtime but not during dump time")
|
||||||
.shouldContain(FMG_DISABLED);
|
.shouldContain(FMG_DISABLED);
|
||||||
|
|
||||||
@ -88,18 +88,18 @@ public class ExactOptionMatch {
|
|||||||
.shouldHaveExitValue(0);
|
.shouldHaveExitValue(0);
|
||||||
|
|
||||||
// (3.1) Run = specified once
|
// (3.1) Run = specified once
|
||||||
TestCommon.execCommon("-Xlog:cds", o.cmdLine(), o.valueA(), "--version")
|
TestCommon.execCommon("-Xlog:aot", "-Xlog:cds", o.cmdLine(), o.valueA(), "--version")
|
||||||
.shouldMatch("Mismatched values for property " + o.property() + ": runtime.*dump time")
|
.shouldMatch("Mismatched values for property " + o.property() + ": runtime.*dump time")
|
||||||
.shouldContain(FMG_DISABLED);
|
.shouldContain(FMG_DISABLED);
|
||||||
|
|
||||||
// (3.2) Run = specified twice (same order)
|
// (3.2) Run = specified twice (same order)
|
||||||
// Should still be able to use FMG.
|
// Should still be able to use FMG.
|
||||||
TestCommon.execCommon("-Xlog:cds", o.cmdLine(), o.valueA(), o.cmdLine(), o.valueB(), "--version")
|
TestCommon.execCommon("-Xlog:aot", "-Xlog:cds", o.cmdLine(), o.valueA(), o.cmdLine(), o.valueB(), "--version")
|
||||||
.shouldContain(FMG_ENABLED);
|
.shouldContain(FMG_ENABLED);
|
||||||
|
|
||||||
// (3.3) Run = specified twice (but in different order)
|
// (3.3) Run = specified twice (but in different order)
|
||||||
// Should still be able to use FMG (values are sorted by CDS).
|
// Should still be able to use FMG (values are sorted by CDS).
|
||||||
TestCommon.execCommon("-Xlog:cds", o.cmdLine(), o.valueB(), o.cmdLine(), o.valueA(), "--version")
|
TestCommon.execCommon("-Xlog:aot", "-Xlog:cds", o.cmdLine(), o.valueB(), o.cmdLine(), o.valueA(), "--version")
|
||||||
.shouldContain(FMG_ENABLED);
|
.shouldContain(FMG_ENABLED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -45,7 +45,7 @@ public class AddmodsOption {
|
|||||||
final String multiModules = ",,jdk.jconsole,jdk.compiler,,";
|
final String multiModules = ",,jdk.jconsole,jdk.compiler,,";
|
||||||
final String allSystem = "ALL-SYSTEM";
|
final String allSystem = "ALL-SYSTEM";
|
||||||
final String allModulePath = "ALL-MODULE-PATH";
|
final String allModulePath = "ALL-MODULE-PATH";
|
||||||
final String loggingOption = "-Xlog:cds=debug,cds+module=debug,cds+heap=info,module=trace";
|
final String loggingOption = "-Xlog:aot=debug,cds+module=debug,aot+heap=info,cds=debug,module=trace";
|
||||||
final String versionPattern = "java.[0-9][0-9].*";
|
final String versionPattern = "java.[0-9][0-9].*";
|
||||||
final String subgraphCannotBeUsed = "subgraph jdk.internal.module.ArchivedBootLayer cannot be used because full module graph is disabled";
|
final String subgraphCannotBeUsed = "subgraph jdk.internal.module.ArchivedBootLayer cannot be used because full module graph is disabled";
|
||||||
final String warningIncubator = "WARNING: Using incubator modules: jdk.incubator.vector";
|
final String warningIncubator = "WARNING: Using incubator modules: jdk.incubator.vector";
|
||||||
|
|||||||
@ -41,7 +41,7 @@ public class AddopensOption {
|
|||||||
final String moduleOption = "jdk.httpserver/sun.net.httpserver.simpleserver.Main";
|
final String moduleOption = "jdk.httpserver/sun.net.httpserver.simpleserver.Main";
|
||||||
final String addOpensNio = "java.base/java.nio=ALL-UNNAMED";
|
final String addOpensNio = "java.base/java.nio=ALL-UNNAMED";
|
||||||
final String addOpensTimeFormat = "java.base/java.time.format=ALL-UNNAMED";
|
final String addOpensTimeFormat = "java.base/java.time.format=ALL-UNNAMED";
|
||||||
final String loggingOption = "-Xlog:cds=debug,cds+module=debug,cds+heap=info,module=trace";
|
final String loggingOption = "-Xlog:aot=debug,cds+module=debug,aot+heap=info,cds=debug,module=trace";
|
||||||
final String versionPattern = "java.[0-9][0-9].*";
|
final String versionPattern = "java.[0-9][0-9].*";
|
||||||
final String subgraphCannotBeUsed = "subgraph jdk.internal.module.ArchivedBootLayer cannot be used because full module graph is disabled";
|
final String subgraphCannotBeUsed = "subgraph jdk.internal.module.ArchivedBootLayer cannot be used because full module graph is disabled";
|
||||||
final String warningIncubator = "WARNING: Using incubator modules: jdk.incubator.vector";
|
final String warningIncubator = "WARNING: Using incubator modules: jdk.incubator.vector";
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -37,7 +37,7 @@ public class ModuleOption {
|
|||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
final String moduleOption = "jdk.httpserver/sun.net.httpserver.simpleserver.Main";
|
final String moduleOption = "jdk.httpserver/sun.net.httpserver.simpleserver.Main";
|
||||||
final String incubatorModule = "jdk.incubator.vector";
|
final String incubatorModule = "jdk.incubator.vector";
|
||||||
final String loggingOption = "-Xlog:cds=debug,cds+module=debug,cds+heap=info,module=trace";
|
final String loggingOption = "-Xlog:aot=debug,cds+module=debug,aot+heap=info,cds=debug,module=trace";
|
||||||
// Pattern of a module version string.
|
// Pattern of a module version string.
|
||||||
// e.g. JDK 22: "java 22"
|
// e.g. JDK 22: "java 22"
|
||||||
// JDK 22.0.1: "java 22.0.1"
|
// JDK 22.0.1: "java 22.0.1"
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -103,6 +103,7 @@ public class ClassFileLoadHookTest {
|
|||||||
"-XX:+UnlockDiagnosticVMOptions",
|
"-XX:+UnlockDiagnosticVMOptions",
|
||||||
"-XX:+WhiteBoxAPI", useWb,
|
"-XX:+WhiteBoxAPI", useWb,
|
||||||
"-agentlib:SimpleClassFileLoadHook=LoadMe,beforeHook,after_Hook",
|
"-agentlib:SimpleClassFileLoadHook=LoadMe,beforeHook,after_Hook",
|
||||||
|
"-Xlog:aot",
|
||||||
"-Xlog:cds",
|
"-Xlog:cds",
|
||||||
"ClassFileLoadHook",
|
"ClassFileLoadHook",
|
||||||
"" + ClassFileLoadHook.TestCaseId.SHARING_ON_CFLH_ON);
|
"" + ClassFileLoadHook.TestCaseId.SHARING_ON_CFLH_ON);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -166,6 +166,7 @@ public class ReplaceCriticalClasses {
|
|||||||
.setArchiveName(ReplaceCriticalClasses.class.getName() + ".jsa")
|
.setArchiveName(ReplaceCriticalClasses.class.getName() + ".jsa")
|
||||||
.setUseVersion(false)
|
.setUseVersion(false)
|
||||||
.addSuffix("-showversion",
|
.addSuffix("-showversion",
|
||||||
|
"-Xlog:aot",
|
||||||
"-Xlog:cds",
|
"-Xlog:cds",
|
||||||
"-XX:+UnlockDiagnosticVMOptions",
|
"-XX:+UnlockDiagnosticVMOptions",
|
||||||
agent);
|
agent);
|
||||||
@ -173,7 +174,7 @@ public class ReplaceCriticalClasses {
|
|||||||
opts.addSuffix("-XX:+WhiteBoxAPI",
|
opts.addSuffix("-XX:+WhiteBoxAPI",
|
||||||
"-Xbootclasspath/a:" + ClassFileInstaller.getJarPath("whitebox.jar"));
|
"-Xbootclasspath/a:" + ClassFileInstaller.getJarPath("whitebox.jar"));
|
||||||
}
|
}
|
||||||
opts.addSuffix("-Xlog:cds,cds+heap");
|
opts.addSuffix("-Xlog:aot,aot+heap,cds");
|
||||||
opts.addSuffix("ReplaceCriticalClasses",
|
opts.addSuffix("ReplaceCriticalClasses",
|
||||||
"child",
|
"child",
|
||||||
shared,
|
shared,
|
||||||
|
|||||||
@ -242,6 +242,7 @@ abstract public class CDSAppTester {
|
|||||||
"-XX:AOTConfiguration=" + aotConfigurationFile,
|
"-XX:AOTConfiguration=" + aotConfigurationFile,
|
||||||
logToFile(aotConfigurationFileLog,
|
logToFile(aotConfigurationFileLog,
|
||||||
"class+load=debug",
|
"class+load=debug",
|
||||||
|
"aot=debug",
|
||||||
"cds=debug",
|
"cds=debug",
|
||||||
"cds+class=debug"));
|
"cds+class=debug"));
|
||||||
cmdLine = addCommonVMArgs(runMode, cmdLine);
|
cmdLine = addCommonVMArgs(runMode, cmdLine);
|
||||||
@ -264,15 +265,17 @@ abstract public class CDSAppTester {
|
|||||||
private OutputAnalyzer dumpStaticArchive() throws Exception {
|
private OutputAnalyzer dumpStaticArchive() throws Exception {
|
||||||
RunMode runMode = RunMode.DUMP_STATIC;
|
RunMode runMode = RunMode.DUMP_STATIC;
|
||||||
String[] cmdLine = StringArrayUtils.concat(vmArgs(runMode),
|
String[] cmdLine = StringArrayUtils.concat(vmArgs(runMode),
|
||||||
|
"-Xlog:aot",
|
||||||
|
"-Xlog:aot+heap=error",
|
||||||
"-Xlog:cds",
|
"-Xlog:cds",
|
||||||
"-Xlog:cds+heap=error",
|
|
||||||
"-Xshare:dump",
|
"-Xshare:dump",
|
||||||
"-XX:SharedArchiveFile=" + staticArchiveFile,
|
"-XX:SharedArchiveFile=" + staticArchiveFile,
|
||||||
"-XX:SharedClassListFile=" + classListFile,
|
"-XX:SharedClassListFile=" + classListFile,
|
||||||
logToFile(staticArchiveFileLog,
|
logToFile(staticArchiveFileLog,
|
||||||
|
"aot=debug",
|
||||||
"cds=debug",
|
"cds=debug",
|
||||||
"cds+class=debug",
|
"cds+class=debug",
|
||||||
"cds+heap=warning",
|
"aot+heap=warning",
|
||||||
"cds+resolve=debug"));
|
"cds+resolve=debug"));
|
||||||
cmdLine = addCommonVMArgs(runMode, cmdLine);
|
cmdLine = addCommonVMArgs(runMode, cmdLine);
|
||||||
cmdLine = StringArrayUtils.concat(cmdLine, appCommandLine(runMode));
|
cmdLine = StringArrayUtils.concat(cmdLine, appCommandLine(runMode));
|
||||||
@ -282,15 +285,17 @@ abstract public class CDSAppTester {
|
|||||||
private OutputAnalyzer createAOTCache() throws Exception {
|
private OutputAnalyzer createAOTCache() throws Exception {
|
||||||
RunMode runMode = RunMode.ASSEMBLY;
|
RunMode runMode = RunMode.ASSEMBLY;
|
||||||
String[] cmdLine = StringArrayUtils.concat(vmArgs(runMode),
|
String[] cmdLine = StringArrayUtils.concat(vmArgs(runMode),
|
||||||
|
"-Xlog:aot",
|
||||||
|
"-Xlog:aot+heap=error",
|
||||||
"-Xlog:cds",
|
"-Xlog:cds",
|
||||||
"-Xlog:cds+heap=error",
|
|
||||||
"-XX:AOTMode=create",
|
"-XX:AOTMode=create",
|
||||||
"-XX:AOTConfiguration=" + aotConfigurationFile,
|
"-XX:AOTConfiguration=" + aotConfigurationFile,
|
||||||
"-XX:AOTCache=" + aotCacheFile,
|
"-XX:AOTCache=" + aotCacheFile,
|
||||||
logToFile(aotCacheFileLog,
|
logToFile(aotCacheFileLog,
|
||||||
|
"aot=debug",
|
||||||
"cds=debug",
|
"cds=debug",
|
||||||
"cds+class=debug",
|
"cds+class=debug",
|
||||||
"cds+heap=warning",
|
"aot+heap=warning",
|
||||||
"cds+resolve=debug"));
|
"cds+resolve=debug"));
|
||||||
cmdLine = addCommonVMArgs(runMode, cmdLine);
|
cmdLine = addCommonVMArgs(runMode, cmdLine);
|
||||||
cmdLine = StringArrayUtils.concat(cmdLine, appCommandLine(runMode));
|
cmdLine = StringArrayUtils.concat(cmdLine, appCommandLine(runMode));
|
||||||
@ -331,9 +336,11 @@ abstract public class CDSAppTester {
|
|||||||
if (isDynamicWorkflow()) {
|
if (isDynamicWorkflow()) {
|
||||||
// "classic" dynamic archive
|
// "classic" dynamic archive
|
||||||
cmdLine = StringArrayUtils.concat(vmArgs(runMode),
|
cmdLine = StringArrayUtils.concat(vmArgs(runMode),
|
||||||
|
"-Xlog:aot",
|
||||||
"-Xlog:cds",
|
"-Xlog:cds",
|
||||||
"-XX:ArchiveClassesAtExit=" + dynamicArchiveFile,
|
"-XX:ArchiveClassesAtExit=" + dynamicArchiveFile,
|
||||||
logToFile(dynamicArchiveFileLog,
|
logToFile(dynamicArchiveFileLog,
|
||||||
|
"aot=debug",
|
||||||
"cds=debug",
|
"cds=debug",
|
||||||
"cds+class=debug",
|
"cds+class=debug",
|
||||||
"cds+resolve=debug",
|
"cds+resolve=debug",
|
||||||
@ -362,7 +369,7 @@ abstract public class CDSAppTester {
|
|||||||
String[] cmdLine = StringArrayUtils.concat(vmArgs(runMode),
|
String[] cmdLine = StringArrayUtils.concat(vmArgs(runMode),
|
||||||
"-XX:+UnlockDiagnosticVMOptions",
|
"-XX:+UnlockDiagnosticVMOptions",
|
||||||
"-XX:VerifyArchivedFields=2", // make sure archived heap objects are good.
|
"-XX:VerifyArchivedFields=2", // make sure archived heap objects are good.
|
||||||
logToFile(productionRunLog(), "cds"));
|
logToFile(productionRunLog(), "aot", "cds"));
|
||||||
cmdLine = addCommonVMArgs(runMode, cmdLine);
|
cmdLine = addCommonVMArgs(runMode, cmdLine);
|
||||||
|
|
||||||
if (isStaticWorkflow()) {
|
if (isStaticWorkflow()) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user