hotspot/src/share/vm/classfile/classLoader.hpp
changeset 37773 e5b3e9732c3c
parent 37418 ebb041956080
child 38207 2ed792c9481d
equal deleted inserted replaced
37761:82b8d12a553f 37773:e5b3e9732c3c
   140   bool is_open() const { return _jimage != NULL; }
   140   bool is_open() const { return _jimage != NULL; }
   141   const char* name() const { return _name == NULL ? "" : _name; }
   141   const char* name() const { return _name == NULL ? "" : _name; }
   142   JImageFile* jimage() const { return _jimage; }
   142   JImageFile* jimage() const { return _jimage; }
   143   ClassPathImageEntry(JImageFile* jimage, const char* name);
   143   ClassPathImageEntry(JImageFile* jimage, const char* name);
   144   ~ClassPathImageEntry();
   144   ~ClassPathImageEntry();
   145   void name_to_package(const char* name, char* package, int length);
       
   146   ClassFileStream* open_stream(const char* name, TRAPS);
   145   ClassFileStream* open_stream(const char* name, TRAPS);
   147 
   146 
   148   // Debugging
   147   // Debugging
   149   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
   148   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
       
   149 };
       
   150 
       
   151 // ModuleClassPathList contains a linked list of ClassPathEntry's
       
   152 // that have been specified for a specific module.  Currently,
       
   153 // the only way to specify a module/path pair is via the -Xpatch
       
   154 // command line option.
       
   155 class ModuleClassPathList : public CHeapObj<mtClass> {
       
   156 private:
       
   157   Symbol* _module_name;
       
   158   // First and last entries of class path entries for a specific module
       
   159   ClassPathEntry* _module_first_entry;
       
   160   ClassPathEntry* _module_last_entry;
       
   161 public:
       
   162   Symbol* module_name() const { return _module_name; }
       
   163   ClassPathEntry* module_first_entry() const { return _module_first_entry; }
       
   164   ModuleClassPathList(Symbol* module_name);
       
   165   ~ModuleClassPathList();
       
   166   void add_to_list(ClassPathEntry* new_entry);
   150 };
   167 };
   151 
   168 
   152 class SharedPathsMiscInfo;
   169 class SharedPathsMiscInfo;
   153 
   170 
   154 class ClassLoader: AllStatic {
   171 class ClassLoader: AllStatic {
   193 
   210 
   194   static PerfCounter* _unsafe_defineClassCallCounter;
   211   static PerfCounter* _unsafe_defineClassCallCounter;
   195   static PerfCounter* _isUnsyncloadClass;
   212   static PerfCounter* _isUnsyncloadClass;
   196   static PerfCounter* _load_instance_class_failCounter;
   213   static PerfCounter* _load_instance_class_failCounter;
   197 
   214 
   198   // First entry in linked list of ClassPathEntry instances.
   215   // The boot class path consists of 3 ordered pieces:
   199   // This consists of entries made up by:
   216   //  1. the module/path pairs specified to -Xpatch
   200   //   - boot loader modules
   217   //    -Xpatch:<module>=<file>(<pathsep><file>)*
   201   //     [-Xpatch]; exploded build | modules;
   218   //  2. the base piece
   202   //   - boot loader append path
   219   //    [exploded build | jimage]
   203   //     [-Xbootclasspath/a]; [jvmti appended entries]
   220   //  3. boot loader append path
       
   221   //    [-Xbootclasspath/a]; [jvmti appended entries]
       
   222   //
       
   223   // The boot loader must obey this order when attempting
       
   224   // to load a class.
       
   225 
       
   226   // Contains the module/path pairs specified to -Xpatch
       
   227   static GrowableArray<ModuleClassPathList*>* _xpatch_entries;
       
   228 
       
   229   // Contains the ClassPathEntry instances that include
       
   230   // both the base piece and the boot loader append path.
   204   static ClassPathEntry* _first_entry;
   231   static ClassPathEntry* _first_entry;
   205   // Last entry in linked list of ClassPathEntry instances
   232   // Last entry in linked list of ClassPathEntry instances
   206   static ClassPathEntry* _last_entry;
   233   static ClassPathEntry* _last_entry;
   207   static int _num_entries;
   234   static int _num_entries;
   208 
   235 
   209   // Pointer into the linked list of ClassPathEntry instances.
       
   210   // Marks the start of:
   236   // Marks the start of:
   211   //   - the boot loader's append path
   237   //   - the boot loader's append path
   212   //     [-Xbootclasspath/a]; [jvmti appended entries]
   238   //     [-Xbootclasspath/a]; [jvmti appended entries]
       
   239   // within the linked list of ClassPathEntry instances.
   213   static ClassPathEntry* _first_append_entry;
   240   static ClassPathEntry* _first_append_entry;
   214 
   241 
   215   static const char* _shared_archive;
   242   static const char* _shared_archive;
   216 
   243 
   217   // True if the boot path has a "modules" jimage
   244   // True if the boot path has a "modules" jimage
   323   // fails with linkageError when Unsyncloadclass flag is set.
   350   // fails with linkageError when Unsyncloadclass flag is set.
   324   static PerfCounter* load_instance_class_failCounter() {
   351   static PerfCounter* load_instance_class_failCounter() {
   325     return _load_instance_class_failCounter;
   352     return _load_instance_class_failCounter;
   326   }
   353   }
   327 
   354 
       
   355   // Set up the module/path pairs as specified to -Xpatch
       
   356   static void setup_xpatch_entries();
       
   357 
   328   // Sets _has_jimage to TRUE if "modules" jimage file exists
   358   // Sets _has_jimage to TRUE if "modules" jimage file exists
   329   static void set_has_jimage(bool val) {
   359   static void set_has_jimage();
   330     _has_jimage = val;
       
   331   }
       
   332 
       
   333   static bool has_jimage() { return _has_jimage; }
   360   static bool has_jimage() { return _has_jimage; }
   334 
   361 
   335   // Create the ModuleEntry for java.base
   362   // Create the ModuleEntry for java.base
   336   static void create_javabase();
   363   static void create_javabase();
   337 
   364 
   413 
   440 
   414   // prepend a path to class path list
   441   // prepend a path to class path list
   415   static void prepend_to_list(const char* apath);
   442   static void prepend_to_list(const char* apath);
   416 
   443 
   417   static bool string_ends_with(const char* str, const char* str_to_find);
   444   static bool string_ends_with(const char* str, const char* str_to_find);
       
   445 
       
   446   // obtain package name from a fully qualified class name
       
   447   static const char* package_from_name(const char* class_name);
   418 
   448 
   419   static bool is_jrt(const char* name) { return string_ends_with(name, MODULES_IMAGE_NAME); }
   449   static bool is_jrt(const char* name) { return string_ends_with(name, MODULES_IMAGE_NAME); }
   420 
   450 
   421   // Debugging
   451   // Debugging
   422   static void verify()              PRODUCT_RETURN;
   452   static void verify()              PRODUCT_RETURN;