author | iklam |
Wed, 02 Aug 2017 18:06:38 -0700 | |
changeset 46746 | ea379ebb9447 |
parent 46742 | 24ec8a039c90 |
child 46961 | c9094b1e5f87 |
permissions | -rw-r--r-- |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
1 |
/* |
44084
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
2 |
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
4 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
8 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
14847 | 11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
13 |
* accompanied this code). |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
14 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
18 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
21 |
* questions. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
22 |
* |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
23 |
*/ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
24 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
25 |
#ifndef SHARE_VM_CLASSFILE_CLASSLOADERDATA_HPP |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
26 |
#define SHARE_VM_CLASSFILE_CLASSLOADERDATA_HPP |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
27 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
28 |
#include "memory/allocation.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
29 |
#include "memory/memRegion.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
30 |
#include "memory/metaspace.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
31 |
#include "memory/metaspaceCounters.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
32 |
#include "runtime/mutex.hpp" |
42639
762117d57d05
8170672: Event-based tracing to support classloader instances
mgronlun
parents:
40358
diff
changeset
|
33 |
#include "trace/traceMacros.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
34 |
#include "utilities/growableArray.hpp" |
27673
df559a888b9f
8065361: Fixup headers and definitions for INCLUDE_TRACE
mgronlun
parents:
27461
diff
changeset
|
35 |
#include "utilities/macros.hpp" |
18025 | 36 |
#if INCLUDE_TRACE |
27673
df559a888b9f
8065361: Fixup headers and definitions for INCLUDE_TRACE
mgronlun
parents:
27461
diff
changeset
|
37 |
#include "utilities/ticks.hpp" |
18025 | 38 |
#endif |
39 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
40 |
// |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
41 |
// A class loader represents a linkset. Conceptually, a linkset identifies |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
42 |
// the complete transitive closure of resolved links that a dynamic linker can |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
43 |
// produce. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
44 |
// |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
45 |
// A ClassLoaderData also encapsulates the allocation space, called a metaspace, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
46 |
// used by the dynamic linker to allocate the runtime representation of all |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
47 |
// the types it defines. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
48 |
// |
46729 | 49 |
// ClassLoaderData are stored in the runtime representation of classes, |
50 |
// and provides iterators for root tracing and other GC operations. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
51 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
52 |
class ClassLoaderData; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
53 |
class JNIMethodBlock; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
54 |
class Metadebug; |
36508 | 55 |
class ModuleEntry; |
56 |
class PackageEntry; |
|
57 |
class ModuleEntryTable; |
|
58 |
class PackageEntryTable; |
|
46729 | 59 |
class DictionaryEntry; |
60 |
class Dictionary; |
|
18025 | 61 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
62 |
// GC root for walking class loader data created |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
63 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
64 |
class ClassLoaderDataGraph : public AllStatic { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
65 |
friend class ClassLoaderData; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
66 |
friend class ClassLoaderDataGraphMetaspaceIterator; |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
67 |
friend class ClassLoaderDataGraphKlassIteratorAtomic; |
46729 | 68 |
friend class ClassLoaderDataGraphKlassIteratorStatic; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
69 |
friend class VMStructs; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
70 |
private: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
71 |
// All CLDs (except the null CLD) can be reached by walking _head->_next->... |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
72 |
static ClassLoaderData* _head; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
73 |
static ClassLoaderData* _unloading; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
74 |
// CMS support. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
75 |
static ClassLoaderData* _saved_head; |
25371
564ab3b08082
8047812: Ensure ClassLoaderDataGraph::classes_unloading_do only delivers klasses from CLDs with non-reclaimed class loader oops
mgronlun
parents:
25325
diff
changeset
|
76 |
static ClassLoaderData* _saved_unloading; |
24457
0e20b36df5c4
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
23526
diff
changeset
|
77 |
static bool _should_purge; |
27461
90e9e0f9c0c5
8037842: Failing to allocate MethodCounters and MDO causes a serious performance drop
coleenp
parents:
27247
diff
changeset
|
78 |
// OOM has been seen in metaspace allocation. Used to prevent some |
90e9e0f9c0c5
8037842: Failing to allocate MethodCounters and MDO causes a serious performance drop
coleenp
parents:
27247
diff
changeset
|
79 |
// allocations until class unloading |
90e9e0f9c0c5
8037842: Failing to allocate MethodCounters and MDO causes a serious performance drop
coleenp
parents:
27247
diff
changeset
|
80 |
static bool _metaspace_oom; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
81 |
|
17107
46fc21b30a1e
8011802: NPG: init_dependencies in class loader data graph can cause invalid CLD
mgerdin
parents:
16684
diff
changeset
|
82 |
static ClassLoaderData* add(Handle class_loader, bool anonymous, TRAPS); |
42639
762117d57d05
8170672: Event-based tracing to support classloader instances
mgronlun
parents:
40358
diff
changeset
|
83 |
static void post_class_unload_events(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
84 |
public: |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
13759
diff
changeset
|
85 |
static ClassLoaderData* find_or_create(Handle class_loader, TRAPS); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
86 |
static void purge(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
87 |
static void clear_claimed_marks(); |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
88 |
// oops do |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
89 |
static void oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim); |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
90 |
static void keep_alive_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
91 |
static void always_strong_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim); |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
92 |
// cld do |
25051
8110ec6e7340
8044107: Add Diagnostic Command to list all ClassLoaders
sla
parents:
24457
diff
changeset
|
93 |
static void cld_do(CLDClosure* cl); |
42639
762117d57d05
8170672: Event-based tracing to support classloader instances
mgronlun
parents:
40358
diff
changeset
|
94 |
static void cld_unloading_do(CLDClosure* cl); |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
95 |
static void roots_cld_do(CLDClosure* strong, CLDClosure* weak); |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
96 |
static void keep_alive_cld_do(CLDClosure* cl); |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
97 |
static void always_strong_cld_do(CLDClosure* cl); |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
98 |
// klass do |
46380
4a51438196cf
8026985: Rewrite SystemDictionary::classes_do and Dictionary::classes_do to use KlassClosure
coleenp
parents:
46338
diff
changeset
|
99 |
// Walking classes through the ClassLoaderDataGraph include array classes. It also includes |
4a51438196cf
8026985: Rewrite SystemDictionary::classes_do and Dictionary::classes_do to use KlassClosure
coleenp
parents:
46338
diff
changeset
|
100 |
// classes that are allocated but not loaded, classes that have errors, and scratch classes |
4a51438196cf
8026985: Rewrite SystemDictionary::classes_do and Dictionary::classes_do to use KlassClosure
coleenp
parents:
46338
diff
changeset
|
101 |
// for redefinition. These classes are removed during the next class unloading. |
4a51438196cf
8026985: Rewrite SystemDictionary::classes_do and Dictionary::classes_do to use KlassClosure
coleenp
parents:
46338
diff
changeset
|
102 |
// Walking the ClassLoaderDataGraph also includes anonymous classes. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
103 |
static void classes_do(KlassClosure* klass_closure); |
18025 | 104 |
static void classes_do(void f(Klass* const)); |
23526
6851d341ad52
8037970: make PrintMethodData a diagnostic options
roland
parents:
22905
diff
changeset
|
105 |
static void methods_do(void f(Method*)); |
36508 | 106 |
static void modules_do(void f(ModuleEntry*)); |
107 |
static void modules_unloading_do(void f(ModuleEntry*)); |
|
108 |
static void packages_do(void f(PackageEntry*)); |
|
109 |
static void packages_unloading_do(void f(PackageEntry*)); |
|
21183
e148e499e5cd
8024423: JVMTI: GetLoadedClasses doesn't enumerate anonymous classes
farvidsson
parents:
18025
diff
changeset
|
110 |
static void loaded_classes_do(KlassClosure* klass_closure); |
18025 | 111 |
static void classes_unloading_do(void f(Klass* const)); |
29576
c223b0a9872e
8061205: MetadataOnStackMark only needs to walk code cache during class redefinition
coleenp
parents:
27673
diff
changeset
|
112 |
static bool do_unloading(BoolObjectClosure* is_alive, bool clean_previous_versions); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
113 |
|
46729 | 114 |
// dictionary do |
115 |
// Iterate over all klasses in dictionary, but |
|
116 |
// just the classes from defining class loaders. |
|
117 |
static void dictionary_classes_do(void f(InstanceKlass*)); |
|
118 |
// Added for initialize_itable_for_klass to handle exceptions. |
|
119 |
static void dictionary_classes_do(void f(InstanceKlass*, TRAPS), TRAPS); |
|
120 |
||
121 |
// Iterate all classes and their class loaders, including initiating class loaders. |
|
122 |
static void dictionary_all_entries_do(void f(InstanceKlass*, ClassLoaderData*)); |
|
123 |
||
124 |
// VM_CounterDecay iteration support |
|
125 |
static InstanceKlass* try_get_next_class(); |
|
126 |
||
127 |
static void verify_dictionary(); |
|
46742 | 128 |
static void print_dictionary(outputStream* st); |
129 |
static void print_dictionary_statistics(outputStream* st); |
|
46729 | 130 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
131 |
// CMS support. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
132 |
static void remember_new_clds(bool remember) { _saved_head = (remember ? _head : NULL); } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
133 |
static GrowableArray<ClassLoaderData*>* new_clds(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
134 |
|
24457
0e20b36df5c4
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
23526
diff
changeset
|
135 |
static void set_should_purge(bool b) { _should_purge = b; } |
0e20b36df5c4
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
23526
diff
changeset
|
136 |
static void purge_if_needed() { |
0e20b36df5c4
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
23526
diff
changeset
|
137 |
// Only purge the CLDG for CMS if concurrent sweep is complete. |
0e20b36df5c4
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
23526
diff
changeset
|
138 |
if (_should_purge) { |
0e20b36df5c4
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
23526
diff
changeset
|
139 |
purge(); |
0e20b36df5c4
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
23526
diff
changeset
|
140 |
// reset for next time. |
0e20b36df5c4
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
23526
diff
changeset
|
141 |
set_should_purge(false); |
0e20b36df5c4
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
23526
diff
changeset
|
142 |
} |
0e20b36df5c4
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
23526
diff
changeset
|
143 |
} |
0e20b36df5c4
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
23526
diff
changeset
|
144 |
|
27461
90e9e0f9c0c5
8037842: Failing to allocate MethodCounters and MDO causes a serious performance drop
coleenp
parents:
27247
diff
changeset
|
145 |
static bool has_metaspace_oom() { return _metaspace_oom; } |
90e9e0f9c0c5
8037842: Failing to allocate MethodCounters and MDO causes a serious performance drop
coleenp
parents:
27247
diff
changeset
|
146 |
static void set_metaspace_oom(bool value) { _metaspace_oom = value; } |
90e9e0f9c0c5
8037842: Failing to allocate MethodCounters and MDO causes a serious performance drop
coleenp
parents:
27247
diff
changeset
|
147 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
148 |
static void dump_on(outputStream * const out) PRODUCT_RETURN; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
149 |
static void dump() { dump_on(tty); } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
150 |
static void verify(); |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46420
diff
changeset
|
151 |
static void print_creation(outputStream* out, Handle loader, ClassLoaderData* cld, TRAPS); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
152 |
|
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
153 |
static bool unload_list_contains(const void* x); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
154 |
#ifndef PRODUCT |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
155 |
static bool contains_loader_data(ClassLoaderData* loader_data); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
156 |
#endif |
18025 | 157 |
|
158 |
#if INCLUDE_TRACE |
|
159 |
private: |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
21183
diff
changeset
|
160 |
static Ticks _class_unload_time; |
18025 | 161 |
static void class_unload_event(Klass* const k); |
162 |
#endif |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
163 |
}; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
164 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
165 |
// ClassLoaderData class |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
166 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
167 |
class ClassLoaderData : public CHeapObj<mtClass> { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
168 |
friend class VMStructs; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
169 |
private: |
16684
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
170 |
class Dependencies VALUE_OBJ_CLASS_SPEC { |
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
171 |
objArrayOop _list_head; |
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
172 |
void locked_add(objArrayHandle last, |
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
173 |
objArrayHandle new_dependency, |
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
174 |
Thread* THREAD); |
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
175 |
public: |
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
176 |
Dependencies() : _list_head(NULL) {} |
17110
a8f03d38bde5
8013136: NPG: Parallel class loading tests fail after fix for JDK-8011802
mgerdin
parents:
17107
diff
changeset
|
177 |
Dependencies(TRAPS) : _list_head(NULL) { |
a8f03d38bde5
8013136: NPG: Parallel class loading tests fail after fix for JDK-8011802
mgerdin
parents:
17107
diff
changeset
|
178 |
init(CHECK); |
a8f03d38bde5
8013136: NPG: Parallel class loading tests fail after fix for JDK-8011802
mgerdin
parents:
17107
diff
changeset
|
179 |
} |
16684
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
180 |
void add(Handle dependency, TRAPS); |
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
181 |
void init(TRAPS); |
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
182 |
void oops_do(OopClosure* f); |
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
183 |
}; |
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
184 |
|
44084
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
185 |
class ChunkedHandleList VALUE_OBJ_CLASS_SPEC { |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
186 |
struct Chunk : public CHeapObj<mtClass> { |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
187 |
static const size_t CAPACITY = 32; |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
188 |
|
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
189 |
oop _data[CAPACITY]; |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
190 |
volatile juint _size; |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
191 |
Chunk* _next; |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
192 |
|
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
193 |
Chunk(Chunk* c) : _next(c), _size(0) { } |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
194 |
}; |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
195 |
|
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
196 |
Chunk* _head; |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
197 |
|
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
198 |
void oops_do_chunk(OopClosure* f, Chunk* c, const juint size); |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
199 |
|
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
200 |
public: |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
201 |
ChunkedHandleList() : _head(NULL) {} |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
202 |
~ChunkedHandleList(); |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
203 |
|
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
204 |
// Only one thread at a time can add, guarded by ClassLoaderData::metaspace_lock(). |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
205 |
// However, multiple threads can execute oops_do concurrently with add. |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
206 |
oop* add(oop o); |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
207 |
#ifdef ASSERT |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
208 |
bool contains(oop* p); |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
209 |
#endif |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
210 |
void oops_do(OopClosure* f); |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
211 |
}; |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
212 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
213 |
friend class ClassLoaderDataGraph; |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
214 |
friend class ClassLoaderDataGraphKlassIteratorAtomic; |
46729 | 215 |
friend class ClassLoaderDataGraphKlassIteratorStatic; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
216 |
friend class ClassLoaderDataGraphMetaspaceIterator; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
217 |
friend class MetaDataFactory; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
218 |
friend class Method; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
219 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
220 |
static ClassLoaderData * _the_null_class_loader_data; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
221 |
|
16684
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
222 |
oop _class_loader; // oop used to uniquely identify a class loader |
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
223 |
// class loader or a canonical class path |
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
224 |
Dependencies _dependencies; // holds dependencies from this class loader |
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
225 |
// data to others. |
2af47517ffbd
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
16617
diff
changeset
|
226 |
|
38937
2bf3c37c4841
8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents:
38014
diff
changeset
|
227 |
Metaspace * volatile _metaspace; // Meta-space where meta-data defined by the |
2bf3c37c4841
8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents:
38014
diff
changeset
|
228 |
// classes in the class loader are allocated. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
229 |
Mutex* _metaspace_lock; // Locks the metaspace for allocations and setup. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
230 |
bool _unloading; // true if this class loader goes away |
14816 | 231 |
bool _is_anonymous; // if this CLD is for an anonymous class |
40358
48774f26918a
8162553: Crash in class unloading due to null CLD having a zero _keep_alive value
lfoltan
parents:
39616
diff
changeset
|
232 |
s2 _keep_alive; // if this CLD is kept alive without a keep_alive_object(). |
48774f26918a
8162553: Crash in class unloading due to null CLD having a zero _keep_alive value
lfoltan
parents:
39616
diff
changeset
|
233 |
// Used for anonymous classes and the boot class |
48774f26918a
8162553: Crash in class unloading due to null CLD having a zero _keep_alive value
lfoltan
parents:
39616
diff
changeset
|
234 |
// loader. _keep_alive does not need to be volatile or |
38014
8731fa11f766
8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents:
36508
diff
changeset
|
235 |
// atomic since there is one unique CLD per anonymous class. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
236 |
volatile int _claimed; // true if claimed, for example during GC traces. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
237 |
// To avoid applying oop closure more than once. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
238 |
// Has to be an int because we cas it. |
44084
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
239 |
ChunkedHandleList _handles; // Handles to constant pool arrays, Modules, etc, which |
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
240 |
// have the same life cycle of the corresponding ClassLoader. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
241 |
|
38937
2bf3c37c4841
8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents:
38014
diff
changeset
|
242 |
Klass* volatile _klasses; // The classes defined by the class loader. |
2bf3c37c4841
8154750: Add missing OrderAccess operations to ClassLoaderData lock-free data structures
dholmes
parents:
38014
diff
changeset
|
243 |
PackageEntryTable* volatile _packages; // The packages defined by the class loader. |
46729 | 244 |
ModuleEntryTable* volatile _modules; // The modules defined by the class loader. |
46387 | 245 |
ModuleEntry* _unnamed_module; // This class loader's unnamed module. |
46729 | 246 |
Dictionary* _dictionary; // The loaded InstanceKlasses, including initiated by this class loader |
31046
d01ad7a0ecb0
8081320: Backout JDK-8059340: ConstantPool::_resolved_references is missing in heap dump
vlivanov
parents:
31038
diff
changeset
|
247 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
248 |
// These method IDs are created for the class loader and set to NULL when the |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
249 |
// class loader is unloaded. They are rarely freed, only for redefine classes |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
250 |
// and if they lose a data race in InstanceKlass. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
251 |
JNIMethodBlock* _jmethod_ids; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
252 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
253 |
// Metadata to be deallocated when it's safe at class unloading, when |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
254 |
// this class loader isn't unloaded itself. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
255 |
GrowableArray<Metadata*>* _deallocate_list; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
256 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
257 |
// Support for walking class loader data objects |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
258 |
ClassLoaderData* _next; /// Next loader_datas created |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
259 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
260 |
// ReadOnly and ReadWrite metaspaces (static because only on the null |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
261 |
// class loader for now). |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
262 |
static Metaspace* _ro_metaspace; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
263 |
static Metaspace* _rw_metaspace; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
264 |
|
42639
762117d57d05
8170672: Event-based tracing to support classloader instances
mgronlun
parents:
40358
diff
changeset
|
265 |
TRACE_DEFINE_TRACE_ID_FIELD; |
762117d57d05
8170672: Event-based tracing to support classloader instances
mgronlun
parents:
40358
diff
changeset
|
266 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
267 |
void set_next(ClassLoaderData* next) { _next = next; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
268 |
ClassLoaderData* next() const { return _next; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
269 |
|
17110
a8f03d38bde5
8013136: NPG: Parallel class loading tests fail after fix for JDK-8011802
mgerdin
parents:
17107
diff
changeset
|
270 |
ClassLoaderData(Handle h_class_loader, bool is_anonymous, Dependencies dependencies); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
271 |
~ClassLoaderData(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
272 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
273 |
// GC interface. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
274 |
void clear_claimed() { _claimed = 0; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
275 |
bool claimed() const { return _claimed == 1; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
276 |
bool claim(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
277 |
|
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
13759
diff
changeset
|
278 |
void unload(); |
38014
8731fa11f766
8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents:
36508
diff
changeset
|
279 |
bool keep_alive() const { return _keep_alive > 0; } |
18025 | 280 |
void classes_do(void f(Klass*)); |
21183
e148e499e5cd
8024423: JVMTI: GetLoadedClasses doesn't enumerate anonymous classes
farvidsson
parents:
18025
diff
changeset
|
281 |
void loaded_classes_do(KlassClosure* klass_closure); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
282 |
void classes_do(void f(InstanceKlass*)); |
23526
6851d341ad52
8037970: make PrintMethodData a diagnostic options
roland
parents:
22905
diff
changeset
|
283 |
void methods_do(void f(Method*)); |
36508 | 284 |
void modules_do(void f(ModuleEntry*)); |
285 |
void packages_do(void f(PackageEntry*)); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
286 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
287 |
// Deallocate free list during class unloading. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
288 |
void free_deallocate_list(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
289 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
290 |
// Allocate out of this class loader data |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
291 |
MetaWord* allocate(size_t size); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
292 |
|
46729 | 293 |
Dictionary* create_dictionary(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
294 |
public: |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
295 |
|
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
296 |
bool is_alive(BoolObjectClosure* is_alive_closure) const; |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
297 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
298 |
// Accessors |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
299 |
Metaspace* metaspace_or_null() const { return _metaspace; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
300 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
301 |
static ClassLoaderData* the_null_class_loader_data() { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
302 |
return _the_null_class_loader_data; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
303 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
304 |
|
25325 | 305 |
Mutex* metaspace_lock() const { return _metaspace_lock; } |
306 |
||
14816 | 307 |
bool is_anonymous() const { return _is_anonymous; } |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
13759
diff
changeset
|
308 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
309 |
static void init_null_class_loader_data() { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
310 |
assert(_the_null_class_loader_data == NULL, "cannot initialize twice"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
311 |
assert(ClassLoaderDataGraph::_head == NULL, "cannot initialize twice"); |
17110
a8f03d38bde5
8013136: NPG: Parallel class loading tests fail after fix for JDK-8011802
mgerdin
parents:
17107
diff
changeset
|
312 |
|
a8f03d38bde5
8013136: NPG: Parallel class loading tests fail after fix for JDK-8011802
mgerdin
parents:
17107
diff
changeset
|
313 |
// We explicitly initialize the Dependencies object at a later phase in the initialization |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42639
diff
changeset
|
314 |
_the_null_class_loader_data = new ClassLoaderData(Handle(), false, Dependencies()); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
315 |
ClassLoaderDataGraph::_head = _the_null_class_loader_data; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
316 |
assert(_the_null_class_loader_data->is_the_null_class_loader_data(), "Must be"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
317 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
318 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
319 |
bool is_the_null_class_loader_data() const { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
320 |
return this == _the_null_class_loader_data; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
321 |
} |
39616
f82b1f888578
8159262: Walking PackageEntry Export and ModuleEntry Reads Must Occur Only When Neccessary And Wait Until ClassLoader's Aliveness Determined
lfoltan
parents:
38937
diff
changeset
|
322 |
bool is_system_class_loader_data() const; |
36508 | 323 |
bool is_platform_class_loader_data() const; |
39616
f82b1f888578
8159262: Walking PackageEntry Export and ModuleEntry Reads Must Occur Only When Neccessary And Wait Until ClassLoader's Aliveness Determined
lfoltan
parents:
38937
diff
changeset
|
324 |
bool is_builtin_class_loader_data() const; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
325 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
326 |
// The Metaspace is created lazily so may be NULL. This |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
327 |
// method will allocate a Metaspace if needed. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
328 |
Metaspace* metaspace_non_null(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
329 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
330 |
oop class_loader() const { return _class_loader; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
331 |
|
22900 | 332 |
// The object the GC is using to keep this ClassLoaderData alive. |
333 |
oop keep_alive_object() const; |
|
334 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
335 |
// Returns true if this class loader data is for a loader going away. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
336 |
bool is_unloading() const { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
337 |
assert(!(is_the_null_class_loader_data() && _unloading), "The null class loader can never be unloaded"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
338 |
return _unloading; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
339 |
} |
22900 | 340 |
|
40358
48774f26918a
8162553: Crash in class unloading due to null CLD having a zero _keep_alive value
lfoltan
parents:
39616
diff
changeset
|
341 |
// Used to refcount an anonymous class's CLD in order to |
48774f26918a
8162553: Crash in class unloading due to null CLD having a zero _keep_alive value
lfoltan
parents:
39616
diff
changeset
|
342 |
// indicate their aliveness without a keep_alive_object(). |
38014
8731fa11f766
8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents:
36508
diff
changeset
|
343 |
void inc_keep_alive(); |
8731fa11f766
8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents:
36508
diff
changeset
|
344 |
void dec_keep_alive(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
345 |
|
46729 | 346 |
inline unsigned int identity_hash() const { return (unsigned int)(((intptr_t)this) >> 3); } |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
347 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
348 |
// Used when tracing from klasses. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
349 |
void oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
350 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
351 |
void classes_do(KlassClosure* klass_closure); |
46729 | 352 |
Klass* klasses() { return _klasses; } |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
353 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
354 |
JNIMethodBlock* jmethod_ids() const { return _jmethod_ids; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
355 |
void set_jmethod_ids(JNIMethodBlock* new_block) { _jmethod_ids = new_block; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
356 |
|
46729 | 357 |
void print() { print_on(tty); } |
358 |
void print_on(outputStream* out) const; |
|
359 |
void print_value() { print_value_on(tty); } |
|
15437 | 360 |
void print_value_on(outputStream* out) const; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
361 |
void dump(outputStream * const out) PRODUCT_RETURN; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
362 |
void verify(); |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
13759
diff
changeset
|
363 |
const char* loader_name(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
364 |
|
31046
d01ad7a0ecb0
8081320: Backout JDK-8059340: ConstantPool::_resolved_references is missing in heap dump
vlivanov
parents:
31038
diff
changeset
|
365 |
jobject add_handle(Handle h); |
44084
501b6d07e6dd
8168914: Crash in ClassLoaderData/JNIHandleBlock::oops_do during concurrent marking
ehelin
parents:
43410
diff
changeset
|
366 |
void remove_handle_unsafe(jobject h); |
34666 | 367 |
void add_class(Klass* k, bool publicize = true); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
368 |
void remove_class(Klass* k); |
22794
f1c014ad3754
8027146: Class loading verification failure if GC occurs in Universe::flush_dependents_on
coleenp
parents:
22201
diff
changeset
|
369 |
bool contains_klass(Klass* k); |
34666 | 370 |
void record_dependency(const Klass* to, TRAPS); |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
13759
diff
changeset
|
371 |
void init_dependencies(TRAPS); |
46420
227f72691ac1
8179235: PackageEntryTables should be created eagerly
hseigel
parents:
46387
diff
changeset
|
372 |
PackageEntryTable* packages() { return _packages; } |
46387 | 373 |
ModuleEntry* unnamed_module() { return _unnamed_module; } |
36508 | 374 |
ModuleEntryTable* modules(); |
375 |
bool modules_defined() { return (_modules != NULL); } |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
376 |
|
46729 | 377 |
// Loaded class dictionary |
378 |
Dictionary* dictionary() const { return _dictionary; } |
|
379 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
380 |
void add_to_deallocate_list(Metadata* m); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
381 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
382 |
static ClassLoaderData* class_loader_data(oop loader); |
15847
f9ce2cd20dee
8008549: NPG: SystemDictionary::find(...) unnecessarily keeps class loaders alive
stefank
parents:
15437
diff
changeset
|
383 |
static ClassLoaderData* class_loader_data_or_null(oop loader); |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
13759
diff
changeset
|
384 |
static ClassLoaderData* anonymous_class_loader_data(oop loader, TRAPS); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
385 |
static void print_loader(ClassLoaderData *loader_data, outputStream *out); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
386 |
|
42639
762117d57d05
8170672: Event-based tracing to support classloader instances
mgronlun
parents:
40358
diff
changeset
|
387 |
TRACE_DEFINE_TRACE_ID_METHODS; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
388 |
}; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
389 |
|
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
390 |
// An iterator that distributes Klasses to parallel worker threads. |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
391 |
class ClassLoaderDataGraphKlassIteratorAtomic : public StackObj { |
29469
2213171cca5b
8074561: Wrong volatile qualifier for field ClassLoaderDataGraphKlassIteratorAtomic::_next_klass
asiebenborn
parents:
27673
diff
changeset
|
392 |
Klass* volatile _next_klass; |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
393 |
public: |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
394 |
ClassLoaderDataGraphKlassIteratorAtomic(); |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
395 |
Klass* next_klass(); |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
396 |
private: |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
397 |
static Klass* next_klass_in_cldg(Klass* klass); |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
398 |
}; |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
399 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
400 |
class ClassLoaderDataGraphMetaspaceIterator : public StackObj { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
401 |
ClassLoaderData* _data; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
402 |
public: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
403 |
ClassLoaderDataGraphMetaspaceIterator(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
404 |
~ClassLoaderDataGraphMetaspaceIterator(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
405 |
bool repeat() { return _data != NULL; } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
406 |
Metaspace* get_next() { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
407 |
assert(_data != NULL, "Should not be NULL in call to the iterator"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
408 |
Metaspace* result = _data->metaspace_or_null(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
409 |
_data = _data->next(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
410 |
// This result might be NULL for class loaders without metaspace |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
411 |
// yet. It would be nice to return only non-null results but |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
412 |
// there is no guarantee that there will be a non-null result |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
413 |
// down the list so the caller is going to have to check. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
414 |
return result; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
415 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
416 |
}; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
417 |
#endif // SHARE_VM_CLASSFILE_CLASSLOADERDATA_HPP |