src/hotspot/share/classfile/systemDictionaryShared.hpp
changeset 51329 9c68699bebe5
parent 50152 b5023063346d
child 51470 84d3126858d5
equal deleted inserted replaced
51328:fad2334b2906 51329:9c68699bebe5
   130   void*           _verifier_constraints; // FIXME - use a union here to avoid type casting??
   130   void*           _verifier_constraints; // FIXME - use a union here to avoid type casting??
   131   void*           _verifier_constraint_flags;
   131   void*           _verifier_constraint_flags;
   132 
   132 
   133   // See "Identifying the loader_type of archived classes" comments above.
   133   // See "Identifying the loader_type of archived classes" comments above.
   134   LoaderType loader_type() const {
   134   LoaderType loader_type() const {
   135     Klass* k = (Klass*)literal();
   135     InstanceKlass* k = instance_klass();
   136 
   136 
   137     if ((k->shared_classpath_index() != UNREGISTERED_INDEX)) {
   137     if ((k->shared_classpath_index() != UNREGISTERED_INDEX)) {
   138       return LT_BUILTIN;
   138       return LT_BUILTIN;
   139     } else {
   139     } else {
   140       return LT_UNREGISTERED;
   140       return LT_UNREGISTERED;
   169   SharedDictionaryEntry* bucket(int index) const {
   169   SharedDictionaryEntry* bucket(int index) const {
   170     return (SharedDictionaryEntry*)(Dictionary::bucket(index));
   170     return (SharedDictionaryEntry*)(Dictionary::bucket(index));
   171   }
   171   }
   172 
   172 
   173 public:
   173 public:
   174   SharedDictionaryEntry* find_entry_for(Klass* klass);
   174   SharedDictionaryEntry* find_entry_for(InstanceKlass* klass);
   175   void finalize_verification_constraints();
   175   void finalize_verification_constraints();
   176 
   176 
   177   bool add_non_builtin_klass(const Symbol* class_name,
   177   bool add_non_builtin_klass(const Symbol* class_name,
   178                              ClassLoaderData* loader_data,
   178                              ClassLoaderData* loader_data,
   179                              InstanceKlass* obj);
   179                              InstanceKlass* obj);
   180 
   180 
   181   void update_entry(Klass* klass, int id);
   181   void update_entry(InstanceKlass* klass, int id);
   182 
   182 
   183   Klass* find_class_for_builtin_loader(const Symbol* name) const;
   183   InstanceKlass* find_class_for_builtin_loader(const Symbol* name) const;
   184   Klass* find_class_for_unregistered_loader(const Symbol* name,
   184   InstanceKlass* find_class_for_unregistered_loader(const Symbol* name,
   185                                             int clsfile_size,
   185                                             int clsfile_size,
   186                                             int clsfile_crc32) const;
   186                                             int clsfile_crc32) const;
   187   bool class_exists_for_unregistered_loader(const Symbol* name) {
   187   bool class_exists_for_unregistered_loader(const Symbol* name) {
   188     return (get_entry_for_unregistered_loader(name, -1, -1) != NULL);
   188     return (get_entry_for_unregistered_loader(name, -1, -1) != NULL);
   189   }
   189   }
   315     return NULL;
   315     return NULL;
   316   }
   316   }
   317 
   317 
   318   static bool add_non_builtin_klass(Symbol* class_name, ClassLoaderData* loader_data,
   318   static bool add_non_builtin_klass(Symbol* class_name, ClassLoaderData* loader_data,
   319                                     InstanceKlass* k, TRAPS);
   319                                     InstanceKlass* k, TRAPS);
   320   static Klass* dump_time_resolve_super_or_fail(Symbol* child_name,
   320   static InstanceKlass* dump_time_resolve_super_or_fail(Symbol* child_name,
   321                                                 Symbol* class_name,
   321                                                 Symbol* class_name,
   322                                                 Handle class_loader,
   322                                                 Handle class_loader,
   323                                                 Handle protection_domain,
   323                                                 Handle protection_domain,
   324                                                 bool is_superclass,
   324                                                 bool is_superclass,
   325                                                 TRAPS);
   325                                                 TRAPS);
   326 
   326 
   327   static size_t dictionary_entry_size() {
   327   static size_t dictionary_entry_size() {
   328     return (DumpSharedSpaces) ? sizeof(SharedDictionaryEntry) : sizeof(DictionaryEntry);
   328     return (DumpSharedSpaces) ? sizeof(SharedDictionaryEntry) : sizeof(DictionaryEntry);
   329   }
   329   }
   330   static void init_shared_dictionary_entry(Klass* k, DictionaryEntry* entry) NOT_CDS_RETURN;
   330   static void init_shared_dictionary_entry(InstanceKlass* k, DictionaryEntry* entry) NOT_CDS_RETURN;
   331   static bool is_builtin(DictionaryEntry* ent) {
   331   static bool is_builtin(DictionaryEntry* ent) {
   332     // Can't use virtual function is_builtin because DictionaryEntry doesn't initialize
   332     // Can't use virtual function is_builtin because DictionaryEntry doesn't initialize
   333     // vtable because it's not constructed properly.
   333     // vtable because it's not constructed properly.
   334     SharedDictionaryEntry* entry = (SharedDictionaryEntry*)ent;
   334     SharedDictionaryEntry* entry = (SharedDictionaryEntry*)ent;
   335     return entry->is_builtin();
   335     return entry->is_builtin();
   343 
   343 
   344   static SharedDictionary* boot_loader_dictionary() {
   344   static SharedDictionary* boot_loader_dictionary() {
   345     return (SharedDictionary*)ClassLoaderData::the_null_class_loader_data()->dictionary();
   345     return (SharedDictionary*)ClassLoaderData::the_null_class_loader_data()->dictionary();
   346   }
   346   }
   347 
   347 
   348   static void update_shared_entry(Klass* klass, int id) {
   348   static void update_shared_entry(InstanceKlass* klass, int id) {
   349     assert(DumpSharedSpaces, "sanity");
   349     assert(DumpSharedSpaces, "sanity");
   350     assert((SharedDictionary*)(klass->class_loader_data()->dictionary()) != NULL, "sanity");
   350     assert((SharedDictionary*)(klass->class_loader_data()->dictionary()) != NULL, "sanity");
   351     ((SharedDictionary*)(klass->class_loader_data()->dictionary()))->update_entry(klass, id);
   351     ((SharedDictionary*)(klass->class_loader_data()->dictionary()))->update_entry(klass, id);
   352   }
   352   }
   353 
   353 
   354   static void set_shared_class_misc_info(Klass* k, ClassFileStream* cfs);
   354   static void set_shared_class_misc_info(InstanceKlass* k, ClassFileStream* cfs);
   355 
   355 
   356   static InstanceKlass* lookup_from_stream(const Symbol* class_name,
   356   static InstanceKlass* lookup_from_stream(const Symbol* class_name,
   357                                            Handle class_loader,
   357                                            Handle class_loader,
   358                                            Handle protection_domain,
   358                                            Handle protection_domain,
   359                                            const ClassFileStream* st,
   359                                            const ClassFileStream* st,
   365   // With AppCDS, it is possible to override archived classes by calling
   365   // With AppCDS, it is possible to override archived classes by calling
   366   // ClassLoader.defineClass() directly. SystemDictionary::load_shared_class() already
   366   // ClassLoader.defineClass() directly. SystemDictionary::load_shared_class() already
   367   // ensures that you cannot load a shared class if its super type(s) are changed. However,
   367   // ensures that you cannot load a shared class if its super type(s) are changed. However,
   368   // we need an additional check to ensure that the verification_constraints did not change
   368   // we need an additional check to ensure that the verification_constraints did not change
   369   // between dump time and runtime.
   369   // between dump time and runtime.
   370   static bool add_verification_constraint(Klass* k, Symbol* name,
   370   static bool add_verification_constraint(InstanceKlass* k, Symbol* name,
   371                   Symbol* from_name, bool from_field_is_protected,
   371                   Symbol* from_name, bool from_field_is_protected,
   372                   bool from_is_array, bool from_is_object) NOT_CDS_RETURN_(false);
   372                   bool from_is_array, bool from_is_object) NOT_CDS_RETURN_(false);
   373   static void finalize_verification_constraints() NOT_CDS_RETURN;
   373   static void finalize_verification_constraints() NOT_CDS_RETURN;
   374   static void check_verification_constraints(InstanceKlass* klass,
   374   static void check_verification_constraints(InstanceKlass* klass,
   375                                               TRAPS) NOT_CDS_RETURN;
   375                                               TRAPS) NOT_CDS_RETURN;