--- old/src/share/vm/classfile/classLoader.cpp 2015-02-12 09:40:24.825694000 -0500 +++ new/src/share/vm/classfile/classLoader.cpp 2015-02-12 09:40:23.627747000 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -152,40 +152,6 @@ } -MetaIndex::MetaIndex(char** meta_package_names, int num_meta_package_names) { - if (num_meta_package_names == 0) { - _meta_package_names = NULL; - _num_meta_package_names = 0; - } else { - _meta_package_names = NEW_C_HEAP_ARRAY(char*, num_meta_package_names, mtClass); - _num_meta_package_names = num_meta_package_names; - memcpy(_meta_package_names, meta_package_names, num_meta_package_names * sizeof(char*)); - } -} - - -MetaIndex::~MetaIndex() { - FREE_C_HEAP_ARRAY(char*, _meta_package_names); -} - - -bool MetaIndex::may_contain(const char* class_name) { - if ( _num_meta_package_names == 0) { - return false; - } - size_t class_name_len = strlen(class_name); - for (int i = 0; i < _num_meta_package_names; i++) { - char* pkg = _meta_package_names[i]; - size_t pkg_len = strlen(pkg); - size_t min_len = MIN2(class_name_len, pkg_len); - if (!strncmp(class_name, pkg, min_len)) { - return true; - } - } - return false; -} - - ClassPathEntry::ClassPathEntry() { set_next(NULL); } @@ -315,7 +281,6 @@ LazyClassPathEntry::LazyClassPathEntry(const char* path, const struct stat* st, bool throw_exception) : ClassPathEntry() { _path = os::strdup_check_oom(path); _st = *st; - _meta_index = NULL; _resolved_entry = NULL; _has_error = false; _throw_exception = throw_exception; @@ -354,10 +319,6 @@ } ClassFileStream* LazyClassPathEntry::open_stream(const char* name, TRAPS) { - if (_meta_index != NULL && - !_meta_index->may_contain(name)) { - return NULL; - } if (_has_error) { return NULL; } @@ -463,16 +424,6 @@ } #endif -static void print_meta_index(LazyClassPathEntry* entry, - GrowableArray& meta_packages) { - tty->print("[Meta index for %s=", entry->name()); - for (int i = 0; i < meta_packages.length(); i++) { - if (i > 0) tty->print(" "); - tty->print("%s", meta_packages.at(i)); - } - tty->print_cr("]"); -} - #if INCLUDE_CDS void ClassLoader::exit_with_path_failure(const char* error, const char* message) { assert(DumpSharedSpaces, "only called at dump time"); @@ -508,123 +459,6 @@ } } -void ClassLoader::setup_bootstrap_meta_index() { - // Set up meta index which allows us to open boot jars lazily if - // class data sharing is enabled - const char* meta_index_path = Arguments::get_meta_index_path(); - const char* meta_index_dir = Arguments::get_meta_index_dir(); - setup_meta_index(meta_index_path, meta_index_dir, 0); -} - -void ClassLoader::setup_meta_index(const char* meta_index_path, const char* meta_index_dir, int start_index) { - const char* known_version = "% VERSION 2"; - FILE* file = fopen(meta_index_path, "r"); - int line_no = 0; -#if INCLUDE_CDS - if (DumpSharedSpaces) { - if (file != NULL) { - _shared_paths_misc_info->add_required_file(meta_index_path); - } else { - _shared_paths_misc_info->add_nonexist_path(meta_index_path); - } - } -#endif - if (file != NULL) { - ResourceMark rm; - LazyClassPathEntry* cur_entry = NULL; - GrowableArray boot_class_path_packages(10); - char package_name[256]; - bool skipCurrentJar = false; - while (fgets(package_name, sizeof(package_name), file) != NULL) { - ++line_no; - // Remove trailing newline - package_name[strlen(package_name) - 1] = '\0'; - switch(package_name[0]) { - case '%': - { - if ((line_no == 1) && (strcmp(package_name, known_version) != 0)) { - if (TraceClassLoading && Verbose) { - tty->print("[Unsupported meta index version]"); - } - fclose(file); - return; - } - } - - // These directives indicate jar files which contain only - // classes, only non-classfile resources, or a combination of - // the two. See src/share/classes/sun/misc/MetaIndex.java and - // make/tools/MetaIndex/BuildMetaIndex.java in the J2SE - // workspace. - case '#': - case '!': - case '@': - { - // Hand off current packages to current lazy entry (if any) - if ((cur_entry != NULL) && - (boot_class_path_packages.length() > 0)) { - if ((TraceClassLoading || TraceClassPaths) && Verbose) { - print_meta_index(cur_entry, boot_class_path_packages); - } - MetaIndex* index = new MetaIndex(boot_class_path_packages.adr_at(0), - boot_class_path_packages.length()); - cur_entry->set_meta_index(index); - } - cur_entry = NULL; - boot_class_path_packages.clear(); - - // Find lazy entry corresponding to this jar file - int count = 0; - for (ClassPathEntry* entry = _first_entry; entry != NULL; entry = entry->next(), count++) { - if (count >= start_index && - entry->is_lazy() && - string_starts_with(entry->name(), meta_index_dir) && - string_ends_with(entry->name(), &package_name[2])) { - cur_entry = (LazyClassPathEntry*) entry; - break; - } - } - - // If the first character is '@', it indicates the following jar - // file is a resource only jar file in which case, we should skip - // reading the subsequent entries since the resource loading is - // totally handled by J2SE side. - if (package_name[0] == '@') { - if (cur_entry != NULL) { - cur_entry->set_meta_index(new MetaIndex(NULL, 0)); - } - cur_entry = NULL; - skipCurrentJar = true; - } else { - skipCurrentJar = false; - } - - break; - } - - default: - { - if (!skipCurrentJar && cur_entry != NULL) { - char* new_name = os::strdup_check_oom(package_name); - boot_class_path_packages.append(new_name); - } - } - } - } - // Hand off current packages to current lazy entry (if any) - if ((cur_entry != NULL) && - (boot_class_path_packages.length() > 0)) { - if ((TraceClassLoading || TraceClassPaths) && Verbose) { - print_meta_index(cur_entry, boot_class_path_packages); - } - MetaIndex* index = new MetaIndex(boot_class_path_packages.adr_at(0), - boot_class_path_packages.length()); - cur_entry->set_meta_index(index); - } - fclose(file); - } -} - #if INCLUDE_CDS void ClassLoader::check_shared_classpath(const char *path) { if (strcmp(path, "") == 0) { @@ -1315,10 +1149,6 @@ } #endif setup_bootstrap_search_path(); - if (LazyBootClassLoader) { - // set up meta index which makes boot classpath initialization lazier - setup_bootstrap_meta_index(); - } } #if INCLUDE_CDS --- old/src/share/vm/classfile/classLoader.hpp 2015-02-12 09:40:40.817696000 -0500 +++ new/src/share/vm/classfile/classLoader.hpp 2015-02-12 09:40:39.884951000 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2015, 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 @@ -33,18 +33,6 @@ #include -// Meta-index (optional, to be able to skip opening boot classpath jar files) -class MetaIndex: public CHeapObj { - private: - char** _meta_package_names; - int _num_meta_package_names; - public: - MetaIndex(char** meta_package_names, int num_meta_package_names); - ~MetaIndex(); - bool may_contain(const char* class_name); -}; - - // Class path entry (directory or zip file) class ClassPathEntry: public CHeapObj { @@ -122,7 +110,6 @@ private: const char* _path; // dir or file struct stat _st; - MetaIndex* _meta_index; bool _has_error; bool _throw_exception; volatile ClassPathEntry* _resolved_entry; @@ -135,7 +122,6 @@ u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS); ClassFileStream* open_stream(const char* name, TRAPS); - void set_meta_index(MetaIndex* meta_index) { _meta_index = meta_index; } virtual bool is_lazy(); // Debugging NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) @@ -231,9 +217,6 @@ static bool add_package(const char *pkgname, int classpath_index, TRAPS); // Initialization - static void setup_bootstrap_meta_index(); - static void setup_meta_index(const char* meta_index_path, const char* meta_index_dir, - int start_index); static void setup_bootstrap_search_path(); static void setup_search_path(const char *class_path); --- old/src/share/vm/runtime/arguments.cpp 2015-02-12 09:40:58.885366000 -0500 +++ new/src/share/vm/runtime/arguments.cpp 2015-02-12 09:40:57.392106000 -0500 @@ -109,8 +109,6 @@ SystemProperty *Arguments::_java_class_path = NULL; SystemProperty *Arguments::_sun_boot_class_path = NULL; -char* Arguments::_meta_index_path = NULL; -char* Arguments::_meta_index_dir = NULL; char* Arguments::_ext_dirs = NULL; // Check if head of 'option' matches 'name', and sets 'tail' to the remaining --- old/src/share/vm/runtime/arguments.hpp 2015-02-12 09:41:15.422558000 -0500 +++ new/src/share/vm/runtime/arguments.hpp 2015-02-12 09:41:14.303893000 -0500 @@ -260,10 +260,6 @@ static SystemProperty *_java_class_path; static SystemProperty *_sun_boot_class_path; - // Meta-index for knowing what packages are in the boot class path - static char* _meta_index_path; - static char* _meta_index_dir; - // temporary: to emit warning if the default ext dirs are not empty. // remove this variable when the warning is no longer needed. static char* _ext_dirs; @@ -600,16 +596,10 @@ static void set_ext_dirs(char *value) { _ext_dirs = os::strdup_check_oom(value); } static void set_sysclasspath(char *value) { _sun_boot_class_path->set_value(value); } static void append_sysclasspath(const char *value) { _sun_boot_class_path->append_value(value); } - static void set_meta_index_path(char* meta_index_path, char* meta_index_dir) { - _meta_index_path = meta_index_path; - _meta_index_dir = meta_index_dir; - } static char* get_java_home() { return _java_home->value(); } static char* get_dll_dir() { return _sun_boot_library_path->value(); } static char* get_sysclasspath() { return _sun_boot_class_path->value(); } - static char* get_meta_index_path() { return _meta_index_path; } - static char* get_meta_index_dir() { return _meta_index_dir; } static char* get_ext_dirs() { return _ext_dirs; } static char* get_appclasspath() { return _java_class_path->value(); } static void fix_appclasspath(); --- old/src/share/vm/runtime/os.cpp 2015-02-12 09:41:32.080553000 -0500 +++ new/src/share/vm/runtime/os.cpp 2015-02-12 09:41:30.808616000 -0500 @@ -1223,14 +1223,6 @@ const char* home = Arguments::get_java_home(); int home_len = (int)strlen(home); - static const char* meta_index_dir_format = "%/lib/"; - static const char* meta_index_format = "%/lib/meta-index"; - char* meta_index = format_boot_path(meta_index_format, home, home_len, fileSep, pathSep); - if (meta_index == NULL) return false; - char* meta_index_dir = format_boot_path(meta_index_dir_format, home, home_len, fileSep, pathSep); - if (meta_index_dir == NULL) return false; - Arguments::set_meta_index_path(meta_index, meta_index_dir); - char* sysclasspath = NULL; struct stat st; @@ -1244,39 +1236,18 @@ } FREE_C_HEAP_ARRAY(char, jimage); - // images build if rt.jar exists - char* rt_jar = format_boot_path("%/lib/rt.jar", home, home_len, fileSep, pathSep); - if (rt_jar == NULL) return false; - bool has_rt_jar = (os::stat(rt_jar, &st) == 0); - FREE_C_HEAP_ARRAY(char, rt_jar); - - if (has_rt_jar) { - // Any modification to the JAR-file list, for the boot classpath must be - // aligned with install/install/make/common/Pack.gmk. Note: boot class - // path class JARs, are stripped for StackMapTable to reduce download size. - static const char classpath_format[] = - "%/lib/resources.jar:" - "%/lib/rt.jar:" - "%/lib/jsse.jar:" - "%/lib/jce.jar:" - "%/lib/charsets.jar:" - "%/lib/jfr.jar:" - "%/classes"; - sysclasspath = format_boot_path(classpath_format, home, home_len, fileSep, pathSep); - } else { - // no rt.jar, check if developer build with exploded modules - char* modules_dir = format_boot_path("%/modules", home, home_len, fileSep, pathSep); - if (os::stat(modules_dir, &st) == 0) { - if ((st.st_mode & S_IFDIR) == S_IFDIR) { - sysclasspath = expand_entries_to_path(modules_dir, fileSep, pathSep); - } + // check if developer build with exploded modules + char* modules_dir = format_boot_path("%/modules", home, home_len, fileSep, pathSep); + if (os::stat(modules_dir, &st) == 0) { + if ((st.st_mode & S_IFDIR) == S_IFDIR) { + sysclasspath = expand_entries_to_path(modules_dir, fileSep, pathSep); } - - // fallback to classes - if (sysclasspath == NULL) - sysclasspath = format_boot_path("%/classes", home, home_len, fileSep, pathSep); } + // fallback to classes + if (sysclasspath == NULL) + sysclasspath = format_boot_path("%/classes", home, home_len, fileSep, pathSep); + if (sysclasspath == NULL) return false; Arguments::set_sysclasspath(sysclasspath);