< prev index next >
src/hotspot/share/classfile/classLoaderExt.cpp
Print this page
*** 52,63 ****
jshort ClassLoaderExt::_app_class_paths_start_index = ClassLoaderExt::max_classpath_index;
jshort ClassLoaderExt::_app_module_paths_start_index = ClassLoaderExt::max_classpath_index;
bool ClassLoaderExt::_has_app_classes = false;
bool ClassLoaderExt::_has_platform_classes = false;
void ClassLoaderExt::setup_app_search_path() {
! assert(DumpSharedSpaces, "this function is only used with -Xshare:dump and -XX:+UseAppCDS");
_app_class_paths_start_index = ClassLoader::num_boot_classpath_entries();
char* app_class_path = os::strdup(Arguments::get_appclasspath());
if (strcmp(app_class_path, ".") == 0) {
// This doesn't make any sense, even for AppCDS, so let's skip it. We
--- 52,72 ----
jshort ClassLoaderExt::_app_class_paths_start_index = ClassLoaderExt::max_classpath_index;
jshort ClassLoaderExt::_app_module_paths_start_index = ClassLoaderExt::max_classpath_index;
bool ClassLoaderExt::_has_app_classes = false;
bool ClassLoaderExt::_has_platform_classes = false;
+ void ClassLoaderExt::append_boot_classpath(ClassPathEntry* new_entry) {
+ #if INCLUDE_CDS
+ warning("Sharing is only supported for boot loader classes because bootstrap classpath has been appended");
+ FileMapHeaderExt* header = (FileMapHeaderExt*)FileMapInfo::current_info()->header();
+ header->set_has_platform_or_app_classes(false);
+ #endif
+ ClassLoader::add_to_boot_append_entries(new_entry);
+ }
+
void ClassLoaderExt::setup_app_search_path() {
! assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
_app_class_paths_start_index = ClassLoader::num_boot_classpath_entries();
char* app_class_path = os::strdup(Arguments::get_appclasspath());
if (strcmp(app_class_path, ".") == 0) {
// This doesn't make any sense, even for AppCDS, so let's skip it. We
*** 83,94 ****
}
m = m->next();
}
}
}
! void ClassLoaderExt::setup_module_search_path(TRAPS) {
! assert(DumpSharedSpaces, "this function is only used with -Xshare:dump and -XX:+UseAppCDS");
_app_module_paths_start_index = ClassLoader::num_boot_classpath_entries() +
ClassLoader::num_app_classpath_entries();
Handle system_class_loader (THREAD, SystemDictionary::java_system_loader());
ModuleEntryTable* met = Modules::get_module_entry_table(system_class_loader);
process_module_table(met, THREAD);
--- 92,103 ----
}
m = m->next();
}
}
}
! void ClassLoaderExt::setup_module_paths(TRAPS) {
! assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
_app_module_paths_start_index = ClassLoader::num_boot_classpath_entries() +
ClassLoader::num_app_classpath_entries();
Handle system_class_loader (THREAD, SystemDictionary::java_system_loader());
ModuleEntryTable* met = Modules::get_module_entry_table(system_class_loader);
process_module_table(met, THREAD);
*** 213,232 ****
}
}
}
void ClassLoaderExt::setup_search_paths() {
- if (UseAppCDS) {
shared_paths_misc_info()->record_app_offset();
ClassLoaderExt::setup_app_search_path();
- }
- }
-
- void ClassLoaderExt::setup_module_paths(TRAPS) {
- if (UseAppCDS) {
- ClassLoaderExt::setup_module_search_path(THREAD);
- }
}
Thread* ClassLoaderExt::Context::_dump_thread = NULL;
void ClassLoaderExt::record_result(ClassLoaderExt::Context *context,
--- 222,233 ----
*** 249,272 ****
result->set_shared_classpath_index(classpath_index);
result->set_class_loader_type(classloader_type);
}
void ClassLoaderExt::finalize_shared_paths_misc_info() {
- if (UseAppCDS) {
if (!_has_app_classes) {
shared_paths_misc_info()->pop_app();
}
- }
}
// Load the class of the given name from the location given by path. The path is specified by
// the "source:" in the class list file (see classListParser.cpp), and can be a directory or
// a JAR file.
InstanceKlass* ClassLoaderExt::load_class(Symbol* name, const char* path, TRAPS) {
assert(name != NULL, "invariant");
! assert(DumpSharedSpaces && UseAppCDS, "this function is only used with -Xshare:dump and -XX:+UseAppCDS");
ResourceMark rm(THREAD);
const char* class_name = name->as_C_string();
const char* file_name = file_name_for_class_name(class_name,
name->utf8_length());
--- 250,271 ----
result->set_shared_classpath_index(classpath_index);
result->set_class_loader_type(classloader_type);
}
void ClassLoaderExt::finalize_shared_paths_misc_info() {
if (!_has_app_classes) {
shared_paths_misc_info()->pop_app();
}
}
// Load the class of the given name from the location given by path. The path is specified by
// the "source:" in the class list file (see classListParser.cpp), and can be a directory or
// a JAR file.
InstanceKlass* ClassLoaderExt::load_class(Symbol* name, const char* path, TRAPS) {
assert(name != NULL, "invariant");
! assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
ResourceMark rm(THREAD);
const char* class_name = name->as_C_string();
const char* file_name = file_name_for_class_name(class_name,
name->utf8_length());
*** 320,330 ****
static GrowableArray<CachedClassPathEntry>* cached_path_entries = NULL;
ClassPathEntry* ClassLoaderExt::find_classpath_entry_from_cache(const char* path, TRAPS) {
// This is called from dump time so it's single threaded and there's no need for a lock.
! assert(DumpSharedSpaces && UseAppCDS, "this function is only used with -Xshare:dump and -XX:+UseAppCDS");
if (cached_path_entries == NULL) {
cached_path_entries = new (ResourceObj::C_HEAP, mtClass) GrowableArray<CachedClassPathEntry>(20, /*c heap*/ true);
}
CachedClassPathEntry ccpe;
for (int i=0; i<cached_path_entries->length(); i++) {
--- 319,329 ----
static GrowableArray<CachedClassPathEntry>* cached_path_entries = NULL;
ClassPathEntry* ClassLoaderExt::find_classpath_entry_from_cache(const char* path, TRAPS) {
// This is called from dump time so it's single threaded and there's no need for a lock.
! assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
if (cached_path_entries == NULL) {
cached_path_entries = new (ResourceObj::C_HEAP, mtClass) GrowableArray<CachedClassPathEntry>(20, /*c heap*/ true);
}
CachedClassPathEntry ccpe;
for (int i=0; i<cached_path_entries->length(); i++) {
< prev index next >