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
432 static void add_to_boot_append_entries(ClassPathEntry* new_entry);
|
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, TRAPS);)
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, TRAPS);)
296 static void print_bootclasspath();
297
298 // Timing
299 static PerfCounter* perf_accumulated_time() { return _perf_accumulated_time; }
300 static PerfCounter* perf_classes_inited() { return _perf_classes_inited; }
301 static PerfCounter* perf_class_init_time() { return _perf_class_init_time; }
302 static PerfCounter* perf_class_init_selftime() { return _perf_class_init_selftime; }
303 static PerfCounter* perf_classes_verified() { return _perf_classes_verified; }
304 static PerfCounter* perf_class_verify_time() { return _perf_class_verify_time; }
305 static PerfCounter* perf_class_verify_selftime() { return _perf_class_verify_selftime; }
306 static PerfCounter* perf_classes_linked() { return _perf_classes_linked; }
307 static PerfCounter* perf_class_link_time() { return _perf_class_link_time; }
308 static PerfCounter* perf_class_link_selftime() { return _perf_class_link_selftime; }
309 static PerfCounter* perf_class_parse_time() { return _perf_class_parse_time; }
310 static PerfCounter* perf_class_parse_selftime() { return _perf_class_parse_selftime; }
311 static PerfCounter* perf_sys_class_lookup_time() { return _perf_sys_class_lookup_time; }
312 static PerfCounter* perf_shared_classload_time() { return _perf_shared_classload_time; }
313 static PerfCounter* perf_sys_classload_time() { return _perf_sys_classload_time; }
314 static PerfCounter* perf_app_classload_time() { return _perf_app_classload_time; }
315 static PerfCounter* perf_app_classload_selftime() { return _perf_app_classload_selftime; }
372 static InstanceKlass* load_class(Symbol* class_name, bool search_append_only, TRAPS);
373
374 // If the specified package has been loaded by the system, then returns
375 // the name of the directory or ZIP file that the package was loaded from.
376 // Returns null if the package was not loaded.
377 // Note: The specified name can either be the name of a class or package.
378 // If a package name is specified, then it must be "/"-separator and also
379 // end with a trailing "/".
380 static oop get_system_package(const char* name, TRAPS);
381
382 // Returns an array of Java strings representing all of the currently
383 // loaded system packages.
384 // Note: The package names returned are "/"-separated and end with a
385 // trailing "/".
386 static objArrayOop get_system_packages(TRAPS);
387
388 // Initialization
389 static void initialize();
390 static void classLoader_init2(TRAPS);
391 CDS_ONLY(static void initialize_shared_path();)
392 CDS_ONLY(static void initialize_module_path(TRAPS);)
393
394 static int compute_Object_vtable();
395
396 static ClassPathEntry* classpath_entry(int n);
397
398 static bool is_in_patch_mod_entries(Symbol* module_name);
399
400 #if INCLUDE_CDS
401 // Sharing dump and restore
402
403 // Helper function used by CDS code to get the number of boot classpath
404 // entries during shared classpath setup time.
405 static int num_boot_classpath_entries();
406
407 static ClassPathEntry* get_next_boot_classpath_entry(ClassPathEntry* e);
408
409 // Helper function used by CDS code to get the number of app classpath
410 // entries during shared classpath setup time.
411 static int num_app_classpath_entries();
412
413 // Helper function used by CDS code to get the number of module path
414 // entries during shared classpath setup time.
415 static int num_module_path_entries() {
416 assert(DumpSharedSpaces, "Should only be called at CDS dump time");
417 int num_entries = 0;
418 ClassPathEntry* e= ClassLoader::_module_path_entries;
419 while (e != NULL) {
420 num_entries ++;
421 e = e->next();
422 }
423 return num_entries;
424 }
425 static void check_shared_classpath(const char *path);
426 static void finalize_shared_paths_misc_info();
427 static int get_shared_paths_misc_info_size();
428 static void* get_shared_paths_misc_info();
429 static bool check_shared_paths_misc_info(void* info, int size);
430 static int get_module_paths_misc_info_size();
431 static void* get_module_paths_misc_info();
432 static void exit_with_path_failure(const char* error, const char* message);
433 static char* skip_uri_protocol(char* source);
434 static void record_result(InstanceKlass* ik, const ClassFileStream* stream, TRAPS);
435 #endif
436 static JImageLocationRef jimage_find_resource(JImageFile* jf, const char* module_name,
437 const char* file_name, jlong &size);
438
439 static void trace_class_path(const char* msg, const char* name = NULL);
440
441 // VM monitoring and management support
442 static jlong classloader_time_ms();
443 static jlong class_method_total_size();
444 static jlong class_init_count();
445 static jlong class_init_time_ms();
446 static jlong class_verify_time_ms();
447 static jlong class_link_count();
448 static jlong class_link_time_ms();
449
450 // indicates if class path already contains a entry (exact match by name)
451 static bool contains_append_entry(const char* name);
452
453 // adds a class path to the boot append entries
454 static void add_to_boot_append_entries(ClassPathEntry* new_entry);
|