53 ClassLoaderData* loader_data = class_loader_data_or_null(loader); |
53 ClassLoaderData* loader_data = class_loader_data_or_null(loader); |
54 assert(loader_data != NULL, "Must be"); |
54 assert(loader_data != NULL, "Must be"); |
55 return loader_data; |
55 return loader_data; |
56 } |
56 } |
57 |
57 |
58 |
|
59 inline ClassLoaderData *ClassLoaderDataGraph::find_or_create(Handle loader) { |
|
60 guarantee(loader() != NULL && oopDesc::is_oop(loader()), "Loader must be oop"); |
|
61 // Gets the class loader data out of the java/lang/ClassLoader object, if non-null |
|
62 // it's already in the loader_data, so no need to add |
|
63 ClassLoaderData* loader_data= java_lang_ClassLoader::loader_data_acquire(loader()); |
|
64 if (loader_data) { |
|
65 return loader_data; |
|
66 } |
|
67 return ClassLoaderDataGraph::add(loader, false); |
|
68 } |
|
69 |
|
70 size_t ClassLoaderDataGraph::num_instance_classes() { |
|
71 return _num_instance_classes; |
|
72 } |
|
73 |
|
74 size_t ClassLoaderDataGraph::num_array_classes() { |
|
75 return _num_array_classes; |
|
76 } |
|
77 |
|
78 void ClassLoaderDataGraph::inc_instance_classes(size_t count) { |
|
79 Atomic::add(count, &_num_instance_classes); |
|
80 } |
|
81 |
|
82 void ClassLoaderDataGraph::dec_instance_classes(size_t count) { |
|
83 assert(count <= _num_instance_classes, "Sanity"); |
|
84 Atomic::sub(count, &_num_instance_classes); |
|
85 } |
|
86 |
|
87 void ClassLoaderDataGraph::inc_array_classes(size_t count) { |
|
88 Atomic::add(count, &_num_array_classes); |
|
89 } |
|
90 |
|
91 void ClassLoaderDataGraph::dec_array_classes(size_t count) { |
|
92 assert(count <= _num_array_classes, "Sanity"); |
|
93 Atomic::sub(count, &_num_array_classes); |
|
94 } |
|
95 |
|
96 bool ClassLoaderDataGraph::should_clean_metaspaces_and_reset() { |
|
97 // Only clean metaspaces after full GC. |
|
98 bool do_cleaning = _safepoint_cleanup_needed; |
|
99 #if INCLUDE_JVMTI |
|
100 do_cleaning = do_cleaning && (_should_clean_deallocate_lists || InstanceKlass::has_previous_versions()); |
|
101 #else |
|
102 do_cleaning = do_cleaning && _should_clean_deallocate_lists; |
|
103 #endif |
|
104 _safepoint_cleanup_needed = false; // reset |
|
105 return do_cleaning; |
|
106 } |
|
107 |
|
108 #endif // SHARE_VM_CLASSFILE_CLASSLOADERDATA_INLINE_HPP |
58 #endif // SHARE_VM_CLASSFILE_CLASSLOADERDATA_INLINE_HPP |