author | dholmes |
Tue, 09 Oct 2018 20:38:13 -0400 | |
changeset 52067 | 2e72562697bf |
parent 52014 | 1aa9beac610e |
child 52498 | c3066f7465fa |
permissions | -rw-r--r-- |
51959
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
1 |
/* |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
4 |
* |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
8 |
* |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
13 |
* accompanied this code). |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
14 |
* |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
18 |
* |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
21 |
* questions. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
22 |
* |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
23 |
*/ |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
24 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
25 |
#ifndef SHARE_VM_CLASSFILE_CLASSLOADERDATAGRAPH_HPP |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
26 |
#define SHARE_VM_CLASSFILE_CLASSLOADERDATAGRAPH_HPP |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
27 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
28 |
#include "classfile/classLoaderData.hpp" |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
29 |
#include "memory/allocation.hpp" |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
30 |
#include "utilities/growableArray.hpp" |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
31 |
#include "utilities/macros.hpp" |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
32 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
33 |
// GC root for walking class loader data created |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
34 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
35 |
class ClassLoaderDataGraph : public AllStatic { |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
36 |
friend class ClassLoaderData; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
37 |
friend class ClassLoaderDataGraphMetaspaceIterator; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
38 |
friend class ClassLoaderDataGraphKlassIteratorAtomic; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
39 |
friend class ClassLoaderDataGraphKlassIteratorStatic; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
40 |
friend class ClassLoaderDataGraphIterator; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
41 |
friend class VMStructs; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
42 |
private: |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
43 |
// All CLDs (except the null CLD) can be reached by walking _head->_next->... |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
44 |
static ClassLoaderData* _head; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
45 |
static ClassLoaderData* _unloading; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
46 |
// CMS support. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
47 |
static ClassLoaderData* _saved_head; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
48 |
static ClassLoaderData* _saved_unloading; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
49 |
static bool _should_purge; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
50 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
51 |
// Set if there's anything to purge in the deallocate lists or previous versions |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
52 |
// during a safepoint after class unloading in a full GC. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
53 |
static bool _should_clean_deallocate_lists; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
54 |
static bool _safepoint_cleanup_needed; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
55 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
56 |
// OOM has been seen in metaspace allocation. Used to prevent some |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
57 |
// allocations until class unloading |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
58 |
static bool _metaspace_oom; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
59 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
60 |
static volatile size_t _num_instance_classes; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
61 |
static volatile size_t _num_array_classes; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
62 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
63 |
static ClassLoaderData* add_to_graph(Handle class_loader, bool is_unsafe_anonymous); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
64 |
static ClassLoaderData* add(Handle class_loader, bool is_unsafe_anonymous); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
65 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
66 |
public: |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
67 |
static ClassLoaderData* find_or_create(Handle class_loader); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
68 |
static void clean_module_and_package_info(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
69 |
static void purge(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
70 |
static void clear_claimed_marks(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
71 |
// Iteration through CLDG inside a safepoint; GC support |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
72 |
static void cld_do(CLDClosure* cl); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
73 |
static void cld_unloading_do(CLDClosure* cl); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
74 |
static void roots_cld_do(CLDClosure* strong, CLDClosure* weak); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
75 |
static void always_strong_cld_do(CLDClosure* cl); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
76 |
// klass do |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
77 |
// Walking classes through the ClassLoaderDataGraph include array classes. It also includes |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
78 |
// classes that are allocated but not loaded, classes that have errors, and scratch classes |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
79 |
// for redefinition. These classes are removed during the next class unloading. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
80 |
// Walking the ClassLoaderDataGraph also includes unsafe anonymous classes. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
81 |
static void classes_do(KlassClosure* klass_closure); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
82 |
static void classes_do(void f(Klass* const)); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
83 |
static void methods_do(void f(Method*)); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
84 |
static void modules_do(void f(ModuleEntry*)); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
85 |
static void modules_unloading_do(void f(ModuleEntry*)); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
86 |
static void packages_do(void f(PackageEntry*)); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
87 |
static void packages_unloading_do(void f(PackageEntry*)); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
88 |
static void loaded_classes_do(KlassClosure* klass_closure); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
89 |
static void unlocked_loaded_classes_do(KlassClosure* klass_closure); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
90 |
static void classes_unloading_do(void f(Klass* const)); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
91 |
static bool do_unloading(bool do_cleaning); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
92 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
93 |
// Expose state to avoid logging overhead in safepoint cleanup tasks. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
94 |
static inline bool should_clean_metaspaces_and_reset(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
95 |
static void set_should_clean_deallocate_lists() { _should_clean_deallocate_lists = true; } |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
96 |
static void clean_deallocate_lists(bool purge_previous_versions); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
97 |
static void walk_metadata_and_clean_metaspaces(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
98 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
99 |
// dictionary do |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
100 |
// Iterate over all klasses in dictionary, but |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
101 |
// just the classes from defining class loaders. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
102 |
static void dictionary_classes_do(void f(InstanceKlass*)); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
103 |
// Added for initialize_itable_for_klass to handle exceptions. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
104 |
static void dictionary_classes_do(void f(InstanceKlass*, TRAPS), TRAPS); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
105 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
106 |
// VM_CounterDecay iteration support |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
107 |
static InstanceKlass* try_get_next_class(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
108 |
static void adjust_saved_class(ClassLoaderData* cld); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
109 |
static void adjust_saved_class(Klass* klass); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
110 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
111 |
static void verify_dictionary(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
112 |
static void print_dictionary(outputStream* st); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
113 |
static void print_dictionary_statistics(outputStream* st); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
114 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
115 |
// CMS support. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
116 |
static void remember_new_clds(bool remember) { _saved_head = (remember ? _head : NULL); } |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
117 |
static GrowableArray<ClassLoaderData*>* new_clds(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
118 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
119 |
static void set_should_purge(bool b) { _should_purge = b; } |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
120 |
static void purge_if_needed() { |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
121 |
// Only purge the CLDG for CMS if concurrent sweep is complete. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
122 |
if (_should_purge) { |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
123 |
purge(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
124 |
// reset for next time. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
125 |
set_should_purge(false); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
126 |
} |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
127 |
} |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
128 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
129 |
static int resize_if_needed(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
130 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
131 |
static bool has_metaspace_oom() { return _metaspace_oom; } |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
132 |
static void set_metaspace_oom(bool value) { _metaspace_oom = value; } |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
133 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
134 |
static void print_on(outputStream * const out) PRODUCT_RETURN; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
135 |
static void print() { print_on(tty); } |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
136 |
static void verify(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
137 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
138 |
// instance and array class counters |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
139 |
static inline size_t num_instance_classes(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
140 |
static inline size_t num_array_classes(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
141 |
static inline void inc_instance_classes(size_t count); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
142 |
static inline void dec_instance_classes(size_t count); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
143 |
static inline void inc_array_classes(size_t count); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
144 |
static inline void dec_array_classes(size_t count); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
145 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
146 |
#ifndef PRODUCT |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
147 |
static bool contains_loader_data(ClassLoaderData* loader_data); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
148 |
#endif |
52014
1aa9beac610e
8210754: print_location is not reliable enough (printing register info)
mdoerr
parents:
51959
diff
changeset
|
149 |
|
1aa9beac610e
8210754: print_location is not reliable enough (printing register info)
mdoerr
parents:
51959
diff
changeset
|
150 |
// Check if ClassLoaderData is part of the ClassLoaderDataGraph (not unloaded) |
1aa9beac610e
8210754: print_location is not reliable enough (printing register info)
mdoerr
parents:
51959
diff
changeset
|
151 |
// Usage without lock only allowed during error reporting. |
1aa9beac610e
8210754: print_location is not reliable enough (printing register info)
mdoerr
parents:
51959
diff
changeset
|
152 |
static bool is_valid(ClassLoaderData* loader_data); |
51959
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
153 |
}; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
154 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
155 |
class LockedClassesDo : public KlassClosure { |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
156 |
typedef void (*classes_do_func_t)(Klass*); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
157 |
classes_do_func_t _function; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
158 |
public: |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
159 |
LockedClassesDo(); // For callers who provide their own do_klass |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
160 |
LockedClassesDo(classes_do_func_t function); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
161 |
~LockedClassesDo(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
162 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
163 |
void do_klass(Klass* k) { |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
164 |
(*_function)(k); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
165 |
} |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
166 |
}; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
167 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
168 |
// An iterator that distributes Klasses to parallel worker threads. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
169 |
class ClassLoaderDataGraphKlassIteratorAtomic : public StackObj { |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
170 |
Klass* volatile _next_klass; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
171 |
public: |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
172 |
ClassLoaderDataGraphKlassIteratorAtomic(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
173 |
Klass* next_klass(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
174 |
private: |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
175 |
static Klass* next_klass_in_cldg(Klass* klass); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
176 |
}; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
177 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
178 |
class ClassLoaderDataGraphMetaspaceIterator : public StackObj { |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
179 |
ClassLoaderData* _data; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
180 |
public: |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
181 |
ClassLoaderDataGraphMetaspaceIterator(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
182 |
~ClassLoaderDataGraphMetaspaceIterator(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
183 |
bool repeat() { return _data != NULL; } |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
184 |
ClassLoaderMetaspace* get_next(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
185 |
}; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
186 |
#endif // SHARE_VM_CLASSFILE_CLASSLOADERDATAGRAPH_HPP |