8242524: Use different default CDS archives depending on UseCompressOops
Reviewed-by: erikj, iklam, ccheung
This commit is contained in:
Родитель
71cc95e4b1
Коммит
8da07d1ae9
|
@ -117,8 +117,10 @@ JLINK_JRE_TARGETS := $(jlink_jre)
|
|||
ifeq ($(BUILD_CDS_ARCHIVE), true)
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
CDS_ARCHIVE := bin/server/classes.jsa
|
||||
CDS_NOCOOPS_ARCHIVE := bin/server/classes_nocoops.jsa
|
||||
else
|
||||
CDS_ARCHIVE := lib/server/classes.jsa
|
||||
CDS_NOCOOPS_ARCHIVE := lib/server/classes_nocoops.jsa
|
||||
endif
|
||||
|
||||
$(eval $(call SetupExecute, gen_cds_archive_jdk, \
|
||||
|
@ -127,6 +129,7 @@ ifeq ($(BUILD_CDS_ARCHIVE), true)
|
|||
OUTPUT_FILE := $(JDK_IMAGE_DIR)/$(CDS_ARCHIVE), \
|
||||
SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jdk, \
|
||||
COMMAND := $(FIXPATH) $(JDK_IMAGE_DIR)/bin/java -Xshare:dump \
|
||||
-XX:SharedArchiveFile=$(JDK_IMAGE_DIR)/$(CDS_ARCHIVE) \
|
||||
-Xmx128M -Xms128M $(LOG_INFO), \
|
||||
))
|
||||
|
||||
|
@ -138,10 +141,37 @@ ifeq ($(BUILD_CDS_ARCHIVE), true)
|
|||
OUTPUT_FILE := $(JRE_IMAGE_DIR)/$(CDS_ARCHIVE), \
|
||||
SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jre, \
|
||||
COMMAND := $(FIXPATH) $(JRE_IMAGE_DIR)/bin/java -Xshare:dump \
|
||||
-XX:SharedArchiveFile=$(JRE_IMAGE_DIR)/$(CDS_ARCHIVE) \
|
||||
-Xmx128M -Xms128M $(LOG_INFO), \
|
||||
))
|
||||
|
||||
JRE_TARGETS += $(gen_cds_archive_jre)
|
||||
|
||||
$(eval $(call SetupExecute, gen_cds_nocoops_archive_jdk, \
|
||||
WARN := Creating CDS-NOCOOPS archive for jdk image, \
|
||||
DEPS := $(jlink_jdk), \
|
||||
OUTPUT_FILE := $(JDK_IMAGE_DIR)/$(CDS_NOCOOPS_ARCHIVE), \
|
||||
SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jdk, \
|
||||
COMMAND := $(FIXPATH) $(JDK_IMAGE_DIR)/bin/java -Xshare:dump \
|
||||
-XX:SharedArchiveFile=$(JDK_IMAGE_DIR)/$(CDS_NOCOOPS_ARCHIVE) \
|
||||
-XX:-UseCompressedOops \
|
||||
-Xmx128M -Xms128M $(LOG_INFO), \
|
||||
))
|
||||
|
||||
JDK_TARGETS += $(gen_cds_nocoops_archive_jdk)
|
||||
|
||||
$(eval $(call SetupExecute, gen_cds_nocoops_archive_jre, \
|
||||
WARN := Creating CDS-NOCOOPS archive for jre image, \
|
||||
DEPS := $(jlink_jre), \
|
||||
OUTPUT_FILE := $(JRE_IMAGE_DIR)/$(CDS_NOCOOPS_ARCHIVE), \
|
||||
SUPPORT_DIR := $(SUPPORT_OUTPUTDIR)/images/jre, \
|
||||
COMMAND := $(FIXPATH) $(JRE_IMAGE_DIR)/bin/java -Xshare:dump \
|
||||
-XX:SharedArchiveFile=$(JRE_IMAGE_DIR)/$(CDS_NOCOOPS_ARCHIVE) \
|
||||
-XX:-UseCompressedOops \
|
||||
-Xmx128M -Xms128M $(LOG_INFO), \
|
||||
))
|
||||
|
||||
JRE_TARGETS += $(gen_cds_nocoops_archive_jre)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
|
|
@ -343,7 +343,7 @@ compare_general_files() {
|
|||
! -name "*.cpl" ! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
|
||||
! -name "*.lib" ! -name "*.jmod" ! -name "*.exe" \
|
||||
! -name "*.obj" ! -name "*.o" ! -name "jspawnhelper" ! -name "*.a" \
|
||||
! -name "*.tar.gz" ! -name "classes.jsa" ! -name "gtestLauncher" \
|
||||
! -name "*.tar.gz" ! -name "*.jsa" ! -name "gtestLauncher" \
|
||||
! -name "*.map" \
|
||||
| $GREP -v "./bin/" | $SORT | $FILTER)
|
||||
|
||||
|
|
|
@ -1069,6 +1069,7 @@ bool FileMapInfo::open_for_read() {
|
|||
} else {
|
||||
_full_path = Arguments::GetSharedDynamicArchivePath();
|
||||
}
|
||||
log_info(cds)("trying to map %s", _full_path);
|
||||
int fd = os::open(_full_path, O_RDONLY | O_BINARY, 0);
|
||||
if (fd < 0) {
|
||||
if (errno == ENOENT) {
|
||||
|
|
|
@ -3519,13 +3519,21 @@ jint Arguments::parse_options_buffer(const char* name, char* buffer, const size_
|
|||
return status;
|
||||
}
|
||||
|
||||
void Arguments::set_shared_spaces_flags() {
|
||||
jint Arguments::set_shared_spaces_flags_and_archive_paths() {
|
||||
if (DumpSharedSpaces) {
|
||||
if (RequireSharedSpaces) {
|
||||
warning("Cannot dump shared archive while using shared archive");
|
||||
}
|
||||
UseSharedSpaces = false;
|
||||
}
|
||||
#if INCLUDE_CDS
|
||||
// Initialize shared archive paths which could include both base and dynamic archive paths
|
||||
// This must be after set_ergonomics_flags() called so flag UseCompressedOops is set properly.
|
||||
if (!init_shared_archive_paths()) {
|
||||
return JNI_ENOMEM;
|
||||
}
|
||||
#endif // INCLUDE_CDS
|
||||
return JNI_OK;
|
||||
}
|
||||
|
||||
#if INCLUDE_CDS
|
||||
|
@ -3541,7 +3549,8 @@ char* Arguments::get_default_shared_archive_path() {
|
|||
size_t file_sep_len = strlen(os::file_separator());
|
||||
const size_t len = jvm_path_len + file_sep_len + 20;
|
||||
default_archive_path = NEW_C_HEAP_ARRAY(char, len, mtArguments);
|
||||
jio_snprintf(default_archive_path, len, "%s%sclasses.jsa",
|
||||
jio_snprintf(default_archive_path, len,
|
||||
UseCompressedOops ? "%s%sclasses.jsa": "%s%sclasses_nocoops.jsa",
|
||||
jvm_path, os::file_separator());
|
||||
return default_archive_path;
|
||||
}
|
||||
|
@ -3986,13 +3995,6 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
|
|||
return result;
|
||||
}
|
||||
|
||||
#if INCLUDE_CDS
|
||||
// Initialize shared archive paths which could include both base and dynamic archive paths
|
||||
if (!init_shared_archive_paths()) {
|
||||
return JNI_ENOMEM;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Delay warning until here so that we've had a chance to process
|
||||
// the -XX:-PrintWarnings flag
|
||||
if (needs_hotspotrc_warning) {
|
||||
|
@ -4080,7 +4082,8 @@ jint Arguments::apply_ergo() {
|
|||
|
||||
GCConfig::arguments()->initialize();
|
||||
|
||||
set_shared_spaces_flags();
|
||||
result = set_shared_spaces_flags_and_archive_paths();
|
||||
if (result != JNI_OK) return result;
|
||||
|
||||
// Initialize Metaspace flags and alignments
|
||||
Metaspace::ergo_initialize();
|
||||
|
|
|
@ -370,7 +370,7 @@ class Arguments : AllStatic {
|
|||
static void set_use_compressed_oops();
|
||||
static void set_use_compressed_klass_ptrs();
|
||||
static jint set_ergonomics_flags();
|
||||
static void set_shared_spaces_flags();
|
||||
static jint set_shared_spaces_flags_and_archive_paths();
|
||||
// limits the given memory size by the maximum amount of memory this process is
|
||||
// currently allowed to allocate or reserve.
|
||||
static julong limit_by_allocatable_memory(julong size);
|
||||
|
|
Загрузка…
Ссылка в новой задаче