< prev index next >

src/hotspot/share/classfile/systemDictionary.hpp

Print this page




 201   do_klass(LiveStackFrameInfo_klass,                    java_lang_LiveStackFrameInfo                          ) \
 202                                                                                                                 \
 203   /* support for stack dump lock analysis */                                                                    \
 204   do_klass(java_util_concurrent_locks_AbstractOwnableSynchronizer_klass, java_util_concurrent_locks_AbstractOwnableSynchronizer) \
 205                                                                                                                 \
 206   /* boxing klasses */                                                                                          \
 207   do_klass(Boolean_klass,                               java_lang_Boolean                                     ) \
 208   do_klass(Character_klass,                             java_lang_Character                                   ) \
 209   do_klass(Float_klass,                                 java_lang_Float                                       ) \
 210   do_klass(Double_klass,                                java_lang_Double                                      ) \
 211   do_klass(Byte_klass,                                  java_lang_Byte                                        ) \
 212   do_klass(Short_klass,                                 java_lang_Short                                       ) \
 213   do_klass(Integer_klass,                               java_lang_Integer                                     ) \
 214   do_klass(Long_klass,                                  java_lang_Long                                        ) \
 215                                                                                                                 \
 216   /* force inline of iterators */                                                                               \
 217   do_klass(Iterator_klass,                              java_util_Iterator                                    ) \
 218                                                                                                                 \
 219   /*end*/
 220 
 221 
 222 class SystemDictionary : AllStatic {
 223   friend class BootstrapInfo;
 224   friend class VMStructs;
 225   friend class SystemDictionaryHandles;
 226 
 227  public:
 228   enum WKID {
 229     NO_WKID = 0,
 230 
 231     #define WK_KLASS_ENUM(name, symbol) WK_KLASS_ENUM_NAME(name), WK_KLASS_ENUM_NAME(symbol) = WK_KLASS_ENUM_NAME(name),
 232     WK_KLASSES_DO(WK_KLASS_ENUM)
 233     #undef WK_KLASS_ENUM
 234 
 235     WKID_LIMIT,
 236 
 237     FIRST_WKID = NO_WKID + 1
 238   };
 239 
 240   // Returns a class with a given class name and class loader.  Loads the
 241   // class if needed. If not found a NoClassDefFoundError or a


 365 
 366   // Verification
 367   static void verify();
 368 
 369   // Initialization
 370   static void initialize(TRAPS);
 371 
 372   // Checked fast access to the well-known classes -- so that you don't try to use them
 373   // before they are resolved.
 374   static InstanceKlass* check_klass(InstanceKlass* k) {
 375     assert(k != NULL, "klass not loaded");
 376     return k;
 377   }
 378 
 379   static bool resolve_wk_klass(WKID id, TRAPS);
 380   static void resolve_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS);
 381   static void resolve_wk_klasses_through(WKID end_id, WKID &start_id, TRAPS) {
 382     int limit = (int)end_id + 1;
 383     resolve_wk_klasses_until((WKID) limit, start_id, THREAD);
 384   }
 385 

 386 public:
 387   #define WK_KLASS_DECLARE(name, symbol) \
 388     static InstanceKlass* name() { return check_klass(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); } \
 389     static InstanceKlass** name##_addr() {                                                              \
 390       return &_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)];                          \
 391     }                                                                                                   \
 392     static bool name##_is_loaded() {                                                                    \
 393       return _well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)] != NULL;                   \
 394     }
 395   WK_KLASSES_DO(WK_KLASS_DECLARE);
 396   #undef WK_KLASS_DECLARE
 397 
 398   static InstanceKlass* well_known_klass(WKID id) {
 399     assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
 400     return _well_known_klasses[id];
 401   }
 402 
 403   static InstanceKlass** well_known_klass_addr(WKID id) {
 404     assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
 405     return &_well_known_klasses[id];


 612   static bool is_system_class_loader(oop class_loader);
 613   static bool is_platform_class_loader(oop class_loader);
 614 
 615   // Returns TRUE if the method is a non-public member of class java.lang.Object.
 616   static bool is_nonpublic_Object_method(Method* m) {
 617     assert(m != NULL, "Unexpected NULL Method*");
 618     return !m->is_public() && m->method_holder() == SystemDictionary::Object_klass();
 619   }
 620 
 621 protected:
 622   // Setup link to hierarchy
 623   static void add_to_hierarchy(InstanceKlass* k, TRAPS);
 624 
 625   // Basic find on loaded classes
 626   static InstanceKlass* find_class(unsigned int hash,
 627                                    Symbol* name, Dictionary* dictionary);
 628   static InstanceKlass* find_class(Symbol* class_name, ClassLoaderData* loader_data);
 629 
 630   // Basic find on classes in the midst of being loaded
 631   static Symbol* find_placeholder(Symbol* name, ClassLoaderData* loader_data);
 632 
 633   // Add a placeholder for a class being loaded
 634   static void add_placeholder(int index,
 635                               Symbol* class_name,
 636                               ClassLoaderData* loader_data);
 637   static void remove_placeholder(int index,
 638                                  Symbol* class_name,
 639                                  ClassLoaderData* loader_data);
 640 
 641   // Performs cleanups after resolve_super_or_fail. This typically needs
 642   // to be called on failure.
 643   // Won't throw, but can block.
 644   static void resolution_cleanups(Symbol* class_name,
 645                                   ClassLoaderData* loader_data,
 646                                   TRAPS);
 647 
 648   // Resolve well-known classes so they can be used like SystemDictionary::String_klass()
 649   static void resolve_well_known_classes(TRAPS);
 650 
 651   // Class loader constraints
 652   static void check_constraints(unsigned int hash,
 653                                 InstanceKlass* k, Handle loader,
 654                                 bool defining, TRAPS);
 655   static void update_dictionary(unsigned int d_hash,
 656                                 int p_index, unsigned int p_hash,
 657                                 InstanceKlass* k, Handle loader,
 658                                 TRAPS);
 659 
 660   static InstanceKlass* _well_known_klasses[];
 661 
 662   // table of box klasses (int_klass, etc.)
 663   static InstanceKlass* _box_klasses[T_VOID+1];
 664 
 665 private:
 666   static oop  _java_system_loader;


 201   do_klass(LiveStackFrameInfo_klass,                    java_lang_LiveStackFrameInfo                          ) \
 202                                                                                                                 \
 203   /* support for stack dump lock analysis */                                                                    \
 204   do_klass(java_util_concurrent_locks_AbstractOwnableSynchronizer_klass, java_util_concurrent_locks_AbstractOwnableSynchronizer) \
 205                                                                                                                 \
 206   /* boxing klasses */                                                                                          \
 207   do_klass(Boolean_klass,                               java_lang_Boolean                                     ) \
 208   do_klass(Character_klass,                             java_lang_Character                                   ) \
 209   do_klass(Float_klass,                                 java_lang_Float                                       ) \
 210   do_klass(Double_klass,                                java_lang_Double                                      ) \
 211   do_klass(Byte_klass,                                  java_lang_Byte                                        ) \
 212   do_klass(Short_klass,                                 java_lang_Short                                       ) \
 213   do_klass(Integer_klass,                               java_lang_Integer                                     ) \
 214   do_klass(Long_klass,                                  java_lang_Long                                        ) \
 215                                                                                                                 \
 216   /* force inline of iterators */                                                                               \
 217   do_klass(Iterator_klass,                              java_util_Iterator                                    ) \
 218                                                                                                                 \
 219   /*end*/
 220 

 221 class SystemDictionary : AllStatic {
 222   friend class BootstrapInfo;
 223   friend class VMStructs;
 224   friend class SystemDictionaryHandles;
 225 
 226  public:
 227   enum WKID {
 228     NO_WKID = 0,
 229 
 230     #define WK_KLASS_ENUM(name, symbol) WK_KLASS_ENUM_NAME(name), WK_KLASS_ENUM_NAME(symbol) = WK_KLASS_ENUM_NAME(name),
 231     WK_KLASSES_DO(WK_KLASS_ENUM)
 232     #undef WK_KLASS_ENUM
 233 
 234     WKID_LIMIT,
 235 
 236     FIRST_WKID = NO_WKID + 1
 237   };
 238 
 239   // Returns a class with a given class name and class loader.  Loads the
 240   // class if needed. If not found a NoClassDefFoundError or a


 364 
 365   // Verification
 366   static void verify();
 367 
 368   // Initialization
 369   static void initialize(TRAPS);
 370 
 371   // Checked fast access to the well-known classes -- so that you don't try to use them
 372   // before they are resolved.
 373   static InstanceKlass* check_klass(InstanceKlass* k) {
 374     assert(k != NULL, "klass not loaded");
 375     return k;
 376   }
 377 
 378   static bool resolve_wk_klass(WKID id, TRAPS);
 379   static void resolve_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS);
 380   static void resolve_wk_klasses_through(WKID end_id, WKID &start_id, TRAPS) {
 381     int limit = (int)end_id + 1;
 382     resolve_wk_klasses_until((WKID) limit, start_id, THREAD);
 383   }
 384   static bool register_native(Klass* k, Symbol* name, Symbol* signature, address entry, TRAPS);
 385   static Method* find_prefixed_native(Klass* k, Symbol* name, Symbol* signature, TRAPS);
 386 public:
 387   #define WK_KLASS_DECLARE(name, symbol) \
 388     static InstanceKlass* name() { return check_klass(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); } \
 389     static InstanceKlass** name##_addr() {                                                              \
 390       return &_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)];                          \
 391     }                                                                                                   \
 392     static bool name##_is_loaded() {                                                                    \
 393       return _well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)] != NULL;                   \
 394     }
 395   WK_KLASSES_DO(WK_KLASS_DECLARE);
 396   #undef WK_KLASS_DECLARE
 397 
 398   static InstanceKlass* well_known_klass(WKID id) {
 399     assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
 400     return _well_known_klasses[id];
 401   }
 402 
 403   static InstanceKlass** well_known_klass_addr(WKID id) {
 404     assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
 405     return &_well_known_klasses[id];


 612   static bool is_system_class_loader(oop class_loader);
 613   static bool is_platform_class_loader(oop class_loader);
 614 
 615   // Returns TRUE if the method is a non-public member of class java.lang.Object.
 616   static bool is_nonpublic_Object_method(Method* m) {
 617     assert(m != NULL, "Unexpected NULL Method*");
 618     return !m->is_public() && m->method_holder() == SystemDictionary::Object_klass();
 619   }
 620 
 621 protected:
 622   // Setup link to hierarchy
 623   static void add_to_hierarchy(InstanceKlass* k, TRAPS);
 624 
 625   // Basic find on loaded classes
 626   static InstanceKlass* find_class(unsigned int hash,
 627                                    Symbol* name, Dictionary* dictionary);
 628   static InstanceKlass* find_class(Symbol* class_name, ClassLoaderData* loader_data);
 629 
 630   // Basic find on classes in the midst of being loaded
 631   static Symbol* find_placeholder(Symbol* name, ClassLoaderData* loader_data);















 632 
 633   // Resolve well-known classes so they can be used like SystemDictionary::String_klass()
 634   static void resolve_well_known_classes(TRAPS);
 635 
 636   // Class loader constraints
 637   static void check_constraints(unsigned int hash,
 638                                 InstanceKlass* k, Handle loader,
 639                                 bool defining, TRAPS);
 640   static void update_dictionary(unsigned int d_hash,
 641                                 int p_index, unsigned int p_hash,
 642                                 InstanceKlass* k, Handle loader,
 643                                 TRAPS);
 644 
 645   static InstanceKlass* _well_known_klasses[];
 646 
 647   // table of box klasses (int_klass, etc.)
 648   static InstanceKlass* _box_klasses[T_VOID+1];
 649 
 650 private:
 651   static oop  _java_system_loader;
< prev index next >