--- a/src/hotspot/share/classfile/classLoader.cpp Thu Jul 05 07:22:21 2018 -0700
+++ b/src/hotspot/share/classfile/classLoader.cpp Thu Jul 05 09:11:33 2018 -0700
@@ -298,8 +298,6 @@
char *copy = NEW_C_HEAP_ARRAY(char, strlen(zip_name)+1, mtClass);
strcpy(copy, zip_name);
_zip_name = copy;
- _is_boot_append = is_boot_append;
- _multi_versioned = _unknown;
}
ClassPathZipEntry::~ClassPathZipEntry() {
@@ -338,95 +336,11 @@
return buffer;
}
-#if INCLUDE_CDS
-u1* ClassPathZipEntry::open_versioned_entry(const char* name, jint* filesize, TRAPS) {
- u1* buffer = NULL;
- if (DumpSharedSpaces && !_is_boot_append) {
- // We presume default is multi-release enabled
- const char* multi_ver = Arguments::get_property("jdk.util.jar.enableMultiRelease");
- const char* verstr = Arguments::get_property("jdk.util.jar.version");
- bool is_multi_ver = (multi_ver == NULL ||
- strcmp(multi_ver, "true") == 0 ||
- strcmp(multi_ver, "force") == 0) &&
- is_multiple_versioned(THREAD);
- // command line version setting
- int version = 0;
- const int base_version = 8; // JDK8
- int cur_ver = JDK_Version::current().major_version();
- if (verstr != NULL) {
- version = atoi(verstr);
- if (version < base_version || version > cur_ver) {
- // If the specified version is lower than the base version, the base
- // entry will be used; if the version is higher than the current
- // jdk version, the highest versioned entry will be used.
- if (version < base_version) {
- is_multi_ver = false;
- }
- // print out warning, do not use assertion here since it will continue to look
- // for proper version.
- warning("JDK%d is not supported in multiple version jars", version);
- }
- }
-
- if (is_multi_ver) {
- int n;
- const char* version_entry = "META-INF/versions/";
- // 10 is the max length of a decimal 32-bit non-negative number
- // 2 includes the '/' and trailing zero
- size_t entry_name_len = strlen(version_entry) + 10 + strlen(name) + 2;
- char* entry_name = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, entry_name_len);
- if (version > 0) {
- n = jio_snprintf(entry_name, entry_name_len, "%s%d/%s", version_entry, version, name);
- entry_name[n] = '\0';
- buffer = open_entry((const char*)entry_name, filesize, false, CHECK_NULL);
- if (buffer == NULL) {
- warning("Could not find %s in %s, try to find highest version instead", entry_name, _zip_name);
- }
- }
- if (buffer == NULL) {
- for (int i = cur_ver; i >= base_version; i--) {
- n = jio_snprintf(entry_name, entry_name_len, "%s%d/%s", version_entry, i, name);
- entry_name[n] = '\0';
- buffer = open_entry((const char*)entry_name, filesize, false, CHECK_NULL);
- if (buffer != NULL) {
- break;
- }
- }
- }
- FREE_RESOURCE_ARRAY(char, entry_name, entry_name_len);
- }
- }
- return buffer;
-}
-
-bool ClassPathZipEntry::is_multiple_versioned(TRAPS) {
- assert(DumpSharedSpaces, "called only at dump time");
- if (_multi_versioned != _unknown) {
- return (_multi_versioned == _yes) ? true : false;
- }
- jint size;
- char* buffer = (char*)open_entry("META-INF/MANIFEST.MF", &size, true, CHECK_false);
- if (buffer != NULL) {
- char* p = buffer;
- for ( ; *p; ++p) *p = tolower(*p);
- if (strstr(buffer, "multi-release: true") != NULL) {
- _multi_versioned = _yes;
- return true;
- }
- }
- _multi_versioned = _no;
- return false;
-}
-#endif // INCLUDE_CDS
-
ClassFileStream* ClassPathZipEntry::open_stream(const char* name, TRAPS) {
jint filesize;
- u1* buffer = open_versioned_entry(name, &filesize, CHECK_NULL);
+ u1* buffer = open_entry(name, &filesize, false, CHECK_NULL);
if (buffer == NULL) {
- buffer = open_entry(name, &filesize, false, CHECK_NULL);
- if (buffer == NULL) {
- return NULL;
- }
+ return NULL;
}
if (UsePerfData) {
ClassLoader::perf_sys_classfile_bytes_read()->inc(filesize);
--- a/src/hotspot/share/classfile/classLoader.hpp Thu Jul 05 07:22:21 2018 -0700
+++ b/src/hotspot/share/classfile/classLoader.hpp Thu Jul 05 09:11:33 2018 -0700
@@ -94,17 +94,9 @@
} jzentry;
class ClassPathZipEntry: public ClassPathEntry {
- enum {
- _unknown = 0,
- _yes = 1,
- _no = 2
- };
private:
jzfile* _zip; // The zip archive
const char* _zip_name; // Name of zip archive
- bool _is_boot_append; // entry coming from -Xbootclasspath/a
- u1 _multi_versioned; // indicates if the jar file has multi-versioned entries.
- // It can have value of "_unknown", "_yes", or "_no"
public:
bool is_modules_image() const { return false; }
bool is_jar_file() const { return true; }
@@ -113,10 +105,8 @@
ClassPathZipEntry(jzfile* zip, const char* zip_name, bool is_boot_append);
virtual ~ClassPathZipEntry();
u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS);
- u1* open_versioned_entry(const char* name, jint* filesize, TRAPS) NOT_CDS_RETURN_(NULL);
ClassFileStream* open_stream(const char* name, TRAPS);
void contents_do(void f(const char* name, void* context), void* context);
- bool is_multiple_versioned(TRAPS) NOT_CDS_RETURN_(false);
// Debugging
NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
};