< prev index next >
src/hotspot/share/classfile/classLoader.cpp
Print this page
@@ -70,13 +70,10 @@
#include "services/management.hpp"
#include "services/threadService.hpp"
#include "utilities/events.hpp"
#include "utilities/hashtable.inline.hpp"
#include "utilities/macros.hpp"
-#if INCLUDE_CDS
-#include "classfile/sharedPathsMiscInfo.hpp"
-#endif
// Entry points in zip.dll for loading zip/jar file entries
typedef void * * (*ZipOpen_t)(const char *name, char **pmsg);
typedef void (*ZipClose_t)(jzfile *zip);
@@ -144,11 +141,10 @@
#if INCLUDE_CDS
ClassPathEntry* ClassLoader::_app_classpath_entries = NULL;
ClassPathEntry* ClassLoader::_last_app_classpath_entry = NULL;
ClassPathEntry* ClassLoader::_module_path_entries = NULL;
ClassPathEntry* ClassLoader::_last_module_path_entry = NULL;
-SharedPathsMiscInfo* ClassLoader::_shared_paths_misc_info = NULL;
#endif
// helper routines
bool string_starts_with(const char* str, const char* str_to_find) {
size_t str_len = strlen(str);
@@ -282,17 +278,16 @@
PackageEntryTable* pkgEntryTable = loader_data->packages();
TempNewSymbol pkg_symbol = SymbolTable::new_symbol(pkg_name);
return pkgEntryTable->lookup_only(pkg_symbol);
}
-ClassPathDirEntry::ClassPathDirEntry(const char* dir) : ClassPathEntry() {
- char* copy = NEW_C_HEAP_ARRAY(char, strlen(dir)+1, mtClass);
- strcpy(copy, dir);
- _dir = copy;
+const char* ClassPathEntry::copy_path(const char* path) {
+ char* copy = NEW_C_HEAP_ARRAY(char, strlen(path)+1, mtClass);
+ strcpy(copy, path);
+ return copy;
}
-
ClassFileStream* ClassPathDirEntry::open_stream(const char* name, TRAPS) {
// construct full path name
assert((_dir != NULL) && (name != NULL), "sanity");
size_t path_len = strlen(_dir) + strlen(name) + strlen(os::file_separator()) + 1;
char* path = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, path_len);
@@ -328,13 +323,11 @@
}
ClassPathZipEntry::ClassPathZipEntry(jzfile* zip, const char* zip_name,
bool is_boot_append, bool from_class_path_attr) : ClassPathEntry() {
_zip = zip;
- char *copy = NEW_C_HEAP_ARRAY(char, strlen(zip_name)+1, mtClass);
- strcpy(copy, zip_name);
- _zip_name = copy;
+ _zip_name = copy_path(zip_name);
_from_class_path_attr = from_class_path_attr;
}
ClassPathZipEntry::~ClassPathZipEntry() {
if (ZipClose != NULL) {
@@ -415,12 +408,11 @@
guarantee(jimage != NULL, "jimage file is null");
guarantee(name != NULL, "jimage file name is null");
assert(_singleton == NULL, "VM supports only one jimage");
DEBUG_ONLY(_singleton = this);
size_t len = strlen(name) + 1;
- _name = NEW_C_HEAP_ARRAY(const char, len, mtClass);
- strncpy((char *)_name, name, len);
+ _name = copy_path(name);
}
ClassPathImageEntry::~ClassPathImageEntry() {
assert(_singleton == this, "must be");
DEBUG_ONLY(_singleton = NULL);
@@ -569,34 +561,14 @@
// Don't print sys_class_path - this is the bootcp of this current VM process, not necessarily
// the same as the bootcp of the shared archive.
} else {
trace_class_path("bootstrap loader class path=", sys_class_path);
}
-#if INCLUDE_CDS
- if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
- _shared_paths_misc_info->add_boot_classpath(sys_class_path);
- }
-#endif
setup_boot_search_path(sys_class_path);
}
#if INCLUDE_CDS
-int ClassLoader::get_shared_paths_misc_info_size() {
- return _shared_paths_misc_info->get_used_bytes();
-}
-
-void* ClassLoader::get_shared_paths_misc_info() {
- return _shared_paths_misc_info->buffer();
-}
-
-bool ClassLoader::check_shared_paths_misc_info(void *buf, int size, bool is_static) {
- SharedPathsMiscInfo* checker = new SharedPathsMiscInfo((char*)buf, size);
- bool result = checker->check(is_static);
- delete checker;
- return result;
-}
-
void ClassLoader::setup_app_search_path(const char *class_path) {
assert(DumpSharedSpaces || DynamicDumpSharedSpaces, "Sanity");
ResourceMark rm;
ClasspathStream cp_stream(class_path);
@@ -975,15 +947,10 @@
} else {
add_to_app_classpath_entries(path, new_entry, check_for_duplicates);
}
return true;
} else {
-#if INCLUDE_CDS
- if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
- _shared_paths_misc_info->add_nonexist_path(path);
- }
-#endif
return false;
}
}
static void print_module_entry_table(const GrowableArray<ModuleClassPathList*>* const module_list) {
@@ -1599,24 +1566,18 @@
// lookup zip library entry points
load_zip_library();
// lookup jimage library entry points
load_jimage_library();
-#if INCLUDE_CDS
- // initialize search path
- if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
- _shared_paths_misc_info = new SharedPathsMiscInfo();
- }
-#endif
+
setup_bootstrap_search_path();
}
#if INCLUDE_CDS
void ClassLoader::initialize_shared_path() {
if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
ClassLoaderExt::setup_search_paths();
- _shared_paths_misc_info->write_jint(0); // see comments in SharedPathsMiscInfo::check()
}
}
void ClassLoader::initialize_module_path(TRAPS) {
if (DumpSharedSpaces || DynamicDumpSharedSpaces) {
< prev index next >