< prev index next >

src/hotspot/share/classfile/systemDictionaryShared.hpp

Print this page




 115     FROM_FIELD_IS_PROTECTED = 1 << 0,
 116     FROM_IS_ARRAY           = 1 << 1,
 117     FROM_IS_OBJECT          = 1 << 2
 118   };
 119 
 120 private:
 121   // These _shared_xxxs arrays are used to initialize the java.lang.Package and
 122   // java.security.ProtectionDomain objects associated with each shared class.
 123   //
 124   // See SystemDictionaryShared::init_security_info for more info.
 125   static objArrayOop _shared_protection_domains;
 126   static objArrayOop _shared_jar_urls;
 127   static objArrayOop _shared_jar_manifests;
 128 
 129   static InstanceKlass* load_shared_class_for_builtin_loader(
 130                                                Symbol* class_name,
 131                                                Handle class_loader,
 132                                                TRAPS);
 133   static Handle get_package_name(Symbol*  class_name, TRAPS);
 134 


 135 
 136   // Package handling:
 137   //
 138   // 1. For named modules in the runtime image
 139   //    BOOT classes: Reuses the existing JVM_GetSystemPackage(s) interfaces
 140   //                  to get packages in named modules for shared classes.
 141   //                  Package for non-shared classes in named module is also
 142   //                  handled using JVM_GetSystemPackage(s).
 143   //
 144   //    APP  classes: VM calls ClassLoaders.AppClassLoader::definePackage(String, Module)
 145   //                  to define package for shared app classes from named
 146   //                  modules.
 147   //
 148   //    PLATFORM  classes: VM calls ClassLoaders.PlatformClassLoader::definePackage(String, Module)
 149   //                  to define package for shared platform classes from named
 150   //                  modules.
 151   //
 152   // 2. For unnamed modules
 153   //    BOOT classes: Reuses the existing JVM_GetSystemPackage(s) interfaces to
 154   //                  get packages for shared boot classes in unnamed modules.


 163   static void define_shared_package(Symbol*  class_name,
 164                                     Handle class_loader,
 165                                     Handle manifest,
 166                                     Handle url,
 167                                     TRAPS);
 168   static void define_shared_package(Symbol* class_name,
 169                                     Handle class_loader,
 170                                     ModuleEntry* mod_entry,
 171                                     TRAPS);
 172 
 173   static Handle get_shared_jar_manifest(int shared_path_index, TRAPS);
 174   static Handle get_shared_jar_url(int shared_path_index, TRAPS);
 175   static Handle get_protection_domain_from_classloader(Handle class_loader,
 176                                                        Handle url, TRAPS);
 177   static Handle get_shared_protection_domain(Handle class_loader,
 178                                              int shared_path_index,
 179                                              Handle url,
 180                                              TRAPS);
 181   static Handle get_shared_protection_domain(Handle class_loader,
 182                                              ModuleEntry* mod, TRAPS);
 183   static Handle init_security_info(Handle class_loader, InstanceKlass* ik, TRAPS);
 184 
 185   static void atomic_set_array_index(objArrayOop array, int index, oop o) {
 186     // Benign race condition:  array.obj_at(index) may already be filled in.
 187     // The important thing here is that all threads pick up the same result.
 188     // It doesn't matter which racing thread wins, as long as only one
 189     // result is used by all threads, and all future queries.
 190     array->atomic_compare_exchange_oop(index, o, NULL);
 191   }
 192 
 193   static oop shared_protection_domain(int index);
 194   static void atomic_set_shared_protection_domain(int index, oop pd) {
 195     atomic_set_array_index(_shared_protection_domains, index, pd);
 196   }
 197   static void allocate_shared_protection_domain_array(int size, TRAPS);
 198   static oop shared_jar_url(int index);
 199   static void atomic_set_shared_jar_url(int index, oop url) {
 200     atomic_set_array_index(_shared_jar_urls, index, url);
 201   }
 202   static void allocate_shared_jar_url_array(int size, TRAPS);
 203   static oop shared_jar_manifest(int index);




 115     FROM_FIELD_IS_PROTECTED = 1 << 0,
 116     FROM_IS_ARRAY           = 1 << 1,
 117     FROM_IS_OBJECT          = 1 << 2
 118   };
 119 
 120 private:
 121   // These _shared_xxxs arrays are used to initialize the java.lang.Package and
 122   // java.security.ProtectionDomain objects associated with each shared class.
 123   //
 124   // See SystemDictionaryShared::init_security_info for more info.
 125   static objArrayOop _shared_protection_domains;
 126   static objArrayOop _shared_jar_urls;
 127   static objArrayOop _shared_jar_manifests;
 128 
 129   static InstanceKlass* load_shared_class_for_builtin_loader(
 130                                                Symbol* class_name,
 131                                                Handle class_loader,
 132                                                TRAPS);
 133   static Handle get_package_name(Symbol*  class_name, TRAPS);
 134 
 135   static PackageEntry* get_package_entry_from_class_name(Handle class_loader, Symbol* class_name);
 136 
 137 
 138   // Package handling:
 139   //
 140   // 1. For named modules in the runtime image
 141   //    BOOT classes: Reuses the existing JVM_GetSystemPackage(s) interfaces
 142   //                  to get packages in named modules for shared classes.
 143   //                  Package for non-shared classes in named module is also
 144   //                  handled using JVM_GetSystemPackage(s).
 145   //
 146   //    APP  classes: VM calls ClassLoaders.AppClassLoader::definePackage(String, Module)
 147   //                  to define package for shared app classes from named
 148   //                  modules.
 149   //
 150   //    PLATFORM  classes: VM calls ClassLoaders.PlatformClassLoader::definePackage(String, Module)
 151   //                  to define package for shared platform classes from named
 152   //                  modules.
 153   //
 154   // 2. For unnamed modules
 155   //    BOOT classes: Reuses the existing JVM_GetSystemPackage(s) interfaces to
 156   //                  get packages for shared boot classes in unnamed modules.


 165   static void define_shared_package(Symbol*  class_name,
 166                                     Handle class_loader,
 167                                     Handle manifest,
 168                                     Handle url,
 169                                     TRAPS);
 170   static void define_shared_package(Symbol* class_name,
 171                                     Handle class_loader,
 172                                     ModuleEntry* mod_entry,
 173                                     TRAPS);
 174 
 175   static Handle get_shared_jar_manifest(int shared_path_index, TRAPS);
 176   static Handle get_shared_jar_url(int shared_path_index, TRAPS);
 177   static Handle get_protection_domain_from_classloader(Handle class_loader,
 178                                                        Handle url, TRAPS);
 179   static Handle get_shared_protection_domain(Handle class_loader,
 180                                              int shared_path_index,
 181                                              Handle url,
 182                                              TRAPS);
 183   static Handle get_shared_protection_domain(Handle class_loader,
 184                                              ModuleEntry* mod, TRAPS);
 185   static Handle init_security_info(Handle class_loader, InstanceKlass* ik, PackageEntry* pkg_entry, TRAPS);
 186 
 187   static void atomic_set_array_index(objArrayOop array, int index, oop o) {
 188     // Benign race condition:  array.obj_at(index) may already be filled in.
 189     // The important thing here is that all threads pick up the same result.
 190     // It doesn't matter which racing thread wins, as long as only one
 191     // result is used by all threads, and all future queries.
 192     array->atomic_compare_exchange_oop(index, o, NULL);
 193   }
 194 
 195   static oop shared_protection_domain(int index);
 196   static void atomic_set_shared_protection_domain(int index, oop pd) {
 197     atomic_set_array_index(_shared_protection_domains, index, pd);
 198   }
 199   static void allocate_shared_protection_domain_array(int size, TRAPS);
 200   static oop shared_jar_url(int index);
 201   static void atomic_set_shared_jar_url(int index, oop url) {
 202     atomic_set_array_index(_shared_jar_urls, index, url);
 203   }
 204   static void allocate_shared_jar_url_array(int size, TRAPS);
 205   static oop shared_jar_manifest(int index);


< prev index next >