347 |
347 |
348 // Unload (that is, break root links to) all unmarked classes and |
348 // Unload (that is, break root links to) all unmarked classes and |
349 // loaders. Returns "true" iff something was unloaded. |
349 // loaders. Returns "true" iff something was unloaded. |
350 static bool do_unloading(GCTimer* gc_timer); |
350 static bool do_unloading(GCTimer* gc_timer); |
351 |
351 |
352 // Used by DumpSharedSpaces only to remove classes that failed verification |
|
353 static void remove_classes_in_error_state(); |
|
354 |
|
355 static int calculate_systemdictionary_size(int loadedclasses); |
|
356 |
|
357 // Applies "f->do_oop" to all root oops in the system dictionary. |
352 // Applies "f->do_oop" to all root oops in the system dictionary. |
358 static void oops_do(OopClosure* f); |
353 static void oops_do(OopClosure* f); |
359 |
354 |
360 // System loader lock |
355 // System loader lock |
361 static oop system_loader_lock() { return _system_loader_lock_obj; } |
356 static oop system_loader_lock() { return _system_loader_lock_obj; } |
362 |
357 |
363 // Protection Domain Table |
358 // Protection Domain Table |
364 static ProtectionDomainCacheTable* pd_cache_table() { return _pd_cache_table; } |
359 static ProtectionDomainCacheTable* pd_cache_table() { return _pd_cache_table; } |
365 |
360 |
366 public: |
361 public: |
367 // Sharing support. |
|
368 static void reorder_dictionary_for_sharing() NOT_CDS_RETURN; |
|
369 static void combine_shared_dictionaries(); |
|
370 static size_t count_bytes_for_buckets(); |
|
371 static size_t count_bytes_for_table(); |
|
372 static void copy_buckets(char* top, char* end); |
|
373 static void copy_table(char* top, char* end); |
|
374 static void set_shared_dictionary(HashtableBucket<mtClass>* t, int length, |
|
375 int number_of_entries); |
|
376 // Printing |
362 // Printing |
377 static void print() { return print_on(tty); } |
363 static void print() { return print_on(tty); } |
378 static void print_on(outputStream* st); |
364 static void print_on(outputStream* st); |
379 static void print_shared(outputStream* st); |
|
380 static void dump(outputStream* st, bool verbose); |
365 static void dump(outputStream* st, bool verbose); |
381 |
366 |
382 // Monotonically increasing counter which grows as classes are |
367 // Monotonically increasing counter which grows as classes are |
383 // loaded or modifications such as hot-swapping or setting/removing |
368 // loaded or modifications such as hot-swapping or setting/removing |
384 // of breakpoints are performed |
369 // of breakpoints are performed |
577 |
562 |
578 enum Constants { |
563 enum Constants { |
579 _loader_constraint_size = 107, // number of entries in constraint table |
564 _loader_constraint_size = 107, // number of entries in constraint table |
580 _resolution_error_size = 107, // number of entries in resolution error table |
565 _resolution_error_size = 107, // number of entries in resolution error table |
581 _invoke_method_size = 139, // number of entries in invoke method table |
566 _invoke_method_size = 139, // number of entries in invoke method table |
582 _shared_dictionary_size = 1009, // number of entries in shared dictionary |
|
583 _placeholder_table_size = 1009 // number of entries in hash table for placeholders |
567 _placeholder_table_size = 1009 // number of entries in hash table for placeholders |
584 }; |
568 }; |
585 |
569 |
586 |
570 |
587 // Static tables owned by the SystemDictionary |
571 // Static tables owned by the SystemDictionary |
588 |
572 |
589 // Hashtable holding placeholders for classes being loaded. |
573 // Hashtable holding placeholders for classes being loaded. |
590 static PlaceholderTable* _placeholders; |
574 static PlaceholderTable* _placeholders; |
591 |
|
592 // Hashtable holding classes from the shared archive. |
|
593 static Dictionary* _shared_dictionary; |
|
594 |
575 |
595 // Monotonically increasing counter which grows with |
576 // Monotonically increasing counter which grows with |
596 // loading classes as well as hot-swapping and breakpoint setting |
577 // loading classes as well as hot-swapping and breakpoint setting |
597 // and removal. |
578 // and removal. |
598 static int _number_of_modifications; |
579 static int _number_of_modifications; |
620 Handle class_loader, |
601 Handle class_loader, |
621 Handle protection_domain, TRAPS); |
602 Handle protection_domain, TRAPS); |
622 |
603 |
623 friend class VM_PopulateDumpSharedSpace; |
604 friend class VM_PopulateDumpSharedSpace; |
624 friend class TraversePlaceholdersClosure; |
605 friend class TraversePlaceholdersClosure; |
625 static Dictionary* shared_dictionary() { return _shared_dictionary; } |
|
626 static PlaceholderTable* placeholders() { return _placeholders; } |
606 static PlaceholderTable* placeholders() { return _placeholders; } |
627 static LoaderConstraintTable* constraints() { return _loader_constraints; } |
607 static LoaderConstraintTable* constraints() { return _loader_constraints; } |
628 static ResolutionErrorTable* resolution_errors() { return _resolution_errors; } |
608 static ResolutionErrorTable* resolution_errors() { return _resolution_errors; } |
629 static SymbolPropertyTable* invoke_method_table() { return _invoke_method_table; } |
609 static SymbolPropertyTable* invoke_method_table() { return _invoke_method_table; } |
630 |
610 |
660 static bool is_parallelDefine(Handle class_loader); |
640 static bool is_parallelDefine(Handle class_loader); |
661 |
641 |
662 public: |
642 public: |
663 static bool is_system_class_loader(oop class_loader); |
643 static bool is_system_class_loader(oop class_loader); |
664 static bool is_platform_class_loader(oop class_loader); |
644 static bool is_platform_class_loader(oop class_loader); |
665 static void clear_invoke_method_table(); |
|
666 |
645 |
667 // Returns TRUE if the method is a non-public member of class java.lang.Object. |
646 // Returns TRUE if the method is a non-public member of class java.lang.Object. |
668 static bool is_nonpublic_Object_method(Method* m) { |
647 static bool is_nonpublic_Object_method(Method* m) { |
669 assert(m != NULL, "Unexpected NULL Method*"); |
648 assert(m != NULL, "Unexpected NULL Method*"); |
670 return !m->is_public() && m->method_holder() == SystemDictionary::Object_klass(); |
649 return !m->is_public() && m->method_holder() == SystemDictionary::Object_klass(); |
672 |
651 |
673 static void initialize_oop_storage(); |
652 static void initialize_oop_storage(); |
674 static OopStorage* vm_weak_oop_storage(); |
653 static OopStorage* vm_weak_oop_storage(); |
675 |
654 |
676 protected: |
655 protected: |
677 static InstanceKlass* find_shared_class(Symbol* class_name); |
|
678 |
|
679 // Setup link to hierarchy |
656 // Setup link to hierarchy |
680 static void add_to_hierarchy(InstanceKlass* k, TRAPS); |
657 static void add_to_hierarchy(InstanceKlass* k, TRAPS); |
681 |
658 |
682 // Basic find on loaded classes |
659 // Basic find on loaded classes |
683 static InstanceKlass* find_class(unsigned int hash, |
660 static InstanceKlass* find_class(unsigned int hash, |