32 class ClassListParser; 33 34 class ClassLoaderExt: public ClassLoader { // AllStatic 35 public: 36 enum SomeConstants { 37 max_classpath_index = 0x7fff 38 }; 39 40 private: 41 #if INCLUDE_CDS 42 static char* get_class_path_attr(const char* jar_path, char* manifest, jint manifest_size); 43 static void setup_app_search_path(); // Only when -Xshare:dump 44 static void process_module_table(ModuleEntryTable* met, TRAPS); 45 static SharedPathsMiscInfo* shared_paths_misc_info() { 46 return (SharedPathsMiscInfo*)_shared_paths_misc_info; 47 } 48 // index of first app JAR in shared classpath entry table 49 static jshort _app_class_paths_start_index; 50 // index of first modular JAR in shared modulepath entry table 51 static jshort _app_module_paths_start_index; 52 53 static bool _has_app_classes; 54 static bool _has_platform_classes; 55 #endif 56 57 public: 58 CDS_ONLY(static void process_jar_manifest(ClassPathEntry* entry, bool check_for_duplicates);) 59 60 static bool should_verify(int classpath_index) { 61 CDS_ONLY(return (classpath_index >= _app_class_paths_start_index);) 62 NOT_CDS(return false;) 63 } 64 // Called by JVMTI code to add boot classpath 65 static void append_boot_classpath(ClassPathEntry* new_entry); 66 67 static void setup_search_paths() NOT_CDS_RETURN; 68 static void setup_module_paths(TRAPS) NOT_CDS_RETURN; 69 70 #if INCLUDE_CDS 71 private: 73 static ClassPathEntry* find_classpath_entry_from_cache(const char* path, TRAPS); 74 75 public: 76 static char* read_manifest(ClassPathEntry* entry, jint *manifest_size, TRAPS) { 77 // Remove all the new-line continuations (which wrap long lines at 72 characters, see 78 // http://docs.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#JAR%20Manifest), so 79 // that the manifest is easier to parse. 80 return read_manifest(entry, manifest_size, true, THREAD); 81 } 82 static char* read_raw_manifest(ClassPathEntry* entry, jint *manifest_size, TRAPS) { 83 // Do not remove new-line continuations, so we can easily pass it as an argument to 84 // java.util.jar.Manifest.getManifest() at run-time. 85 return read_manifest(entry, manifest_size, false, THREAD); 86 } 87 88 static void finalize_shared_paths_misc_info(); 89 90 static jshort app_class_paths_start_index() { return _app_class_paths_start_index; } 91 92 static jshort app_module_paths_start_index() { return _app_module_paths_start_index; } 93 94 static void init_paths_start_index(jshort app_start) { 95 _app_class_paths_start_index = app_start; 96 } 97 98 static void init_app_module_paths_start_index(jshort module_start) { 99 _app_module_paths_start_index = module_start; 100 } 101 102 static bool is_boot_classpath(int classpath_index) { 103 return classpath_index < _app_class_paths_start_index; 104 } 105 106 static bool has_platform_or_app_classes() { 107 return _has_app_classes || _has_platform_classes; 108 } 109 110 static void record_result(const s2 classpath_index, 111 InstanceKlass* result, TRAPS); 112 static InstanceKlass* load_class(Symbol* h_name, const char* path, TRAPS); | 32 class ClassListParser; 33 34 class ClassLoaderExt: public ClassLoader { // AllStatic 35 public: 36 enum SomeConstants { 37 max_classpath_index = 0x7fff 38 }; 39 40 private: 41 #if INCLUDE_CDS 42 static char* get_class_path_attr(const char* jar_path, char* manifest, jint manifest_size); 43 static void setup_app_search_path(); // Only when -Xshare:dump 44 static void process_module_table(ModuleEntryTable* met, TRAPS); 45 static SharedPathsMiscInfo* shared_paths_misc_info() { 46 return (SharedPathsMiscInfo*)_shared_paths_misc_info; 47 } 48 // index of first app JAR in shared classpath entry table 49 static jshort _app_class_paths_start_index; 50 // index of first modular JAR in shared modulepath entry table 51 static jshort _app_module_paths_start_index; 52 // the largest path index being used during CDS dump time 53 static jshort _max_used_path_index; 54 55 static bool _has_app_classes; 56 static bool _has_platform_classes; 57 #endif 58 59 public: 60 CDS_ONLY(static void process_jar_manifest(ClassPathEntry* entry, bool check_for_duplicates);) 61 62 static bool should_verify(int classpath_index) { 63 CDS_ONLY(return (classpath_index >= _app_class_paths_start_index);) 64 NOT_CDS(return false;) 65 } 66 // Called by JVMTI code to add boot classpath 67 static void append_boot_classpath(ClassPathEntry* new_entry); 68 69 static void setup_search_paths() NOT_CDS_RETURN; 70 static void setup_module_paths(TRAPS) NOT_CDS_RETURN; 71 72 #if INCLUDE_CDS 73 private: 75 static ClassPathEntry* find_classpath_entry_from_cache(const char* path, TRAPS); 76 77 public: 78 static char* read_manifest(ClassPathEntry* entry, jint *manifest_size, TRAPS) { 79 // Remove all the new-line continuations (which wrap long lines at 72 characters, see 80 // http://docs.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#JAR%20Manifest), so 81 // that the manifest is easier to parse. 82 return read_manifest(entry, manifest_size, true, THREAD); 83 } 84 static char* read_raw_manifest(ClassPathEntry* entry, jint *manifest_size, TRAPS) { 85 // Do not remove new-line continuations, so we can easily pass it as an argument to 86 // java.util.jar.Manifest.getManifest() at run-time. 87 return read_manifest(entry, manifest_size, false, THREAD); 88 } 89 90 static void finalize_shared_paths_misc_info(); 91 92 static jshort app_class_paths_start_index() { return _app_class_paths_start_index; } 93 94 static jshort app_module_paths_start_index() { return _app_module_paths_start_index; } 95 96 static jshort max_used_path_index() { return _max_used_path_index; } 97 98 static void set_max_used_path_index(jshort used_index) { 99 _max_used_path_index = used_index; 100 } 101 102 static void init_paths_start_index(jshort app_start) { 103 _app_class_paths_start_index = app_start; 104 } 105 106 static void init_app_module_paths_start_index(jshort module_start) { 107 _app_module_paths_start_index = module_start; 108 } 109 110 static bool is_boot_classpath(int classpath_index) { 111 return classpath_index < _app_class_paths_start_index; 112 } 113 114 static bool has_platform_or_app_classes() { 115 return _has_app_classes || _has_platform_classes; 116 } 117 118 static void record_result(const s2 classpath_index, 119 InstanceKlass* result, TRAPS); 120 static InstanceKlass* load_class(Symbol* h_name, const char* path, TRAPS); |