src/share/vm/classfile/classLoader.hpp

Print this page
rev 6853 : 8046070: Class Data Sharing clean up and refactoring
Summary: Cleaned up CDS to be more configurable, maintainable and extensible
Reviewed-by: dholmes, coleenp, acorn, mchung

*** 105,114 **** --- 105,115 ---- public: bool is_jar_file() { return true; } const char* name() { return _zip_name; } ClassPathZipEntry(jzfile* zip, const char* zip_name); ~ClassPathZipEntry(); + u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS); ClassFileStream* open_stream(const char* name, TRAPS); void contents_do(void f(const char* name, void* context), void* context); // Debugging NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) NOT_PRODUCT(bool is_rt_jar();)
*** 120,136 **** private: char* _path; // dir or file struct stat _st; MetaIndex* _meta_index; bool _has_error; volatile ClassPathEntry* _resolved_entry; ClassPathEntry* resolve_entry(TRAPS); public: bool is_jar_file(); const char* name() { return _path; } ! LazyClassPathEntry(char* path, const struct stat* st); virtual ~LazyClassPathEntry(); ClassFileStream* open_stream(const char* name, TRAPS); void set_meta_index(MetaIndex* meta_index) { _meta_index = meta_index; } virtual bool is_lazy(); // Debugging --- 121,139 ---- private: char* _path; // dir or file struct stat _st; MetaIndex* _meta_index; bool _has_error; + bool _throw_exception; volatile ClassPathEntry* _resolved_entry; ClassPathEntry* resolve_entry(TRAPS); public: bool is_jar_file(); const char* name() { return _path; } ! LazyClassPathEntry(char* path, const struct stat* st, bool throw_exception); virtual ~LazyClassPathEntry(); + u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS); ClassFileStream* open_stream(const char* name, TRAPS); void set_meta_index(MetaIndex* meta_index) { _meta_index = meta_index; } virtual bool is_lazy(); // Debugging
*** 138,155 **** NOT_PRODUCT(bool is_rt_jar();) }; class PackageHashtable; class PackageInfo; template <MEMFLAGS F> class HashtableBucket; class ClassLoader: AllStatic { public: enum SomeConstants { package_hash_table_size = 31 // Number of buckets }; ! private: friend class LazyClassPathEntry; // Performance counters static PerfCounter* _perf_accumulated_time; static PerfCounter* _perf_classes_inited; --- 141,159 ---- NOT_PRODUCT(bool is_rt_jar();) }; class PackageHashtable; class PackageInfo; + class SharedPathsMiscInfo; template <MEMFLAGS F> class HashtableBucket; class ClassLoader: AllStatic { public: enum SomeConstants { package_hash_table_size = 31 // Number of buckets }; ! protected: friend class LazyClassPathEntry; // Performance counters static PerfCounter* _perf_accumulated_time; static PerfCounter* _perf_classes_inited;
*** 187,223 **** // First entry in linked list of ClassPathEntry instances static ClassPathEntry* _first_entry; // Last entry in linked list of ClassPathEntry instances static ClassPathEntry* _last_entry; // Hash table used to keep track of loaded packages static PackageHashtable* _package_hash_table; static const char* _shared_archive; // Hash function static unsigned int hash(const char *s, int n); // Returns the package file name corresponding to the specified package // or class name, or null if not found. static PackageInfo* lookup_package(const char *pkgname); // Adds a new package entry for the specified class or package name and // corresponding directory or jar file name. static bool add_package(const char *pkgname, int classpath_index, TRAPS); // Initialization ! static void setup_meta_index(); static void setup_bootstrap_search_path(); static void load_zip_library(); static ClassPathEntry* create_class_path_entry(char *path, const struct stat* st, ! bool lazy, TRAPS); // Canonicalizes path names, so strcmp will work properly. This is mainly // to avoid confusing the zip library static bool get_canonical_path(char* orig, char* out, int len); public: ! // Used by the kernel jvm. ! static void update_class_path_entry_list(char *path, ! bool check_for_duplicates); static void print_bootclasspath(); // Timing static PerfCounter* perf_accumulated_time() { return _perf_accumulated_time; } static PerfCounter* perf_classes_inited() { return _perf_classes_inited; } --- 191,236 ---- // First entry in linked list of ClassPathEntry instances static ClassPathEntry* _first_entry; // Last entry in linked list of ClassPathEntry instances static ClassPathEntry* _last_entry; + static int _num_entries; + // Hash table used to keep track of loaded packages static PackageHashtable* _package_hash_table; static const char* _shared_archive; + // Info used by CDS + CDS_ONLY(static SharedPathsMiscInfo * _shared_paths_misc_info;) + // Hash function static unsigned int hash(const char *s, int n); // Returns the package file name corresponding to the specified package // or class name, or null if not found. static PackageInfo* lookup_package(const char *pkgname); // Adds a new package entry for the specified class or package name and // corresponding directory or jar file name. static bool add_package(const char *pkgname, int classpath_index, TRAPS); // Initialization ! static void setup_bootstrap_meta_index(); ! static void setup_meta_index(const char* meta_index_path, const char* meta_index_dir, ! int start_index); static void setup_bootstrap_search_path(); + static void setup_search_path(char *class_path); + static void load_zip_library(); static ClassPathEntry* create_class_path_entry(char *path, const struct stat* st, ! bool lazy, bool throw_exception, TRAPS); // Canonicalizes path names, so strcmp will work properly. This is mainly // to avoid confusing the zip library static bool get_canonical_path(char* orig, char* out, int len); public: ! static bool update_class_path_entry_list(char *path, ! bool check_for_duplicates, ! bool throw_exception=true); static void print_bootclasspath(); // Timing static PerfCounter* perf_accumulated_time() { return _perf_accumulated_time; } static PerfCounter* perf_classes_inited() { return _perf_classes_inited; }
*** 296,305 **** --- 309,319 ---- // trailing "/". static objArrayOop get_system_packages(TRAPS); // Initialization static void initialize(); + CDS_ONLY(static void initialize_shared_path();) static void create_package_info_table(); static void create_package_info_table(HashtableBucket<mtClass> *t, int length, int number_of_entries); static int compute_Object_vtable();
*** 310,323 **** --- 324,348 ---- e = e->next(); } return e; } + #if INCLUDE_CDS // Sharing dump and restore static void copy_package_info_buckets(char** top, char* end); static void copy_package_info_table(char** top, char* end); + static void check_shared_classpath(const char *path); + static void finalize_shared_paths_misc_info(); + static int get_shared_paths_misc_info_size(); + static void* get_shared_paths_misc_info(); + static bool check_shared_paths_misc_info(void* info, int size); + static void exit_with_path_failure(const char* error, const char* message); + #endif + + static void trace_class_path(const char* msg, const char* name = NULL); + // VM monitoring and management support static jlong classloader_time_ms(); static jlong class_method_total_size(); static jlong class_init_count(); static jlong class_init_time_ms();
*** 337,347 **** // Debugging static void verify() PRODUCT_RETURN; // Force compilation of all methods in all classes in bootstrap class path (stress test) #ifndef PRODUCT ! private: static int _compile_the_world_class_counter; static int _compile_the_world_method_counter; public: static void compile_the_world(); static void compile_the_world_in(char* name, Handle loader, TRAPS); --- 362,372 ---- // Debugging static void verify() PRODUCT_RETURN; // Force compilation of all methods in all classes in bootstrap class path (stress test) #ifndef PRODUCT ! protected: static int _compile_the_world_class_counter; static int _compile_the_world_method_counter; public: static void compile_the_world(); static void compile_the_world_in(char* name, Handle loader, TRAPS);