< prev index next >

src/share/vm/classfile/classLoader.hpp

Print this page
rev 6864 : 8061651: Interface to the Lookup Index Cache to improve URLClassPath search time
Summary: Implemented the interface in sun.misc.URLClassPath and corresponding JVM_XXX APIs
Reviewed-by: mchung, acorn, jiangli, dholmes


 112   void contents_do(void f(const char* name, void* context), void* context);
 113   // Debugging
 114   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
 115   NOT_PRODUCT(void compile_the_world12(Handle loader, TRAPS);) // JDK 1.2 version
 116   NOT_PRODUCT(void compile_the_world13(Handle loader, TRAPS);) // JDK 1.3 version
 117   NOT_PRODUCT(bool is_rt_jar();)
 118   NOT_PRODUCT(bool is_rt_jar12();)
 119   NOT_PRODUCT(bool is_rt_jar13();)
 120 };
 121 
 122 
 123 // For lazier loading of boot class path entries
 124 class LazyClassPathEntry: public ClassPathEntry {
 125  private:
 126   const char* _path; // dir or file
 127   struct stat _st;
 128   MetaIndex* _meta_index;
 129   bool _has_error;
 130   bool _throw_exception;
 131   volatile ClassPathEntry* _resolved_entry;
 132   ClassPathEntry* resolve_entry(TRAPS);
 133  public:

 134   bool is_jar_file();
 135   const char* name()  { return _path; }
 136   LazyClassPathEntry(const char* path, const struct stat* st, bool throw_exception);
 137   u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS);
 138   ClassFileStream* open_stream(const char* name, TRAPS);
 139   void set_meta_index(MetaIndex* meta_index) { _meta_index = meta_index; }
 140   virtual bool is_lazy();
 141   // Debugging
 142   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
 143   NOT_PRODUCT(bool is_rt_jar();)
 144 };
 145 
 146 class PackageHashtable;
 147 class PackageInfo;
 148 class SharedPathsMiscInfo;
 149 template <MEMFLAGS F> class HashtableBucket;
 150 
 151 class ClassLoader: AllStatic {
 152  public:
 153   enum SomeConstants {


 201   static PackageHashtable* _package_hash_table;
 202   static const char* _shared_archive;
 203 
 204   // Info used by CDS
 205   CDS_ONLY(static SharedPathsMiscInfo * _shared_paths_misc_info;)
 206 
 207   // Hash function
 208   static unsigned int hash(const char *s, int n);
 209   // Returns the package file name corresponding to the specified package
 210   // or class name, or null if not found.
 211   static PackageInfo* lookup_package(const char *pkgname);
 212   // Adds a new package entry for the specified class or package name and
 213   // corresponding directory or jar file name.
 214   static bool add_package(const char *pkgname, int classpath_index, TRAPS);
 215 
 216   // Initialization
 217   static void setup_bootstrap_meta_index();
 218   static void setup_meta_index(const char* meta_index_path, const char* meta_index_dir,
 219                                int start_index);
 220   static void setup_bootstrap_search_path();
 221   static void setup_search_path(const char *class_path);
 222 
 223   static void load_zip_library();
 224   static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st,
 225                                                  bool lazy, bool throw_exception, TRAPS);
 226 
 227   // Canonicalizes path names, so strcmp will work properly. This is mainly
 228   // to avoid confusing the zip library
 229   static bool get_canonical_path(const char* orig, char* out, int len);
 230  public:
 231   static int crc32(int crc, const char* buf, int len);
 232   static bool update_class_path_entry_list(const char *path,
 233                                            bool check_for_duplicates,
 234                                            bool throw_exception=true);
 235   static void print_bootclasspath();
 236 
 237   // Timing
 238   static PerfCounter* perf_accumulated_time()         { return _perf_accumulated_time; }
 239   static PerfCounter* perf_classes_inited()           { return _perf_classes_inited; }
 240   static PerfCounter* perf_class_init_time()          { return _perf_class_init_time; }
 241   static PerfCounter* perf_class_init_selftime()      { return _perf_class_init_selftime; }


 312   // trailing "/".
 313   static objArrayOop get_system_packages(TRAPS);
 314 
 315   // Initialization
 316   static void initialize();
 317   CDS_ONLY(static void initialize_shared_path();)
 318   static void create_package_info_table();
 319   static void create_package_info_table(HashtableBucket<mtClass> *t, int length,
 320                                         int number_of_entries);
 321   static int compute_Object_vtable();
 322 
 323   static ClassPathEntry* classpath_entry(int n) {
 324     ClassPathEntry* e = ClassLoader::_first_entry;
 325     while (--n >= 0) {
 326       assert(e != NULL, "Not that many classpath entries.");
 327       e = e->next();
 328     }
 329     return e;
 330   }
 331 




 332 #if INCLUDE_CDS
 333   // Sharing dump and restore
 334   static void copy_package_info_buckets(char** top, char* end);
 335   static void copy_package_info_table(char** top, char* end);
 336 
 337   static void  check_shared_classpath(const char *path);
 338   static void  finalize_shared_paths_misc_info();
 339   static int   get_shared_paths_misc_info_size();
 340   static void* get_shared_paths_misc_info();
 341   static bool  check_shared_paths_misc_info(void* info, int size);
 342   static void  exit_with_path_failure(const char* error, const char* message);
 343 #endif
 344 
 345   static void  trace_class_path(const char* msg, const char* name = NULL);
 346 
 347   // VM monitoring and management support
 348   static jlong classloader_time_ms();
 349   static jlong class_method_total_size();
 350   static jlong class_init_count();
 351   static jlong class_init_time_ms();




 112   void contents_do(void f(const char* name, void* context), void* context);
 113   // Debugging
 114   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
 115   NOT_PRODUCT(void compile_the_world12(Handle loader, TRAPS);) // JDK 1.2 version
 116   NOT_PRODUCT(void compile_the_world13(Handle loader, TRAPS);) // JDK 1.3 version
 117   NOT_PRODUCT(bool is_rt_jar();)
 118   NOT_PRODUCT(bool is_rt_jar12();)
 119   NOT_PRODUCT(bool is_rt_jar13();)
 120 };
 121 
 122 
 123 // For lazier loading of boot class path entries
 124 class LazyClassPathEntry: public ClassPathEntry {
 125  private:
 126   const char* _path; // dir or file
 127   struct stat _st;
 128   MetaIndex* _meta_index;
 129   bool _has_error;
 130   bool _throw_exception;
 131   volatile ClassPathEntry* _resolved_entry;

 132  public:
 133   ClassPathEntry* resolve_entry(TRAPS);
 134   bool is_jar_file();
 135   const char* name()  { return _path; }
 136   LazyClassPathEntry(const char* path, const struct stat* st, bool throw_exception);
 137   u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS);
 138   ClassFileStream* open_stream(const char* name, TRAPS);
 139   void set_meta_index(MetaIndex* meta_index) { _meta_index = meta_index; }
 140   virtual bool is_lazy();
 141   // Debugging
 142   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
 143   NOT_PRODUCT(bool is_rt_jar();)
 144 };
 145 
 146 class PackageHashtable;
 147 class PackageInfo;
 148 class SharedPathsMiscInfo;
 149 template <MEMFLAGS F> class HashtableBucket;
 150 
 151 class ClassLoader: AllStatic {
 152  public:
 153   enum SomeConstants {


 201   static PackageHashtable* _package_hash_table;
 202   static const char* _shared_archive;
 203 
 204   // Info used by CDS
 205   CDS_ONLY(static SharedPathsMiscInfo * _shared_paths_misc_info;)
 206 
 207   // Hash function
 208   static unsigned int hash(const char *s, int n);
 209   // Returns the package file name corresponding to the specified package
 210   // or class name, or null if not found.
 211   static PackageInfo* lookup_package(const char *pkgname);
 212   // Adds a new package entry for the specified class or package name and
 213   // corresponding directory or jar file name.
 214   static bool add_package(const char *pkgname, int classpath_index, TRAPS);
 215 
 216   // Initialization
 217   static void setup_bootstrap_meta_index();
 218   static void setup_meta_index(const char* meta_index_path, const char* meta_index_dir,
 219                                int start_index);
 220   static void setup_bootstrap_search_path();
 221   static void setup_search_path(const char *class_path, bool canonicalize=false);
 222 
 223   static void load_zip_library();
 224   static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st,
 225                                                  bool lazy, bool throw_exception, TRAPS);
 226 
 227   // Canonicalizes path names, so strcmp will work properly. This is mainly
 228   // to avoid confusing the zip library
 229   static bool get_canonical_path(const char* orig, char* out, int len);
 230  public:
 231   static int crc32(int crc, const char* buf, int len);
 232   static bool update_class_path_entry_list(const char *path,
 233                                            bool check_for_duplicates,
 234                                            bool throw_exception=true);
 235   static void print_bootclasspath();
 236 
 237   // Timing
 238   static PerfCounter* perf_accumulated_time()         { return _perf_accumulated_time; }
 239   static PerfCounter* perf_classes_inited()           { return _perf_classes_inited; }
 240   static PerfCounter* perf_class_init_time()          { return _perf_class_init_time; }
 241   static PerfCounter* perf_class_init_selftime()      { return _perf_class_init_selftime; }


 312   // trailing "/".
 313   static objArrayOop get_system_packages(TRAPS);
 314 
 315   // Initialization
 316   static void initialize();
 317   CDS_ONLY(static void initialize_shared_path();)
 318   static void create_package_info_table();
 319   static void create_package_info_table(HashtableBucket<mtClass> *t, int length,
 320                                         int number_of_entries);
 321   static int compute_Object_vtable();
 322 
 323   static ClassPathEntry* classpath_entry(int n) {
 324     ClassPathEntry* e = ClassLoader::_first_entry;
 325     while (--n >= 0) {
 326       assert(e != NULL, "Not that many classpath entries.");
 327       e = e->next();
 328     }
 329     return e;
 330   }
 331 
 332   static int num_classpath_entries() {
 333     return _num_entries;
 334   }
 335 
 336 #if INCLUDE_CDS
 337   // Sharing dump and restore
 338   static void copy_package_info_buckets(char** top, char* end);
 339   static void copy_package_info_table(char** top, char* end);
 340 
 341   static void  check_shared_classpath(const char *path);
 342   static void  finalize_shared_paths_misc_info();
 343   static int   get_shared_paths_misc_info_size();
 344   static void* get_shared_paths_misc_info();
 345   static bool  check_shared_paths_misc_info(void* info, int size);
 346   static void  exit_with_path_failure(const char* error, const char* message);
 347 #endif
 348 
 349   static void  trace_class_path(const char* msg, const char* name = NULL);
 350 
 351   // VM monitoring and management support
 352   static jlong classloader_time_ms();
 353   static jlong class_method_total_size();
 354   static jlong class_init_count();
 355   static jlong class_init_time_ms();


< prev index next >