243 // Initialization:
244 // - setup the boot loader's system class path
245 // - setup the boot loader's patch mod entries, if present
246 // - create the ModuleEntry for java.base
247 static void setup_bootstrap_search_path();
248 static void setup_boot_search_path(const char *class_path);
249 static void setup_patch_mod_entries();
250 static void create_javabase();
251
252 static void* dll_lookup(void* lib, const char* name, const char* path);
253 static void load_java_library();
254 static void load_zip_library();
255 static void load_jimage_library();
256
257 public:
258 static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st,
259 bool throw_exception,
260 bool is_boot_append,
261 bool from_class_path_attr, TRAPS);
262
263 // If the package for the fully qualified class name is in the boot
264 // loader's package entry table then add_package() sets the classpath_index
265 // field so that get_system_package() will know to return a non-null value
266 // for the package's location. And, so that the package will be added to
267 // the list of packages returned by get_system_packages().
268 // For packages whose classes are loaded from the boot loader class path, the
269 // classpath_index indicates which entry on the boot loader class path.
270 static bool add_package(const char *fullq_class_name, s2 classpath_index, TRAPS);
271
272 // Canonicalizes path names, so strcmp will work properly. This is mainly
273 // to avoid confusing the zip library
274 static bool get_canonical_path(const char* orig, char* out, int len);
275 static const char* file_name_for_class_name(const char* class_name,
276 int class_name_len);
277 static PackageEntry* get_package_entry(const char* class_name, ClassLoaderData* loader_data, TRAPS);
278
279 public:
280 static int crc32(int crc, const char* buf, int len);
281 static bool update_class_path_entry_list(const char *path,
282 bool check_for_duplicates,
283 bool is_boot_append,
284 bool from_class_path_attr,
285 bool throw_exception=true);
286 CDS_ONLY(static void update_module_path_entry_list(const char *path, TRAPS);)
287 static void print_bootclasspath();
288
289 // Timing
290 static PerfCounter* perf_accumulated_time() { return _perf_accumulated_time; }
291 static PerfCounter* perf_classes_inited() { return _perf_classes_inited; }
292 static PerfCounter* perf_class_init_time() { return _perf_class_init_time; }
293 static PerfCounter* perf_class_init_selftime() { return _perf_class_init_selftime; }
294 static PerfCounter* perf_classes_verified() { return _perf_classes_verified; }
295 static PerfCounter* perf_class_verify_time() { return _perf_class_verify_time; }
296 static PerfCounter* perf_class_verify_selftime() { return _perf_class_verify_selftime; }
297 static PerfCounter* perf_classes_linked() { return _perf_classes_linked; }
422
423 // VM monitoring and management support
424 static jlong classloader_time_ms();
425 static jlong class_method_total_size();
426 static jlong class_init_count();
427 static jlong class_init_time_ms();
428 static jlong class_verify_time_ms();
429 static jlong class_link_count();
430 static jlong class_link_time_ms();
431
432 // indicates if class path already contains a entry (exact match by name)
433 static bool contains_append_entry(const char* name);
434
435 // adds a class path to the boot append entries
436 static void add_to_boot_append_entries(ClassPathEntry* new_entry);
437
438 // creates a class path zip entry (returns NULL if JAR file cannot be opened)
439 static ClassPathZipEntry* create_class_path_zip_entry(const char *apath, bool is_boot_append);
440
441 static bool string_ends_with(const char* str, const char* str_to_find);
442
443 // obtain package name from a fully qualified class name
444 // *bad_class_name is set to true if there's a problem with parsing class_name, to
445 // distinguish from a class_name with no package name, as both cases have a NULL return value
446 static const char* package_from_name(const char* const class_name, bool* bad_class_name = NULL);
447
448 // Debugging
449 static void verify() PRODUCT_RETURN;
450 };
451
452 // PerfClassTraceTime is used to measure time for class loading related events.
453 // This class tracks cumulative time and exclusive time for specific event types.
454 // During the execution of one event, other event types (e.g. class loading and
455 // resolution) as well as recursive calls of the same event type could happen.
456 // Only one elapsed timer (cumulative) and one thread-local self timer (exclusive)
457 // (i.e. only one event type) are active at a time even multiple PerfClassTraceTime
458 // instances have been created as multiple events are happening.
459 class PerfClassTraceTime {
460 public:
461 enum {
462 CLASS_LOAD = 0,
463 PARSE_CLASS = 1,
464 CLASS_LINK = 2,
465 CLASS_VERIFY = 3,
466 CLASS_CLINIT = 4,
|
243 // Initialization:
244 // - setup the boot loader's system class path
245 // - setup the boot loader's patch mod entries, if present
246 // - create the ModuleEntry for java.base
247 static void setup_bootstrap_search_path();
248 static void setup_boot_search_path(const char *class_path);
249 static void setup_patch_mod_entries();
250 static void create_javabase();
251
252 static void* dll_lookup(void* lib, const char* name, const char* path);
253 static void load_java_library();
254 static void load_zip_library();
255 static void load_jimage_library();
256
257 public:
258 static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st,
259 bool throw_exception,
260 bool is_boot_append,
261 bool from_class_path_attr, TRAPS);
262
263 // If the package for InstanceKlass is in the boot loader's package entry
264 // table then add_package() sets the classpath_index field so that
265 // get_system_package() will know to return a non-null value for the
266 // package's location. And, so that the package will be added to the list of
267 // packages returned by get_system_packages().
268 // For packages whose classes are loaded from the boot loader class path, the
269 // classpath_index indicates which entry on the boot loader class path.
270 static bool add_package(const InstanceKlass* ik, s2 classpath_index, TRAPS);
271
272 // Canonicalizes path names, so strcmp will work properly. This is mainly
273 // to avoid confusing the zip library
274 static bool get_canonical_path(const char* orig, char* out, int len);
275 static const char* file_name_for_class_name(const char* class_name,
276 int class_name_len);
277 static PackageEntry* get_package_entry(Symbol* pkg_name, ClassLoaderData* loader_data, TRAPS);
278
279 public:
280 static int crc32(int crc, const char* buf, int len);
281 static bool update_class_path_entry_list(const char *path,
282 bool check_for_duplicates,
283 bool is_boot_append,
284 bool from_class_path_attr,
285 bool throw_exception=true);
286 CDS_ONLY(static void update_module_path_entry_list(const char *path, TRAPS);)
287 static void print_bootclasspath();
288
289 // Timing
290 static PerfCounter* perf_accumulated_time() { return _perf_accumulated_time; }
291 static PerfCounter* perf_classes_inited() { return _perf_classes_inited; }
292 static PerfCounter* perf_class_init_time() { return _perf_class_init_time; }
293 static PerfCounter* perf_class_init_selftime() { return _perf_class_init_selftime; }
294 static PerfCounter* perf_classes_verified() { return _perf_classes_verified; }
295 static PerfCounter* perf_class_verify_time() { return _perf_class_verify_time; }
296 static PerfCounter* perf_class_verify_selftime() { return _perf_class_verify_selftime; }
297 static PerfCounter* perf_classes_linked() { return _perf_classes_linked; }
422
423 // VM monitoring and management support
424 static jlong classloader_time_ms();
425 static jlong class_method_total_size();
426 static jlong class_init_count();
427 static jlong class_init_time_ms();
428 static jlong class_verify_time_ms();
429 static jlong class_link_count();
430 static jlong class_link_time_ms();
431
432 // indicates if class path already contains a entry (exact match by name)
433 static bool contains_append_entry(const char* name);
434
435 // adds a class path to the boot append entries
436 static void add_to_boot_append_entries(ClassPathEntry* new_entry);
437
438 // creates a class path zip entry (returns NULL if JAR file cannot be opened)
439 static ClassPathZipEntry* create_class_path_zip_entry(const char *apath, bool is_boot_append);
440
441 static bool string_ends_with(const char* str, const char* str_to_find);
442
443 // Debugging
444 static void verify() PRODUCT_RETURN;
445 };
446
447 // PerfClassTraceTime is used to measure time for class loading related events.
448 // This class tracks cumulative time and exclusive time for specific event types.
449 // During the execution of one event, other event types (e.g. class loading and
450 // resolution) as well as recursive calls of the same event type could happen.
451 // Only one elapsed timer (cumulative) and one thread-local self timer (exclusive)
452 // (i.e. only one event type) are active at a time even multiple PerfClassTraceTime
453 // instances have been created as multiple events are happening.
454 class PerfClassTraceTime {
455 public:
456 enum {
457 CLASS_LOAD = 0,
458 PARSE_CLASS = 1,
459 CLASS_LINK = 2,
460 CLASS_VERIFY = 3,
461 CLASS_CLINIT = 4,
|