hotspot/src/share/vm/classfile/classLoader.hpp
changeset 26419 25abc4a3285c
parent 26135 82b516c550f7
child 27025 f4805f778f16
equal deleted inserted replaced
26418:16ac9bcf600a 26419:25abc4a3285c
    70 };
    70 };
    71 
    71 
    72 
    72 
    73 class ClassPathDirEntry: public ClassPathEntry {
    73 class ClassPathDirEntry: public ClassPathEntry {
    74  private:
    74  private:
    75   char* _dir;           // Name of directory
    75   const char* _dir;           // Name of directory
    76  public:
    76  public:
    77   bool is_jar_file()  { return false;  }
    77   bool is_jar_file()  { return false;  }
    78   const char* name()  { return _dir; }
    78   const char* name()  { return _dir; }
    79   ClassPathDirEntry(char* dir);
    79   ClassPathDirEntry(const char* dir);
    80   ClassFileStream* open_stream(const char* name, TRAPS);
    80   ClassFileStream* open_stream(const char* name, TRAPS);
    81   // Debugging
    81   // Debugging
    82   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
    82   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
    83   NOT_PRODUCT(bool is_rt_jar();)
    83   NOT_PRODUCT(bool is_rt_jar();)
    84 };
    84 };
    98 } jzentry;
    98 } jzentry;
    99 
    99 
   100 
   100 
   101 class ClassPathZipEntry: public ClassPathEntry {
   101 class ClassPathZipEntry: public ClassPathEntry {
   102  private:
   102  private:
   103   jzfile* _zip;        // The zip archive
   103   jzfile* _zip;              // The zip archive
   104   char*   _zip_name;   // Name of zip archive
   104   const char*   _zip_name;   // Name of zip archive
   105  public:
   105  public:
   106   bool is_jar_file()  { return true;  }
   106   bool is_jar_file()  { return true;  }
   107   const char* name()  { return _zip_name; }
   107   const char* name()  { return _zip_name; }
   108   ClassPathZipEntry(jzfile* zip, const char* zip_name);
   108   ClassPathZipEntry(jzfile* zip, const char* zip_name);
   109   ~ClassPathZipEntry();
   109   ~ClassPathZipEntry();
   117 
   117 
   118 
   118 
   119 // For lazier loading of boot class path entries
   119 // For lazier loading of boot class path entries
   120 class LazyClassPathEntry: public ClassPathEntry {
   120 class LazyClassPathEntry: public ClassPathEntry {
   121  private:
   121  private:
   122   char* _path; // dir or file
   122   const char* _path; // dir or file
   123   struct stat _st;
   123   struct stat _st;
   124   MetaIndex* _meta_index;
   124   MetaIndex* _meta_index;
   125   bool _has_error;
   125   bool _has_error;
   126   bool _throw_exception;
   126   bool _throw_exception;
   127   volatile ClassPathEntry* _resolved_entry;
   127   volatile ClassPathEntry* _resolved_entry;
   128   ClassPathEntry* resolve_entry(TRAPS);
   128   ClassPathEntry* resolve_entry(TRAPS);
   129  public:
   129  public:
   130   bool is_jar_file();
   130   bool is_jar_file();
   131   const char* name()  { return _path; }
   131   const char* name()  { return _path; }
   132   LazyClassPathEntry(char* path, const struct stat* st, bool throw_exception);
   132   LazyClassPathEntry(const char* path, const struct stat* st, bool throw_exception);
   133   virtual ~LazyClassPathEntry();
   133   virtual ~LazyClassPathEntry();
   134   u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS);
   134   u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS);
   135 
   135 
   136   ClassFileStream* open_stream(const char* name, TRAPS);
   136   ClassFileStream* open_stream(const char* name, TRAPS);
   137   void set_meta_index(MetaIndex* meta_index) { _meta_index = meta_index; }
   137   void set_meta_index(MetaIndex* meta_index) { _meta_index = meta_index; }
   214   // Initialization
   214   // Initialization
   215   static void setup_bootstrap_meta_index();
   215   static void setup_bootstrap_meta_index();
   216   static void setup_meta_index(const char* meta_index_path, const char* meta_index_dir,
   216   static void setup_meta_index(const char* meta_index_path, const char* meta_index_dir,
   217                                int start_index);
   217                                int start_index);
   218   static void setup_bootstrap_search_path();
   218   static void setup_bootstrap_search_path();
   219   static void setup_search_path(char *class_path);
   219   static void setup_search_path(const char *class_path);
   220 
   220 
   221   static void load_zip_library();
   221   static void load_zip_library();
   222   static ClassPathEntry* create_class_path_entry(char *path, const struct stat* st,
   222   static ClassPathEntry* create_class_path_entry(const char *path, const struct stat* st,
   223                                                  bool lazy, bool throw_exception, TRAPS);
   223                                                  bool lazy, bool throw_exception, TRAPS);
   224 
   224 
   225   // Canonicalizes path names, so strcmp will work properly. This is mainly
   225   // Canonicalizes path names, so strcmp will work properly. This is mainly
   226   // to avoid confusing the zip library
   226   // to avoid confusing the zip library
   227   static bool get_canonical_path(char* orig, char* out, int len);
   227   static bool get_canonical_path(const char* orig, char* out, int len);
   228  public:
   228  public:
   229   static bool update_class_path_entry_list(char *path,
   229   static bool update_class_path_entry_list(const char *path,
   230                                            bool check_for_duplicates,
   230                                            bool check_for_duplicates,
   231                                            bool throw_exception=true);
   231                                            bool throw_exception=true);
   232   static void print_bootclasspath();
   232   static void print_bootclasspath();
   233 
   233 
   234   // Timing
   234   // Timing