133 class ClassPathImageEntry: public ClassPathEntry {
134 private:
135 JImageFile* _jimage;
136 const char* _name;
137 public:
138 bool is_jrt();
139 bool is_jar_file() const { return false; }
140 bool is_open() const { return _jimage != NULL; }
141 const char* name() const { return _name == NULL ? "" : _name; }
142 JImageFile* jimage() const { return _jimage; }
143 ClassPathImageEntry(JImageFile* jimage, const char* name);
144 ~ClassPathImageEntry();
145 ClassFileStream* open_stream(const char* name, TRAPS);
146
147 // Debugging
148 NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
149 };
150
151 // ModuleClassPathList contains a linked list of ClassPathEntry's
152 // that have been specified for a specific module. Currently,
153 // the only way to specify a module/path pair is via the -Xpatch
154 // command line option.
155 class ModuleClassPathList : public CHeapObj<mtClass> {
156 private:
157 Symbol* _module_name;
158 // First and last entries of class path entries for a specific module
159 ClassPathEntry* _module_first_entry;
160 ClassPathEntry* _module_last_entry;
161 public:
162 Symbol* module_name() const { return _module_name; }
163 ClassPathEntry* module_first_entry() const { return _module_first_entry; }
164 ModuleClassPathList(Symbol* module_name);
165 ~ModuleClassPathList();
166 void add_to_list(ClassPathEntry* new_entry);
167 };
168
169 class SharedPathsMiscInfo;
170
171 class ClassLoader: AllStatic {
172 public:
173 enum ClassLoaderType {
196 static PerfCounter* _perf_app_classload_time;
197 static PerfCounter* _perf_app_classload_selftime;
198 static PerfCounter* _perf_app_classload_count;
199 static PerfCounter* _perf_define_appclasses;
200 static PerfCounter* _perf_define_appclass_time;
201 static PerfCounter* _perf_define_appclass_selftime;
202 static PerfCounter* _perf_app_classfile_bytes_read;
203 static PerfCounter* _perf_sys_classfile_bytes_read;
204
205 static PerfCounter* _sync_systemLoaderLockContentionRate;
206 static PerfCounter* _sync_nonSystemLoaderLockContentionRate;
207 static PerfCounter* _sync_JVMFindLoadedClassLockFreeCounter;
208 static PerfCounter* _sync_JVMDefineClassLockFreeCounter;
209 static PerfCounter* _sync_JNIDefineClassLockFreeCounter;
210
211 static PerfCounter* _unsafe_defineClassCallCounter;
212 static PerfCounter* _isUnsyncloadClass;
213 static PerfCounter* _load_instance_class_failCounter;
214
215 // The boot class path consists of 3 ordered pieces:
216 // 1. the module/path pairs specified to -Xpatch
217 // -Xpatch:<module>=<file>(<pathsep><file>)*
218 // 2. the base piece
219 // [exploded build | jimage]
220 // 3. boot loader append path
221 // [-Xbootclasspath/a]; [jvmti appended entries]
222 //
223 // The boot loader must obey this order when attempting
224 // to load a class.
225
226 // Contains the module/path pairs specified to -Xpatch
227 static GrowableArray<ModuleClassPathList*>* _xpatch_entries;
228
229 // Contains the ClassPathEntry instances that include
230 // both the base piece and the boot loader append path.
231 static ClassPathEntry* _first_entry;
232 // Last entry in linked list of ClassPathEntry instances
233 static ClassPathEntry* _last_entry;
234 static int _num_entries;
235
236 // Marks the start of:
237 // - the boot loader's append path
238 // [-Xbootclasspath/a]; [jvmti appended entries]
239 // within the linked list of ClassPathEntry instances.
240 static ClassPathEntry* _first_append_entry;
241
242 static const char* _shared_archive;
243
244 // True if the boot path has a "modules" jimage
245 static bool _has_jimage;
246
247 // Array of module names associated with the boot class loader
335 static PerfCounter* sync_JVMDefineClassLockFreeCounter() {
336 return _sync_JVMDefineClassLockFreeCounter;
337 }
338
339 // Record how many calls to jni_DefineClass w/o holding a lock
340 static PerfCounter* sync_JNIDefineClassLockFreeCounter() {
341 return _sync_JNIDefineClassLockFreeCounter;
342 }
343
344 // Record how many calls to Unsafe_DefineClass
345 static PerfCounter* unsafe_defineClassCallCounter() {
346 return _unsafe_defineClassCallCounter;
347 }
348
349 // Record how many times SystemDictionary::load_instance_class call
350 // fails with linkageError when Unsyncloadclass flag is set.
351 static PerfCounter* load_instance_class_failCounter() {
352 return _load_instance_class_failCounter;
353 }
354
355 // Set up the module/path pairs as specified to -Xpatch
356 static void setup_xpatch_entries();
357
358 // Sets _has_jimage to TRUE if "modules" jimage file exists
359 static void set_has_jimage();
360 static bool has_jimage() { return _has_jimage; }
361
362 // Create the ModuleEntry for java.base
363 static void create_javabase();
364
365 // Load individual .class file
366 static instanceKlassHandle load_class(Symbol* class_name, bool search_append_only, TRAPS);
367
368 // If the specified package has been loaded by the system, then returns
369 // the name of the directory or ZIP file that the package was loaded from.
370 // Returns null if the package was not loaded.
371 // Note: The specified name can either be the name of a class or package.
372 // If a package name is specified, then it must be "/"-separator and also
373 // end with a trailing "/".
374 static oop get_system_package(const char* name, TRAPS);
375
376 // Returns an array of Java strings representing all of the currently
|
133 class ClassPathImageEntry: public ClassPathEntry {
134 private:
135 JImageFile* _jimage;
136 const char* _name;
137 public:
138 bool is_jrt();
139 bool is_jar_file() const { return false; }
140 bool is_open() const { return _jimage != NULL; }
141 const char* name() const { return _name == NULL ? "" : _name; }
142 JImageFile* jimage() const { return _jimage; }
143 ClassPathImageEntry(JImageFile* jimage, const char* name);
144 ~ClassPathImageEntry();
145 ClassFileStream* open_stream(const char* name, TRAPS);
146
147 // Debugging
148 NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
149 };
150
151 // ModuleClassPathList contains a linked list of ClassPathEntry's
152 // that have been specified for a specific module. Currently,
153 // the only way to specify a module/path pair is via the --patch-module
154 // command line option.
155 class ModuleClassPathList : public CHeapObj<mtClass> {
156 private:
157 Symbol* _module_name;
158 // First and last entries of class path entries for a specific module
159 ClassPathEntry* _module_first_entry;
160 ClassPathEntry* _module_last_entry;
161 public:
162 Symbol* module_name() const { return _module_name; }
163 ClassPathEntry* module_first_entry() const { return _module_first_entry; }
164 ModuleClassPathList(Symbol* module_name);
165 ~ModuleClassPathList();
166 void add_to_list(ClassPathEntry* new_entry);
167 };
168
169 class SharedPathsMiscInfo;
170
171 class ClassLoader: AllStatic {
172 public:
173 enum ClassLoaderType {
196 static PerfCounter* _perf_app_classload_time;
197 static PerfCounter* _perf_app_classload_selftime;
198 static PerfCounter* _perf_app_classload_count;
199 static PerfCounter* _perf_define_appclasses;
200 static PerfCounter* _perf_define_appclass_time;
201 static PerfCounter* _perf_define_appclass_selftime;
202 static PerfCounter* _perf_app_classfile_bytes_read;
203 static PerfCounter* _perf_sys_classfile_bytes_read;
204
205 static PerfCounter* _sync_systemLoaderLockContentionRate;
206 static PerfCounter* _sync_nonSystemLoaderLockContentionRate;
207 static PerfCounter* _sync_JVMFindLoadedClassLockFreeCounter;
208 static PerfCounter* _sync_JVMDefineClassLockFreeCounter;
209 static PerfCounter* _sync_JNIDefineClassLockFreeCounter;
210
211 static PerfCounter* _unsafe_defineClassCallCounter;
212 static PerfCounter* _isUnsyncloadClass;
213 static PerfCounter* _load_instance_class_failCounter;
214
215 // The boot class path consists of 3 ordered pieces:
216 // 1. the module/path pairs specified to --patch-module
217 // --patch-module=<module>=<file>(<pathsep><file>)*
218 // 2. the base piece
219 // [exploded build | jimage]
220 // 3. boot loader append path
221 // [-Xbootclasspath/a]; [jvmti appended entries]
222 //
223 // The boot loader must obey this order when attempting
224 // to load a class.
225
226 // Contains the module/path pairs specified to --patch-module
227 static GrowableArray<ModuleClassPathList*>* _patch_mod_entries;
228
229 // Contains the ClassPathEntry instances that include
230 // both the base piece and the boot loader append path.
231 static ClassPathEntry* _first_entry;
232 // Last entry in linked list of ClassPathEntry instances
233 static ClassPathEntry* _last_entry;
234 static int _num_entries;
235
236 // Marks the start of:
237 // - the boot loader's append path
238 // [-Xbootclasspath/a]; [jvmti appended entries]
239 // within the linked list of ClassPathEntry instances.
240 static ClassPathEntry* _first_append_entry;
241
242 static const char* _shared_archive;
243
244 // True if the boot path has a "modules" jimage
245 static bool _has_jimage;
246
247 // Array of module names associated with the boot class loader
335 static PerfCounter* sync_JVMDefineClassLockFreeCounter() {
336 return _sync_JVMDefineClassLockFreeCounter;
337 }
338
339 // Record how many calls to jni_DefineClass w/o holding a lock
340 static PerfCounter* sync_JNIDefineClassLockFreeCounter() {
341 return _sync_JNIDefineClassLockFreeCounter;
342 }
343
344 // Record how many calls to Unsafe_DefineClass
345 static PerfCounter* unsafe_defineClassCallCounter() {
346 return _unsafe_defineClassCallCounter;
347 }
348
349 // Record how many times SystemDictionary::load_instance_class call
350 // fails with linkageError when Unsyncloadclass flag is set.
351 static PerfCounter* load_instance_class_failCounter() {
352 return _load_instance_class_failCounter;
353 }
354
355 // Set up the module/path pairs as specified to --patch-module.
356 static void setup_patch_mod_entries();
357
358 // Sets _has_jimage to TRUE if "modules" jimage file exists
359 static void set_has_jimage();
360 static bool has_jimage() { return _has_jimage; }
361
362 // Create the ModuleEntry for java.base
363 static void create_javabase();
364
365 // Load individual .class file
366 static instanceKlassHandle load_class(Symbol* class_name, bool search_append_only, TRAPS);
367
368 // If the specified package has been loaded by the system, then returns
369 // the name of the directory or ZIP file that the package was loaded from.
370 // Returns null if the package was not loaded.
371 // Note: The specified name can either be the name of a class or package.
372 // If a package name is specified, then it must be "/"-separator and also
373 // end with a trailing "/".
374 static oop get_system_package(const char* name, TRAPS);
375
376 // Returns an array of Java strings representing all of the currently
|