mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8194812: Extend class-data sharing to support the module path
8199360: Rework the support for the 'ignored' module options in CDS Reviewed-by: jiangli, lfoltan, iklam, mseledtsov
This commit is contained in:
parent
d187884156
commit
4ef7c919a2
55 changed files with 2009 additions and 349 deletions
|
@ -30,6 +30,7 @@
|
|||
#include "classfile/classLoaderExt.hpp"
|
||||
#include "classfile/classLoaderData.inline.hpp"
|
||||
#include "classfile/klassFactory.hpp"
|
||||
#include "classfile/modules.hpp"
|
||||
#include "classfile/sharedClassUtil.hpp"
|
||||
#include "classfile/sharedPathsMiscInfo.hpp"
|
||||
#include "classfile/systemDictionaryShared.hpp"
|
||||
|
@ -41,19 +42,21 @@
|
|||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/symbol.hpp"
|
||||
#include "runtime/arguments.hpp"
|
||||
#include "runtime/handles.inline.hpp"
|
||||
#include "runtime/java.hpp"
|
||||
#include "runtime/javaCalls.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
#include "services/threadService.hpp"
|
||||
#include "utilities/stringUtils.hpp"
|
||||
|
||||
jshort ClassLoaderExt::_app_paths_start_index = ClassLoaderExt::max_classpath_index;
|
||||
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_paths_start_index = ClassLoader::num_boot_classpath_entries();
|
||||
_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) {
|
||||
|
@ -68,6 +71,29 @@ void ClassLoaderExt::setup_app_search_path() {
|
|||
}
|
||||
}
|
||||
|
||||
void ClassLoaderExt::process_module_table(ModuleEntryTable* met, TRAPS) {
|
||||
ResourceMark rm;
|
||||
for (int i = 0; i < met->table_size(); i++) {
|
||||
for (ModuleEntry* m = met->bucket(i); m != NULL;) {
|
||||
char* path = m->location()->as_C_string();
|
||||
if (strncmp(path, "file:", 5) == 0 && ClassLoader::string_ends_with(path, ".jar")) {
|
||||
m->print();
|
||||
path = ClassLoader::skip_uri_protocol(path);
|
||||
ClassLoader::setup_module_search_path(path, THREAD);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
char* ClassLoaderExt::read_manifest(ClassPathEntry* entry, jint *manifest_size, bool clean_text, TRAPS) {
|
||||
const char* name = "META-INF/MANIFEST.MF";
|
||||
char* manifest;
|
||||
|
@ -195,6 +221,12 @@ void ClassLoaderExt::setup_search_paths() {
|
|||
}
|
||||
}
|
||||
|
||||
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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue