< prev index next >

src/share/vm/classfile/systemDictionary.hpp

Print this page


 339   //   1. No query has yet been made to the class loader.
 340   //   2. The class loader was queried, but chose not to delegate.
 341   //   3. ClassLoader.checkPackageAccess rejected a proposed protection domain.
 342   //   4. Loading was attempted, but there was a linkage error of some sort.
 343   // In all of these cases, the loader constraints on this type are
 344   // satisfied, and it is safe for classes in the given class loader
 345   // to manipulate strongly-typed values of the found class, subject
 346   // to local linkage and access checks.
 347   static Klass* find_constrained_instance_or_array_klass(Symbol* class_name,
 348                                                            Handle class_loader,
 349                                                            TRAPS);
 350 
 351   // Iterate over all klasses in dictionary
 352   // Just the classes from defining class loaders
 353   static void classes_do(void f(Klass*));
 354   // Added for initialize_itable_for_klass to handle exceptions
 355   static void classes_do(void f(Klass*, TRAPS), TRAPS);
 356   // All classes, and their class loaders, including initiating class loaders
 357   static void classes_do(void f(Klass*, ClassLoaderData*));
 358 

 359   // Iterate over all methods in all klasses

 360   static void methods_do(void f(Method*));
 361 
 362   // Garbage collection support
 363 
 364   // This method applies "blk->do_oop" to all the pointers to "system"
 365   // classes and loaders.
 366   static void always_strong_oops_do(OopClosure* blk);
 367 
 368   // Unload (that is, break root links to) all unmarked classes and
 369   // loaders.  Returns "true" iff something was unloaded.
 370   static bool do_unloading(BoolObjectClosure* is_alive,
 371                            GCTimer* gc_timer,
 372                            bool do_cleaning = true);
 373 
 374   // Used by DumpSharedSpaces only to remove classes that failed verification
 375   static void remove_classes_in_error_state();
 376 
 377   static int calculate_systemdictionary_size(int loadedclasses);
 378 
 379   // Applies "f->do_oop" to all root oops in the system dictionary.
 380   static void oops_do(OopClosure* f);
 381   static void roots_oops_do(OopClosure* strong, OopClosure* weak);
 382 
 383   // System loader lock
 384   static oop system_loader_lock()           { return _system_loader_lock_obj; }
 385 
 386 public:
 387   // Sharing support.
 388   static void reorder_dictionary();
 389   static void copy_buckets(char** top, char* end);
 390   static void copy_table(char** top, char* end);


 391   static void set_shared_dictionary(HashtableBucket<mtClass>* t, int length,
 392                                     int number_of_entries);
 393   // Printing
 394   static void print(bool details = true);
 395   static void print_shared(bool details = true);
 396 
 397   // Number of contained klasses
 398   // This is both fully loaded classes and classes in the process
 399   // of being loaded
 400   static int number_of_classes();
 401 
 402   // Monotonically increasing counter which grows as classes are
 403   // loaded or modifications such as hot-swapping or setting/removing
 404   // of breakpoints are performed
 405   static inline int number_of_modifications()     { assert_locked_or_safepoint(Compile_lock); return _number_of_modifications; }
 406   // Needed by evolution and breakpoint code
 407   static inline void notice_modification()        { assert_locked_or_safepoint(Compile_lock); ++_number_of_modifications;      }
 408 
 409   // Verification
 410   static void verify();


 431   }
 432 
 433 public:
 434   #define WK_KLASS_DECLARE(name, symbol, option) \
 435     static InstanceKlass* name() { return check_klass_##option(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); } \
 436     static InstanceKlass** name##_addr() {                                                                       \
 437       return &SystemDictionary::_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)];           \
 438     }
 439   WK_KLASSES_DO(WK_KLASS_DECLARE);
 440   #undef WK_KLASS_DECLARE
 441 
 442   static InstanceKlass* well_known_klass(WKID id) {
 443     assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
 444     return _well_known_klasses[id];
 445   }
 446 
 447   static InstanceKlass** well_known_klass_addr(WKID id) {
 448     assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
 449     return &_well_known_klasses[id];
 450   }

 451 
 452   // Local definition for direct access to the private array:
 453   #define WK_KLASS(name) _well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]
 454 
 455   static InstanceKlass* box_klass(BasicType t) {
 456     assert((uint)t < T_VOID+1, "range check");
 457     return check_klass(_box_klasses[t]);
 458   }
 459   static BasicType box_klass_type(Klass* k);  // inverse of box_klass
 460 
 461   // methods returning lazily loaded klasses
 462   // The corresponding method to load the class must be called before calling them.
 463   static InstanceKlass* abstract_ownable_synchronizer_klass() { return check_klass(_abstract_ownable_synchronizer_klass); }
 464 
 465   static void load_abstract_ownable_synchronizer_klass(TRAPS);
 466 
 467 protected:
 468   // Tells whether ClassLoader.loadClassInternal is present
 469   static bool has_loadClassInternal()       { return _has_loadClassInternal; }
 470 




 339   //   1. No query has yet been made to the class loader.
 340   //   2. The class loader was queried, but chose not to delegate.
 341   //   3. ClassLoader.checkPackageAccess rejected a proposed protection domain.
 342   //   4. Loading was attempted, but there was a linkage error of some sort.
 343   // In all of these cases, the loader constraints on this type are
 344   // satisfied, and it is safe for classes in the given class loader
 345   // to manipulate strongly-typed values of the found class, subject
 346   // to local linkage and access checks.
 347   static Klass* find_constrained_instance_or_array_klass(Symbol* class_name,
 348                                                            Handle class_loader,
 349                                                            TRAPS);
 350 
 351   // Iterate over all klasses in dictionary
 352   // Just the classes from defining class loaders
 353   static void classes_do(void f(Klass*));
 354   // Added for initialize_itable_for_klass to handle exceptions
 355   static void classes_do(void f(Klass*, TRAPS), TRAPS);
 356   // All classes, and their class loaders, including initiating class loaders
 357   static void classes_do(void f(Klass*, ClassLoaderData*));
 358 
 359   static void classes_do(MetaspaceClosure* it);
 360   // Iterate over all methods in all klasses
 361 
 362   static void methods_do(void f(Method*));
 363 
 364   // Garbage collection support
 365 
 366   // This method applies "blk->do_oop" to all the pointers to "system"
 367   // classes and loaders.
 368   static void always_strong_oops_do(OopClosure* blk);
 369 
 370   // Unload (that is, break root links to) all unmarked classes and
 371   // loaders.  Returns "true" iff something was unloaded.
 372   static bool do_unloading(BoolObjectClosure* is_alive,
 373                            GCTimer* gc_timer,
 374                            bool do_cleaning = true);
 375 
 376   // Used by DumpSharedSpaces only to remove classes that failed verification
 377   static void remove_classes_in_error_state();
 378 
 379   static int calculate_systemdictionary_size(int loadedclasses);
 380 
 381   // Applies "f->do_oop" to all root oops in the system dictionary.
 382   static void oops_do(OopClosure* f);
 383   static void roots_oops_do(OopClosure* strong, OopClosure* weak);
 384 
 385   // System loader lock
 386   static oop system_loader_lock()           { return _system_loader_lock_obj; }
 387 
 388 public:
 389   // Sharing support.
 390   static void reorder_dictionary_for_sharing();
 391   static size_t count_bytes_for_buckets();
 392   static size_t count_bytes_for_table();
 393   static void copy_buckets(char* top, char* end);
 394   static void copy_table(char* top, char* end);
 395   static void set_shared_dictionary(HashtableBucket<mtClass>* t, int length,
 396                                     int number_of_entries);
 397   // Printing
 398   static void print(bool details = true);
 399   static void print_shared(bool details = true);
 400 
 401   // Number of contained klasses
 402   // This is both fully loaded classes and classes in the process
 403   // of being loaded
 404   static int number_of_classes();
 405 
 406   // Monotonically increasing counter which grows as classes are
 407   // loaded or modifications such as hot-swapping or setting/removing
 408   // of breakpoints are performed
 409   static inline int number_of_modifications()     { assert_locked_or_safepoint(Compile_lock); return _number_of_modifications; }
 410   // Needed by evolution and breakpoint code
 411   static inline void notice_modification()        { assert_locked_or_safepoint(Compile_lock); ++_number_of_modifications;      }
 412 
 413   // Verification
 414   static void verify();


 435   }
 436 
 437 public:
 438   #define WK_KLASS_DECLARE(name, symbol, option) \
 439     static InstanceKlass* name() { return check_klass_##option(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); } \
 440     static InstanceKlass** name##_addr() {                                                                       \
 441       return &SystemDictionary::_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)];           \
 442     }
 443   WK_KLASSES_DO(WK_KLASS_DECLARE);
 444   #undef WK_KLASS_DECLARE
 445 
 446   static InstanceKlass* well_known_klass(WKID id) {
 447     assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
 448     return _well_known_klasses[id];
 449   }
 450 
 451   static InstanceKlass** well_known_klass_addr(WKID id) {
 452     assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
 453     return &_well_known_klasses[id];
 454   }
 455   static void well_known_klasses_do(MetaspaceClosure* it);
 456 
 457   // Local definition for direct access to the private array:
 458   #define WK_KLASS(name) _well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]
 459 
 460   static InstanceKlass* box_klass(BasicType t) {
 461     assert((uint)t < T_VOID+1, "range check");
 462     return check_klass(_box_klasses[t]);
 463   }
 464   static BasicType box_klass_type(Klass* k);  // inverse of box_klass
 465 
 466   // methods returning lazily loaded klasses
 467   // The corresponding method to load the class must be called before calling them.
 468   static InstanceKlass* abstract_ownable_synchronizer_klass() { return check_klass(_abstract_ownable_synchronizer_klass); }
 469 
 470   static void load_abstract_ownable_synchronizer_klass(TRAPS);
 471 
 472 protected:
 473   // Tells whether ClassLoader.loadClassInternal is present
 474   static bool has_loadClassInternal()       { return _has_loadClassInternal; }
 475 


< prev index next >