221 // 2. the base piece
222 // Contains the ClassPathEntry of the modular java runtime image.
223 // If no java runtime image is present, this indicates a
224 // build with exploded modules is being used instead.
225 static ClassPathEntry* _jrt_entry;
226 static GrowableArray<ModuleClassPathList*>* _exploded_entries;
227 enum { EXPLODED_ENTRY_SIZE = 80 }; // Initial number of exploded modules
228
229 // 3. the boot loader's append path
230 // [-Xbootclasspath/a]; [jvmti appended entries]
231 // Note: boot loader append path does not support named modules.
232 static ClassPathEntry* _first_append_entry;
233 // Last entry in linked list of appended ClassPathEntry instances
234 static ClassPathEntry* _last_append_entry;
235
236 // Info used by CDS
237 CDS_ONLY(static SharedPathsMiscInfo * _shared_paths_misc_info;)
238
239 CDS_ONLY(static ClassPathEntry* _app_classpath_entries;)
240 CDS_ONLY(static ClassPathEntry* _last_app_classpath_entry;)
241 CDS_ONLY(static void setup_app_search_path(const char *class_path);)
242 static void add_to_app_classpath_entries(const char* path,
243 ClassPathEntry* entry,
244 bool check_for_duplicates);
245 public:
246 CDS_ONLY(static ClassPathEntry* app_classpath_entries() {return _app_classpath_entries;})
247
248 protected:
249 // Initialization:
250 // - setup the boot loader's system class path
251 // - setup the boot loader's patch mod entries, if present
252 // - create the ModuleEntry for java.base
253 static void setup_bootstrap_search_path();
254 static void setup_boot_search_path(const char *class_path);
255 static void setup_patch_mod_entries();
256 static void create_javabase();
257
258 static void load_zip_library();
259 static void load_jimage_library();
260 static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st,
261 bool throw_exception,
262 bool is_boot_append, TRAPS);
263
264 public:
265
266 // If the package for the fully qualified class name is in the boot
269 // for the package's location. And, so that the package will be added to
270 // the list of packages returned by get_system_packages().
271 // For packages whose classes are loaded from the boot loader class path, the
272 // classpath_index indicates which entry on the boot loader class path.
273 static bool add_package(const char *fullq_class_name, s2 classpath_index, TRAPS);
274
275 // Canonicalizes path names, so strcmp will work properly. This is mainly
276 // to avoid confusing the zip library
277 static bool get_canonical_path(const char* orig, char* out, int len);
278 static const char* file_name_for_class_name(const char* class_name,
279 int class_name_len);
280 static PackageEntry* get_package_entry(const char* class_name, ClassLoaderData* loader_data, TRAPS);
281
282 public:
283 static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg);
284 static int crc32(int crc, const char* buf, int len);
285 static bool update_class_path_entry_list(const char *path,
286 bool check_for_duplicates,
287 bool is_boot_append,
288 bool throw_exception=true);
289 static void print_bootclasspath();
290
291 // Timing
292 static PerfCounter* perf_accumulated_time() { return _perf_accumulated_time; }
293 static PerfCounter* perf_classes_inited() { return _perf_classes_inited; }
294 static PerfCounter* perf_class_init_time() { return _perf_class_init_time; }
295 static PerfCounter* perf_class_init_selftime() { return _perf_class_init_selftime; }
296 static PerfCounter* perf_classes_verified() { return _perf_classes_verified; }
297 static PerfCounter* perf_class_verify_time() { return _perf_class_verify_time; }
298 static PerfCounter* perf_class_verify_selftime() { return _perf_class_verify_selftime; }
299 static PerfCounter* perf_classes_linked() { return _perf_classes_linked; }
300 static PerfCounter* perf_class_link_time() { return _perf_class_link_time; }
301 static PerfCounter* perf_class_link_selftime() { return _perf_class_link_selftime; }
302 static PerfCounter* perf_class_parse_time() { return _perf_class_parse_time; }
303 static PerfCounter* perf_class_parse_selftime() { return _perf_class_parse_selftime; }
304 static PerfCounter* perf_sys_class_lookup_time() { return _perf_sys_class_lookup_time; }
305 static PerfCounter* perf_shared_classload_time() { return _perf_shared_classload_time; }
306 static PerfCounter* perf_sys_classload_time() { return _perf_sys_classload_time; }
307 static PerfCounter* perf_app_classload_time() { return _perf_app_classload_time; }
308 static PerfCounter* perf_app_classload_selftime() { return _perf_app_classload_selftime; }
365 static InstanceKlass* load_class(Symbol* class_name, bool search_append_only, TRAPS);
366
367 // If the specified package has been loaded by the system, then returns
368 // the name of the directory or ZIP file that the package was loaded from.
369 // Returns null if the package was not loaded.
370 // Note: The specified name can either be the name of a class or package.
371 // If a package name is specified, then it must be "/"-separator and also
372 // end with a trailing "/".
373 static oop get_system_package(const char* name, TRAPS);
374
375 // Returns an array of Java strings representing all of the currently
376 // loaded system packages.
377 // Note: The package names returned are "/"-separated and end with a
378 // trailing "/".
379 static objArrayOop get_system_packages(TRAPS);
380
381 // Initialization
382 static void initialize();
383 static void classLoader_init2(TRAPS);
384 CDS_ONLY(static void initialize_shared_path();)
385
386 static int compute_Object_vtable();
387
388 static ClassPathEntry* classpath_entry(int n);
389
390 static bool is_in_patch_mod_entries(Symbol* module_name);
391
392 #if INCLUDE_CDS
393 // Sharing dump and restore
394
395 // Helper function used by CDS code to get the number of boot classpath
396 // entries during shared classpath setup time.
397 static int num_boot_classpath_entries();
398
399 static ClassPathEntry* get_next_boot_classpath_entry(ClassPathEntry* e);
400
401 // Helper function used by CDS code to get the number of app classpath
402 // entries during shared classpath setup time.
403 static int num_app_classpath_entries();
404
405 static void check_shared_classpath(const char *path);
406 static void finalize_shared_paths_misc_info();
407 static int get_shared_paths_misc_info_size();
408 static void* get_shared_paths_misc_info();
409 static bool check_shared_paths_misc_info(void* info, int size);
410 static void exit_with_path_failure(const char* error, const char* message);
411
412 static void record_result(InstanceKlass* ik, const ClassFileStream* stream);
413 #endif
414 static JImageLocationRef jimage_find_resource(JImageFile* jf, const char* module_name,
415 const char* file_name, jlong &size);
416
417 static void trace_class_path(const char* msg, const char* name = NULL);
418
419 // VM monitoring and management support
420 static jlong classloader_time_ms();
421 static jlong class_method_total_size();
422 static jlong class_init_count();
423 static jlong class_init_time_ms();
424 static jlong class_verify_time_ms();
425 static jlong class_link_count();
426 static jlong class_link_time_ms();
427
428 // indicates if class path already contains a entry (exact match by name)
429 static bool contains_append_entry(const char* name);
430
431 // adds a class path to the boot append entries
|
221 // 2. the base piece
222 // Contains the ClassPathEntry of the modular java runtime image.
223 // If no java runtime image is present, this indicates a
224 // build with exploded modules is being used instead.
225 static ClassPathEntry* _jrt_entry;
226 static GrowableArray<ModuleClassPathList*>* _exploded_entries;
227 enum { EXPLODED_ENTRY_SIZE = 80 }; // Initial number of exploded modules
228
229 // 3. the boot loader's append path
230 // [-Xbootclasspath/a]; [jvmti appended entries]
231 // Note: boot loader append path does not support named modules.
232 static ClassPathEntry* _first_append_entry;
233 // Last entry in linked list of appended ClassPathEntry instances
234 static ClassPathEntry* _last_append_entry;
235
236 // Info used by CDS
237 CDS_ONLY(static SharedPathsMiscInfo * _shared_paths_misc_info;)
238
239 CDS_ONLY(static ClassPathEntry* _app_classpath_entries;)
240 CDS_ONLY(static ClassPathEntry* _last_app_classpath_entry;)
241 CDS_ONLY(static ClassPathEntry* _module_path_entries;)
242 CDS_ONLY(static ClassPathEntry* _last_module_path_entry;)
243 CDS_ONLY(static void setup_app_search_path(const char* class_path);)
244 CDS_ONLY(static void setup_module_search_path(const char* path);)
245 static void add_to_app_classpath_entries(const char* path,
246 ClassPathEntry* entry,
247 bool check_for_duplicates);
248 CDS_ONLY(static void add_to_module_path_entries(const char* path,
249 ClassPathEntry* entry);)
250 public:
251 CDS_ONLY(static ClassPathEntry* app_classpath_entries() {return _app_classpath_entries;})
252 CDS_ONLY(static ClassPathEntry* module_path_entries() {return _module_path_entries;})
253
254 protected:
255 // Initialization:
256 // - setup the boot loader's system class path
257 // - setup the boot loader's patch mod entries, if present
258 // - create the ModuleEntry for java.base
259 static void setup_bootstrap_search_path();
260 static void setup_boot_search_path(const char *class_path);
261 static void setup_patch_mod_entries();
262 static void create_javabase();
263
264 static void load_zip_library();
265 static void load_jimage_library();
266 static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st,
267 bool throw_exception,
268 bool is_boot_append, TRAPS);
269
270 public:
271
272 // If the package for the fully qualified class name is in the boot
275 // for the package's location. And, so that the package will be added to
276 // the list of packages returned by get_system_packages().
277 // For packages whose classes are loaded from the boot loader class path, the
278 // classpath_index indicates which entry on the boot loader class path.
279 static bool add_package(const char *fullq_class_name, s2 classpath_index, TRAPS);
280
281 // Canonicalizes path names, so strcmp will work properly. This is mainly
282 // to avoid confusing the zip library
283 static bool get_canonical_path(const char* orig, char* out, int len);
284 static const char* file_name_for_class_name(const char* class_name,
285 int class_name_len);
286 static PackageEntry* get_package_entry(const char* class_name, ClassLoaderData* loader_data, TRAPS);
287
288 public:
289 static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg);
290 static int crc32(int crc, const char* buf, int len);
291 static bool update_class_path_entry_list(const char *path,
292 bool check_for_duplicates,
293 bool is_boot_append,
294 bool throw_exception=true);
295 CDS_ONLY(static void update_module_path_entry_list(const char *path,
296 bool throw_exception=true);)
297 static void print_bootclasspath();
298
299 // Timing
300 static PerfCounter* perf_accumulated_time() { return _perf_accumulated_time; }
301 static PerfCounter* perf_classes_inited() { return _perf_classes_inited; }
302 static PerfCounter* perf_class_init_time() { return _perf_class_init_time; }
303 static PerfCounter* perf_class_init_selftime() { return _perf_class_init_selftime; }
304 static PerfCounter* perf_classes_verified() { return _perf_classes_verified; }
305 static PerfCounter* perf_class_verify_time() { return _perf_class_verify_time; }
306 static PerfCounter* perf_class_verify_selftime() { return _perf_class_verify_selftime; }
307 static PerfCounter* perf_classes_linked() { return _perf_classes_linked; }
308 static PerfCounter* perf_class_link_time() { return _perf_class_link_time; }
309 static PerfCounter* perf_class_link_selftime() { return _perf_class_link_selftime; }
310 static PerfCounter* perf_class_parse_time() { return _perf_class_parse_time; }
311 static PerfCounter* perf_class_parse_selftime() { return _perf_class_parse_selftime; }
312 static PerfCounter* perf_sys_class_lookup_time() { return _perf_sys_class_lookup_time; }
313 static PerfCounter* perf_shared_classload_time() { return _perf_shared_classload_time; }
314 static PerfCounter* perf_sys_classload_time() { return _perf_sys_classload_time; }
315 static PerfCounter* perf_app_classload_time() { return _perf_app_classload_time; }
316 static PerfCounter* perf_app_classload_selftime() { return _perf_app_classload_selftime; }
373 static InstanceKlass* load_class(Symbol* class_name, bool search_append_only, TRAPS);
374
375 // If the specified package has been loaded by the system, then returns
376 // the name of the directory or ZIP file that the package was loaded from.
377 // Returns null if the package was not loaded.
378 // Note: The specified name can either be the name of a class or package.
379 // If a package name is specified, then it must be "/"-separator and also
380 // end with a trailing "/".
381 static oop get_system_package(const char* name, TRAPS);
382
383 // Returns an array of Java strings representing all of the currently
384 // loaded system packages.
385 // Note: The package names returned are "/"-separated and end with a
386 // trailing "/".
387 static objArrayOop get_system_packages(TRAPS);
388
389 // Initialization
390 static void initialize();
391 static void classLoader_init2(TRAPS);
392 CDS_ONLY(static void initialize_shared_path();)
393 CDS_ONLY(static void initialize_module_path();)
394
395 static int compute_Object_vtable();
396
397 static ClassPathEntry* classpath_entry(int n);
398
399 static bool is_in_patch_mod_entries(Symbol* module_name);
400
401 #if INCLUDE_CDS
402 // Sharing dump and restore
403
404 // Helper function used by CDS code to get the number of boot classpath
405 // entries during shared classpath setup time.
406 static int num_boot_classpath_entries();
407
408 static ClassPathEntry* get_next_boot_classpath_entry(ClassPathEntry* e);
409
410 // Helper function used by CDS code to get the number of app classpath
411 // entries during shared classpath setup time.
412 static int num_app_classpath_entries();
413
414 // Helper function used by CDS code to get the number of module path
415 // entries during shared classpath setup time.
416 static int num_module_path_entries() {
417 assert(DumpSharedSpaces, "Should only be called at CDS dump time");
418 int num_entries = 0;
419 ClassPathEntry* e= ClassLoader::_module_path_entries;
420 while (e != NULL) {
421 num_entries ++;
422 e = e->next();
423 }
424 return num_entries;
425 }
426 static void check_shared_classpath(const char *path);
427 static void finalize_shared_paths_misc_info();
428 static int get_shared_paths_misc_info_size();
429 static void* get_shared_paths_misc_info();
430 static bool check_shared_paths_misc_info(void* info, int size);
431 static int get_module_paths_misc_info_size();
432 static void* get_module_paths_misc_info();
433 static void exit_with_path_failure(const char* error, const char* message);
434 static char* skip_uri_protocol(char* source);
435 static void record_result(InstanceKlass* ik, const ClassFileStream* stream);
436 #endif
437 static JImageLocationRef jimage_find_resource(JImageFile* jf, const char* module_name,
438 const char* file_name, jlong &size);
439
440 static void trace_class_path(const char* msg, const char* name = NULL);
441
442 // VM monitoring and management support
443 static jlong classloader_time_ms();
444 static jlong class_method_total_size();
445 static jlong class_init_count();
446 static jlong class_init_time_ms();
447 static jlong class_verify_time_ms();
448 static jlong class_link_count();
449 static jlong class_link_time_ms();
450
451 // indicates if class path already contains a entry (exact match by name)
452 static bool contains_append_entry(const char* name);
453
454 // adds a class path to the boot append entries
|