8231606: _method_ordering is not set during CDS dynamic dump time

Add the missing DynamicDumpSharedSpaces check in sort_methods(); replace the (DumpSharedSpaces || DynamicDumpSharedSpaces) with the Arguments::is_dumping_archive() function call.

Reviewed-by: iklam, coleenp, jiangli
This commit is contained in:
Calvin Cheung 2019-10-02 16:55:08 -07:00
parent 72c2079fd0
commit b08a8c5cc3
24 changed files with 73 additions and 54 deletions

View file

@ -462,7 +462,7 @@ bool ClassPathImageEntry::is_modules_image() const {
#if INCLUDE_CDS
void ClassLoader::exit_with_path_failure(const char* error, const char* message) {
assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "only called at dump time");
Arguments::assert_is_dumping_archive();
tty->print_cr("Hint: enable -Xlog:class+path=info to diagnose the failure");
vm_exit_during_initialization(error, message);
}
@ -532,7 +532,7 @@ void ClassLoader::setup_bootstrap_search_path() {
#if INCLUDE_CDS
void ClassLoader::setup_app_search_path(const char *class_path) {
assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "Sanity");
Arguments::assert_is_dumping_archive();
ResourceMark rm;
ClasspathStream cp_stream(class_path);
@ -546,7 +546,7 @@ void ClassLoader::setup_app_search_path(const char *class_path) {
void ClassLoader::add_to_module_path_entries(const char* path,
ClassPathEntry* entry) {
assert(entry != NULL, "ClassPathEntry should not be NULL");
assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "dump time only");
Arguments::assert_is_dumping_archive();
// The entry does not exist, add to the list
if (_module_path_entries == NULL) {
@ -560,7 +560,7 @@ void ClassLoader::add_to_module_path_entries(const char* path,
// Add a module path to the _module_path_entries list.
void ClassLoader::update_module_path_entry_list(const char *path, TRAPS) {
assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "dump time only");
Arguments::assert_is_dumping_archive();
struct stat st;
if (os::stat(path, &st) != 0) {
tty->print_cr("os::stat error %d (%s). CDS dump aborted (path was \"%s\").",
@ -656,7 +656,7 @@ void ClassLoader::setup_boot_search_path(const char *class_path) {
bool set_base_piece = true;
#if INCLUDE_CDS
if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
if (Arguments::is_dumping_archive()) {
if (!Arguments::has_jimage()) {
vm_exit_during_initialization("CDS is not supported in exploded JDK build", NULL);
}
@ -1360,7 +1360,7 @@ char* ClassLoader::skip_uri_protocol(char* source) {
// Record the shared classpath index and loader type for classes loaded
// by the builtin loaders at dump time.
void ClassLoader::record_result(InstanceKlass* ik, const ClassFileStream* stream, TRAPS) {
assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "sanity");
Arguments::assert_is_dumping_archive();
assert(stream != NULL, "sanity");
if (ik->is_unsafe_anonymous()) {
@ -1537,13 +1537,13 @@ void ClassLoader::initialize() {
#if INCLUDE_CDS
void ClassLoader::initialize_shared_path() {
if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
if (Arguments::is_dumping_archive()) {
ClassLoaderExt::setup_search_paths();
}
}
void ClassLoader::initialize_module_path(TRAPS) {
if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
if (Arguments::is_dumping_archive()) {
ClassLoaderExt::setup_module_paths(THREAD);
FileMapInfo::allocate_shared_path_table();
}