author | naoto |
Tue, 09 Jul 2019 08:05:38 -0700 | |
changeset 55627 | 9c1885fb2a42 |
parent 55603 | 3868dde58ebb |
child 58063 | bdf136b8ae0e |
child 58291 | a013100f7a35 |
permissions | -rw-r--r-- |
51959
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52586
diff
changeset
|
2 |
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. |
51959
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 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52586
diff
changeset
|
25 |
#ifndef SHARE_CLASSFILE_CLASSLOADERDATAGRAPH_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52586
diff
changeset
|
26 |
#define SHARE_CLASSFILE_CLASSLOADERDATAGRAPH_HPP |
51959
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->... |
55268
c5fe45d1281d
8224151: Test vmTestbase/nsk/sysdict/vm/stress/chain/chain007/chain007.java might hang with release binaries
coleenp
parents:
54961
diff
changeset
|
44 |
static ClassLoaderData* volatile _head; |
51959
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(); |
55603
3868dde58ebb
8227175: ZGC: ZHeapIterator visits potentially dead objects
stefank
parents:
55268
diff
changeset
|
71 |
static void clear_claimed_marks(int claim); |
51959
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
72 |
// Iteration through CLDG inside a safepoint; GC support |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
73 |
static void cld_do(CLDClosure* cl); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
74 |
static void cld_unloading_do(CLDClosure* cl); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
75 |
static void roots_cld_do(CLDClosure* strong, CLDClosure* weak); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
76 |
static void always_strong_cld_do(CLDClosure* cl); |
52586
74109912c738
8213751: ClassLoaderDataGraph::cld_do() should sometimes require CLDG_lock
coleenp
parents:
52498
diff
changeset
|
77 |
// Iteration through CLDG not by GC. |
74109912c738
8213751: ClassLoaderDataGraph::cld_do() should sometimes require CLDG_lock
coleenp
parents:
52498
diff
changeset
|
78 |
static void loaded_cld_do(CLDClosure* cl); |
51959
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
79 |
// klass do |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
80 |
// Walking classes through the ClassLoaderDataGraph include array classes. It also includes |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
81 |
// 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
|
82 |
// for redefinition. These classes are removed during the next class unloading. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
83 |
// Walking the ClassLoaderDataGraph also includes unsafe anonymous classes. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
84 |
static void classes_do(KlassClosure* klass_closure); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
85 |
static void classes_do(void f(Klass* const)); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
86 |
static void methods_do(void f(Method*)); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
87 |
static void modules_do(void f(ModuleEntry*)); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
88 |
static void modules_unloading_do(void f(ModuleEntry*)); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
89 |
static void packages_do(void f(PackageEntry*)); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
90 |
static void packages_unloading_do(void f(PackageEntry*)); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
91 |
static void loaded_classes_do(KlassClosure* klass_closure); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
92 |
static void unlocked_loaded_classes_do(KlassClosure* klass_closure); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
93 |
static void classes_unloading_do(void f(Klass* const)); |
52498
c3066f7465fa
8213307: G1 should clean up RMT with ClassUnloadingWithConcurrentMark
tschatzl
parents:
52014
diff
changeset
|
94 |
static bool do_unloading(); |
51959
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
95 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
96 |
// Expose state to avoid logging overhead in safepoint cleanup tasks. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
97 |
static inline bool should_clean_metaspaces_and_reset(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
98 |
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
|
99 |
static void clean_deallocate_lists(bool purge_previous_versions); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
100 |
static void walk_metadata_and_clean_metaspaces(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
101 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
102 |
// dictionary do |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
103 |
// Iterate over all klasses in dictionary, but |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
104 |
// just the classes from defining class loaders. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
105 |
static void dictionary_classes_do(void f(InstanceKlass*)); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
106 |
// Added for initialize_itable_for_klass to handle exceptions. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
107 |
static void dictionary_classes_do(void f(InstanceKlass*, TRAPS), TRAPS); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
108 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
109 |
// VM_CounterDecay iteration support |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
110 |
static InstanceKlass* try_get_next_class(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
111 |
static void adjust_saved_class(ClassLoaderData* cld); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
112 |
static void adjust_saved_class(Klass* klass); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
113 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
114 |
static void verify_dictionary(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
115 |
static void print_dictionary(outputStream* st); |
54764 | 116 |
static void print_table_statistics(outputStream* st); |
51959
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
117 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
118 |
// CMS support. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
119 |
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
|
120 |
static GrowableArray<ClassLoaderData*>* new_clds(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
121 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
122 |
static void set_should_purge(bool b) { _should_purge = b; } |
54961
30c8a21ce002
8224119: Safepoint cleanup logging logs times for things it doesn't do
coleenp
parents:
54807
diff
changeset
|
123 |
static bool should_purge_and_reset() { |
30c8a21ce002
8224119: Safepoint cleanup logging logs times for things it doesn't do
coleenp
parents:
54807
diff
changeset
|
124 |
bool res = _should_purge; |
30c8a21ce002
8224119: Safepoint cleanup logging logs times for things it doesn't do
coleenp
parents:
54807
diff
changeset
|
125 |
// reset for next time. |
30c8a21ce002
8224119: Safepoint cleanup logging logs times for things it doesn't do
coleenp
parents:
54807
diff
changeset
|
126 |
set_should_purge(false); |
30c8a21ce002
8224119: Safepoint cleanup logging logs times for things it doesn't do
coleenp
parents:
54807
diff
changeset
|
127 |
return res; |
51959
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 |
|
54961
30c8a21ce002
8224119: Safepoint cleanup logging logs times for things it doesn't do
coleenp
parents:
54807
diff
changeset
|
130 |
static int resize_dictionaries(); |
51959
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
131 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
132 |
static bool has_metaspace_oom() { return _metaspace_oom; } |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
133 |
static void set_metaspace_oom(bool value) { _metaspace_oom = value; } |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
134 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
135 |
static void print_on(outputStream * const out) PRODUCT_RETURN; |
54807 | 136 |
static void print(); |
51959
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
137 |
static void verify(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
138 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
139 |
// instance and array class counters |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
140 |
static inline size_t num_instance_classes(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
141 |
static inline size_t num_array_classes(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
142 |
static inline void inc_instance_classes(size_t count); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
143 |
static inline void dec_instance_classes(size_t count); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
144 |
static inline void inc_array_classes(size_t count); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
145 |
static inline void dec_array_classes(size_t count); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
146 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
147 |
#ifndef PRODUCT |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
148 |
static bool contains_loader_data(ClassLoaderData* loader_data); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
149 |
#endif |
52014
1aa9beac610e
8210754: print_location is not reliable enough (printing register info)
mdoerr
parents:
51959
diff
changeset
|
150 |
|
1aa9beac610e
8210754: print_location is not reliable enough (printing register info)
mdoerr
parents:
51959
diff
changeset
|
151 |
// 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
|
152 |
// Usage without lock only allowed during error reporting. |
1aa9beac610e
8210754: print_location is not reliable enough (printing register info)
mdoerr
parents:
51959
diff
changeset
|
153 |
static bool is_valid(ClassLoaderData* loader_data); |
51959
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 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
156 |
class LockedClassesDo : public KlassClosure { |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
157 |
typedef void (*classes_do_func_t)(Klass*); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
158 |
classes_do_func_t _function; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
159 |
public: |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
160 |
LockedClassesDo(); // For callers who provide their own do_klass |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
161 |
LockedClassesDo(classes_do_func_t function); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
162 |
~LockedClassesDo(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
163 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
164 |
void do_klass(Klass* k) { |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
165 |
(*_function)(k); |
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 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
169 |
// An iterator that distributes Klasses to parallel worker threads. |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
170 |
class ClassLoaderDataGraphKlassIteratorAtomic : public StackObj { |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
171 |
Klass* volatile _next_klass; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
172 |
public: |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
173 |
ClassLoaderDataGraphKlassIteratorAtomic(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
174 |
Klass* next_klass(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
175 |
private: |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
176 |
static Klass* next_klass_in_cldg(Klass* klass); |
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 |
|
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
179 |
class ClassLoaderDataGraphMetaspaceIterator : public StackObj { |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
180 |
ClassLoaderData* _data; |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
181 |
public: |
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 |
~ClassLoaderDataGraphMetaspaceIterator(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
184 |
bool repeat() { return _data != NULL; } |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
185 |
ClassLoaderMetaspace* get_next(); |
db0c3952de52
8209645: Split ClassLoaderData and ClassLoaderDataGraph into separate files
coleenp
parents:
diff
changeset
|
186 |
}; |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52586
diff
changeset
|
187 |
#endif // SHARE_CLASSFILE_CLASSLOADERDATAGRAPH_HPP |