equal
deleted
inserted
replaced
42 #include "classfile/systemDictionary.hpp" |
42 #include "classfile/systemDictionary.hpp" |
43 #include "classfile/vmSymbols.hpp" |
43 #include "classfile/vmSymbols.hpp" |
44 #include "code/codeCache.hpp" |
44 #include "code/codeCache.hpp" |
45 #include "compiler/compileBroker.hpp" |
45 #include "compiler/compileBroker.hpp" |
46 #include "gc/shared/gcTraceTime.inline.hpp" |
46 #include "gc/shared/gcTraceTime.inline.hpp" |
|
47 #include "gc/shared/oopStorage.inline.hpp" |
47 #include "interpreter/bytecodeStream.hpp" |
48 #include "interpreter/bytecodeStream.hpp" |
48 #include "interpreter/interpreter.hpp" |
49 #include "interpreter/interpreter.hpp" |
49 #include "logging/log.hpp" |
50 #include "logging/log.hpp" |
50 #include "logging/logStream.hpp" |
51 #include "logging/logStream.hpp" |
51 #include "memory/filemap.hpp" |
52 #include "memory/filemap.hpp" |
114 InstanceKlass* volatile SystemDictionary::_abstract_ownable_synchronizer_klass = NULL; |
115 InstanceKlass* volatile SystemDictionary::_abstract_ownable_synchronizer_klass = NULL; |
115 |
116 |
116 // Default ProtectionDomainCacheSize value |
117 // Default ProtectionDomainCacheSize value |
117 |
118 |
118 const int defaultProtectionDomainCacheSize = 1009; |
119 const int defaultProtectionDomainCacheSize = 1009; |
|
120 |
|
121 OopStorage* SystemDictionary::_vm_weak_oop_storage = NULL; |
119 |
122 |
120 |
123 |
121 // ---------------------------------------------------------------------------- |
124 // ---------------------------------------------------------------------------- |
122 // Java-level SystemLoader and PlatformLoader |
125 // Java-level SystemLoader and PlatformLoader |
123 |
126 |
1010 host_klass, |
1013 host_klass, |
1011 cp_patches, |
1014 cp_patches, |
1012 CHECK_NULL); |
1015 CHECK_NULL); |
1013 |
1016 |
1014 if (host_klass != NULL && k != NULL) { |
1017 if (host_klass != NULL && k != NULL) { |
1015 // If it's anonymous, initialize it now, since nobody else will. |
1018 // Anonymous classes must update ClassLoaderData holder (was host_klass loader) |
|
1019 // so that they can be unloaded when the mirror is no longer referenced. |
|
1020 k->class_loader_data()->initialize_holder(Handle(THREAD, k->java_mirror())); |
1016 |
1021 |
1017 { |
1022 { |
1018 MutexLocker mu_r(Compile_lock, THREAD); |
1023 MutexLocker mu_r(Compile_lock, THREAD); |
1019 |
1024 |
1020 // Add to class hierarchy, initialize vtables, and do possible |
1025 // Add to class hierarchy, initialize vtables, and do possible |
1030 // Rewrite and patch constant pool here. |
1035 // Rewrite and patch constant pool here. |
1031 k->link_class(CHECK_NULL); |
1036 k->link_class(CHECK_NULL); |
1032 if (cp_patches != NULL) { |
1037 if (cp_patches != NULL) { |
1033 k->constants()->patch_resolved_references(cp_patches); |
1038 k->constants()->patch_resolved_references(cp_patches); |
1034 } |
1039 } |
|
1040 |
|
1041 // If it's anonymous, initialize it now, since nobody else will. |
1035 k->eager_initialize(CHECK_NULL); |
1042 k->eager_initialize(CHECK_NULL); |
1036 |
1043 |
1037 // notify jvmti |
1044 // notify jvmti |
1038 if (JvmtiExport::should_post_class_load()) { |
1045 if (JvmtiExport::should_post_class_load()) { |
1039 assert(THREAD->is_Java_thread(), "thread->is_Java_thread()"); |
1046 assert(THREAD->is_Java_thread(), "thread->is_Java_thread()"); |
1846 // Note: anonymous classes are not in the SD. |
1853 // Note: anonymous classes are not in the SD. |
1847 bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive, |
1854 bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive, |
1848 GCTimer* gc_timer, |
1855 GCTimer* gc_timer, |
1849 bool do_cleaning) { |
1856 bool do_cleaning) { |
1850 |
1857 |
|
1858 { |
|
1859 GCTraceTime(Debug, gc, phases) t("SystemDictionary WeakHandle cleaning", gc_timer); |
|
1860 vm_weak_oop_storage()->weak_oops_do(is_alive, &do_nothing_cl); |
|
1861 } |
1851 |
1862 |
1852 bool unloading_occurred; |
1863 bool unloading_occurred; |
1853 { |
1864 { |
1854 GCTraceTime(Debug, gc, phases) t("ClassLoaderData", gc_timer); |
1865 GCTraceTime(Debug, gc, phases) t("ClassLoaderData", gc_timer); |
1855 |
1866 |
1894 // Do strong roots marking if the closures are the same. |
1905 // Do strong roots marking if the closures are the same. |
1895 if (strong == weak || !ClassUnloading) { |
1906 if (strong == weak || !ClassUnloading) { |
1896 // Only the protection domain oops contain references into the heap. Iterate |
1907 // Only the protection domain oops contain references into the heap. Iterate |
1897 // over all of them. |
1908 // over all of them. |
1898 _pd_cache_table->oops_do(strong); |
1909 _pd_cache_table->oops_do(strong); |
|
1910 vm_weak_oop_storage()->oops_do(strong); |
1899 } else { |
1911 } else { |
1900 if (weak != NULL) { |
1912 if (weak != NULL) { |
1901 _pd_cache_table->oops_do(weak); |
1913 _pd_cache_table->oops_do(weak); |
|
1914 vm_weak_oop_storage()->oops_do(weak); |
1902 } |
1915 } |
1903 } |
1916 } |
1904 |
1917 |
1905 // Visit extra methods |
1918 // Visit extra methods |
1906 invoke_method_table()->oops_do(strong); |
1919 invoke_method_table()->oops_do(strong); |
1922 |
1935 |
1923 // Visit extra methods |
1936 // Visit extra methods |
1924 invoke_method_table()->oops_do(f); |
1937 invoke_method_table()->oops_do(f); |
1925 |
1938 |
1926 ResolvedMethodTable::oops_do(f); |
1939 ResolvedMethodTable::oops_do(f); |
|
1940 |
|
1941 vm_weak_oop_storage()->oops_do(f); |
1927 } |
1942 } |
1928 |
1943 |
1929 // CDS: scan and relocate all classes in the system dictionary. |
1944 // CDS: scan and relocate all classes in the system dictionary. |
1930 void SystemDictionary::classes_do(MetaspaceClosure* it) { |
1945 void SystemDictionary::classes_do(MetaspaceClosure* it) { |
1931 ClassLoaderData::the_null_class_loader_data()->dictionary()->classes_do(it); |
1946 ClassLoaderData::the_null_class_loader_data()->dictionary()->classes_do(it); |
3103 // caller needs ResourceMark |
3118 // caller needs ResourceMark |
3104 const char* SystemDictionary::loader_name(const ClassLoaderData* loader_data) { |
3119 const char* SystemDictionary::loader_name(const ClassLoaderData* loader_data) { |
3105 return (loader_data->class_loader() == NULL ? "<bootloader>" : |
3120 return (loader_data->class_loader() == NULL ? "<bootloader>" : |
3106 SystemDictionary::loader_name(loader_data->class_loader())); |
3121 SystemDictionary::loader_name(loader_data->class_loader())); |
3107 } |
3122 } |
|
3123 |
|
3124 void SystemDictionary::initialize_oop_storage() { |
|
3125 _vm_weak_oop_storage = |
|
3126 new OopStorage("VM Weak Oop Handles", |
|
3127 VMWeakAlloc_lock, |
|
3128 VMWeakActive_lock); |
|
3129 } |
|
3130 |
|
3131 OopStorage* SystemDictionary::vm_weak_oop_storage() { |
|
3132 assert(_vm_weak_oop_storage != NULL, "Uninitialized"); |
|
3133 return _vm_weak_oop_storage; |
|
3134 } |