Mercurial > hg > truffle
annotate src/share/vm/classfile/classLoaderData.hpp @ 21244:bf5e055dbc9c
SSAUtils: minor refactoring.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Thu, 30 Apr 2015 15:36:03 +0200 |
parents | 7848fc12602b |
children |
rev | line source |
---|---|
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
1 /* |
14378
48314d596a04
8027146: Class loading verification failure if GC occurs in Universe::flush_dependents_on
coleenp
parents:
14190
diff
changeset
|
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
6725
da91efe96a93
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. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
4 * |
da91efe96a93
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 |
da91efe96a93
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 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
8 * |
da91efe96a93
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 |
da91efe96a93
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 |
7440 | 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6725
da91efe96a93
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 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
13 * accompanied this code). |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
14 * |
da91efe96a93
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 |
da91efe96a93
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, |
da91efe96a93
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. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
18 * |
da91efe96a93
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 |
da91efe96a93
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 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
21 * questions. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
22 * |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
23 */ |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
24 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
25 #ifndef SHARE_VM_CLASSFILE_CLASSLOADERDATA_HPP |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
26 #define SHARE_VM_CLASSFILE_CLASSLOADERDATA_HPP |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
27 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
28 #include "memory/allocation.hpp" |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
29 #include "memory/memRegion.hpp" |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
30 #include "memory/metaspace.hpp" |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
31 #include "memory/metaspaceCounters.hpp" |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
32 #include "runtime/mutex.hpp" |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
33 #include "utilities/growableArray.hpp" |
20653
82d3e7b5277a
8065361: Fixup headers and definitions for INCLUDE_TRACE
mgronlun
parents:
20619
diff
changeset
|
34 #include "utilities/macros.hpp" |
10405 | 35 #if INCLUDE_TRACE |
20653
82d3e7b5277a
8065361: Fixup headers and definitions for INCLUDE_TRACE
mgronlun
parents:
20619
diff
changeset
|
36 #include "utilities/ticks.hpp" |
10405 | 37 #endif |
38 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
39 // |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
40 // A class loader represents a linkset. Conceptually, a linkset identifies |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
41 // the complete transitive closure of resolved links that a dynamic linker can |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
42 // produce. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
43 // |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
44 // A ClassLoaderData also encapsulates the allocation space, called a metaspace, |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
45 // used by the dynamic linker to allocate the runtime representation of all |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
46 // the types it defines. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
47 // |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
48 // ClassLoaderData are stored in the runtime representation of classes and the |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
49 // system dictionary, are roots of garbage collection, and provides iterators |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
50 // for root tracing and other GC operations. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
51 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
52 class ClassLoaderData; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
53 class JNIMethodBlock; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
54 class JNIHandleBlock; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
55 class Metadebug; |
10405 | 56 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
57 // GC root for walking class loader data created |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
58 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
59 class ClassLoaderDataGraph : public AllStatic { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
60 friend class ClassLoaderData; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
61 friend class ClassLoaderDataGraphMetaspaceIterator; |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
62 friend class ClassLoaderDataGraphKlassIteratorAtomic; |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
63 friend class VMStructs; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
64 private: |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
65 // All CLDs (except the null CLD) can be reached by walking _head->_next->... |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
66 static ClassLoaderData* _head; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
67 static ClassLoaderData* _unloading; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
68 // CMS support. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
69 static ClassLoaderData* _saved_head; |
17999
e4a6e7f1b90b
8047812: Ensure ClassLoaderDataGraph::classes_unloading_do only delivers klasses from CLDs with non-reclaimed class loader oops
mgronlun
parents:
17935
diff
changeset
|
70 static ClassLoaderData* _saved_unloading; |
17935
7384f6a12fc1
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
14378
diff
changeset
|
71 static bool _should_purge; |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
72 |
10181
1cb4795305b9
8011802: NPG: init_dependencies in class loader data graph can cause invalid CLD
mgerdin
parents:
9075
diff
changeset
|
73 static ClassLoaderData* add(Handle class_loader, bool anonymous, TRAPS); |
10405 | 74 static void post_class_unload_events(void); |
20619
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
20278
diff
changeset
|
75 static void clean_metaspaces(); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
76 public: |
7185
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6757
diff
changeset
|
77 static ClassLoaderData* find_or_create(Handle class_loader, TRAPS); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
78 static void purge(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
79 static void clear_claimed_marks(); |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
80 // oops do |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
81 static void oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim); |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
82 static void keep_alive_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
83 static void always_strong_oops_do(OopClosure* blk, KlassClosure* klass_closure, bool must_claim); |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
84 // cld do |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
85 static void cld_do(CLDClosure* cl); |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
86 static void roots_cld_do(CLDClosure* strong, CLDClosure* weak); |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
87 static void keep_alive_cld_do(CLDClosure* cl); |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
88 static void always_strong_cld_do(CLDClosure* cl); |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
89 // klass do |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
90 static void classes_do(KlassClosure* klass_closure); |
10405 | 91 static void classes_do(void f(Klass* const)); |
12995
e64f1fe9756b
8024423: JVMTI: GetLoadedClasses doesn't enumerate anonymous classes
farvidsson
parents:
10405
diff
changeset
|
92 static void loaded_classes_do(KlassClosure* klass_closure); |
10405 | 93 static void classes_unloading_do(void f(Klass* const)); |
20619
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
20278
diff
changeset
|
94 static bool do_unloading(BoolObjectClosure* is_alive, bool clean_alive); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
95 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
96 // CMS support. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
97 static void remember_new_clds(bool remember) { _saved_head = (remember ? _head : NULL); } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
98 static GrowableArray<ClassLoaderData*>* new_clds(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
99 |
17935
7384f6a12fc1
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
14378
diff
changeset
|
100 static void set_should_purge(bool b) { _should_purge = b; } |
7384f6a12fc1
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
14378
diff
changeset
|
101 static void purge_if_needed() { |
7384f6a12fc1
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
14378
diff
changeset
|
102 // Only purge the CLDG for CMS if concurrent sweep is complete. |
7384f6a12fc1
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
14378
diff
changeset
|
103 if (_should_purge) { |
7384f6a12fc1
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
14378
diff
changeset
|
104 purge(); |
7384f6a12fc1
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
14378
diff
changeset
|
105 // reset for next time. |
7384f6a12fc1
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
14378
diff
changeset
|
106 set_should_purge(false); |
7384f6a12fc1
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
14378
diff
changeset
|
107 } |
7384f6a12fc1
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
14378
diff
changeset
|
108 } |
7384f6a12fc1
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
14378
diff
changeset
|
109 |
20619
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
20278
diff
changeset
|
110 static void free_deallocate_lists(); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
20278
diff
changeset
|
111 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
112 static void dump_on(outputStream * const out) PRODUCT_RETURN; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
113 static void dump() { dump_on(tty); } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
114 static void verify(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
115 |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
116 static bool unload_list_contains(const void* x); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
117 #ifndef PRODUCT |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
118 static bool contains_loader_data(ClassLoaderData* loader_data); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
119 #endif |
10405 | 120 |
121 #if INCLUDE_TRACE | |
122 private: | |
13400
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
12995
diff
changeset
|
123 static Ticks _class_unload_time; |
10405 | 124 static void class_unload_event(Klass* const k); |
125 #endif | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
126 }; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
127 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
128 // ClassLoaderData class |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
129 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
130 class ClassLoaderData : public CHeapObj<mtClass> { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
131 friend class VMStructs; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
132 private: |
9075
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
133 class Dependencies VALUE_OBJ_CLASS_SPEC { |
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
134 objArrayOop _list_head; |
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
135 void locked_add(objArrayHandle last, |
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
136 objArrayHandle new_dependency, |
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
137 Thread* THREAD); |
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
138 public: |
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
139 Dependencies() : _list_head(NULL) {} |
10184
9d75bcd7c890
8013136: NPG: Parallel class loading tests fail after fix for JDK-8011802
mgerdin
parents:
10181
diff
changeset
|
140 Dependencies(TRAPS) : _list_head(NULL) { |
9d75bcd7c890
8013136: NPG: Parallel class loading tests fail after fix for JDK-8011802
mgerdin
parents:
10181
diff
changeset
|
141 init(CHECK); |
9d75bcd7c890
8013136: NPG: Parallel class loading tests fail after fix for JDK-8011802
mgerdin
parents:
10181
diff
changeset
|
142 } |
9075
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
143 void add(Handle dependency, TRAPS); |
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
144 void init(TRAPS); |
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
145 void oops_do(OopClosure* f); |
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
146 }; |
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
147 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
148 friend class ClassLoaderDataGraph; |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
149 friend class ClassLoaderDataGraphKlassIteratorAtomic; |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
150 friend class ClassLoaderDataGraphMetaspaceIterator; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
151 friend class MetaDataFactory; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
152 friend class Method; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
153 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
154 static ClassLoaderData * _the_null_class_loader_data; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
155 |
9075
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
156 oop _class_loader; // oop used to uniquely identify a class loader |
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
157 // class loader or a canonical class path |
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
158 Dependencies _dependencies; // holds dependencies from this class loader |
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
159 // data to others. |
ba42fd5e00e6
8010196: NPG: Internal Error: Metaspace allocation lock -- possible deadlock
mgerdin
parents:
8866
diff
changeset
|
160 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
161 Metaspace * _metaspace; // Meta-space where meta-data defined by the |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
162 // classes in the class loader are allocated. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
163 Mutex* _metaspace_lock; // Locks the metaspace for allocations and setup. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
164 bool _unloading; // true if this class loader goes away |
20260 | 165 bool _keep_alive; // if this CLD is kept alive without a keep_alive_object(). |
7409 | 166 bool _is_anonymous; // if this CLD is for an anonymous class |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
167 volatile int _claimed; // true if claimed, for example during GC traces. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
168 // To avoid applying oop closure more than once. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
169 // Has to be an int because we cas it. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
170 Klass* _klasses; // The classes defined by the class loader. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
171 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
172 JNIHandleBlock* _handles; // Handles to constant pool arrays |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
173 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
174 // These method IDs are created for the class loader and set to NULL when the |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
175 // class loader is unloaded. They are rarely freed, only for redefine classes |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
176 // and if they lose a data race in InstanceKlass. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
177 JNIMethodBlock* _jmethod_ids; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
178 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
179 // Metadata to be deallocated when it's safe at class unloading, when |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
180 // this class loader isn't unloaded itself. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
181 GrowableArray<Metadata*>* _deallocate_list; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
182 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
183 // Support for walking class loader data objects |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
184 ClassLoaderData* _next; /// Next loader_datas created |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
185 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
186 // ReadOnly and ReadWrite metaspaces (static because only on the null |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
187 // class loader for now). |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
188 static Metaspace* _ro_metaspace; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
189 static Metaspace* _rw_metaspace; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
190 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
191 void set_next(ClassLoaderData* next) { _next = next; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
192 ClassLoaderData* next() const { return _next; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
193 |
10184
9d75bcd7c890
8013136: NPG: Parallel class loading tests fail after fix for JDK-8011802
mgerdin
parents:
10181
diff
changeset
|
194 ClassLoaderData(Handle h_class_loader, bool is_anonymous, Dependencies dependencies); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
195 ~ClassLoaderData(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
196 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
197 void set_metaspace(Metaspace* m) { _metaspace = m; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
198 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
199 JNIHandleBlock* handles() const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
200 void set_handles(JNIHandleBlock* handles); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
201 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
202 Mutex* metaspace_lock() const { return _metaspace_lock; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
203 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
204 // GC interface. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
205 void clear_claimed() { _claimed = 0; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
206 bool claimed() const { return _claimed == 1; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
207 bool claim(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
208 |
7185
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6757
diff
changeset
|
209 void unload(); |
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6757
diff
changeset
|
210 bool keep_alive() const { return _keep_alive; } |
10405 | 211 void classes_do(void f(Klass*)); |
12995
e64f1fe9756b
8024423: JVMTI: GetLoadedClasses doesn't enumerate anonymous classes
farvidsson
parents:
10405
diff
changeset
|
212 void loaded_classes_do(KlassClosure* klass_closure); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
213 void classes_do(void f(InstanceKlass*)); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
214 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
215 // Deallocate free list during class unloading. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
216 void free_deallocate_list(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
217 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
218 // Allocate out of this class loader data |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
219 MetaWord* allocate(size_t size); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
220 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
221 public: |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
222 |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
223 bool is_alive(BoolObjectClosure* is_alive_closure) const; |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
224 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
225 // Accessors |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
226 Metaspace* metaspace_or_null() const { return _metaspace; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
227 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
228 static ClassLoaderData* the_null_class_loader_data() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
229 return _the_null_class_loader_data; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
230 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
231 |
7409 | 232 bool is_anonymous() const { return _is_anonymous; } |
7185
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6757
diff
changeset
|
233 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
234 static void init_null_class_loader_data() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
235 assert(_the_null_class_loader_data == NULL, "cannot initialize twice"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
236 assert(ClassLoaderDataGraph::_head == NULL, "cannot initialize twice"); |
10184
9d75bcd7c890
8013136: NPG: Parallel class loading tests fail after fix for JDK-8011802
mgerdin
parents:
10181
diff
changeset
|
237 |
9d75bcd7c890
8013136: NPG: Parallel class loading tests fail after fix for JDK-8011802
mgerdin
parents:
10181
diff
changeset
|
238 // We explicitly initialize the Dependencies object at a later phase in the initialization |
9d75bcd7c890
8013136: NPG: Parallel class loading tests fail after fix for JDK-8011802
mgerdin
parents:
10181
diff
changeset
|
239 _the_null_class_loader_data = new ClassLoaderData((oop)NULL, false, Dependencies()); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
240 ClassLoaderDataGraph::_head = _the_null_class_loader_data; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
241 assert(_the_null_class_loader_data->is_the_null_class_loader_data(), "Must be"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
242 if (DumpSharedSpaces) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
243 _the_null_class_loader_data->initialize_shared_metaspaces(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
244 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
245 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
246 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
247 bool is_the_null_class_loader_data() const { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
248 return this == _the_null_class_loader_data; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
249 } |
8866
16885e702c88
7198429: need checked categorization of caller-sensitive methods in the JDK
twisti
parents:
8667
diff
changeset
|
250 bool is_ext_class_loader_data() const; |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
251 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
252 // The Metaspace is created lazily so may be NULL. This |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
253 // method will allocate a Metaspace if needed. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
254 Metaspace* metaspace_non_null(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
255 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
256 oop class_loader() const { return _class_loader; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
257 |
20260 | 258 // The object the GC is using to keep this ClassLoaderData alive. |
259 oop keep_alive_object() const; | |
260 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
261 // Returns true if this class loader data is for a loader going away. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
262 bool is_unloading() const { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
263 assert(!(is_the_null_class_loader_data() && _unloading), "The null class loader can never be unloaded"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
264 return _unloading; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
265 } |
20260 | 266 |
267 // Used to make sure that this CLD is not unloaded. | |
7185
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6757
diff
changeset
|
268 void set_keep_alive(bool value) { _keep_alive = value; } |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
269 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
270 unsigned int identity_hash() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
271 return _class_loader == NULL ? 0 : _class_loader->identity_hash(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
272 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
273 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
274 // Used when tracing from klasses. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
275 void oops_do(OopClosure* f, KlassClosure* klass_closure, bool must_claim); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
276 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
277 void classes_do(KlassClosure* klass_closure); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
278 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
279 JNIMethodBlock* jmethod_ids() const { return _jmethod_ids; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
280 void set_jmethod_ids(JNIMethodBlock* new_block) { _jmethod_ids = new_block; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
281 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
282 void print_value() { print_value_on(tty); } |
7956 | 283 void print_value_on(outputStream* out) const; |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
284 void dump(outputStream * const out) PRODUCT_RETURN; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
285 void verify(); |
7185
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6757
diff
changeset
|
286 const char* loader_name(); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
287 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
288 jobject add_handle(Handle h); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
289 void add_class(Klass* k); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
290 void remove_class(Klass* k); |
14378
48314d596a04
8027146: Class loading verification failure if GC occurs in Universe::flush_dependents_on
coleenp
parents:
14190
diff
changeset
|
291 bool contains_klass(Klass* k); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
292 void record_dependency(Klass* to, TRAPS); |
7185
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6757
diff
changeset
|
293 void init_dependencies(TRAPS); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
294 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
295 void add_to_deallocate_list(Metadata* m); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
296 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
297 static ClassLoaderData* class_loader_data(oop loader); |
8667
1f9994892f89
8008549: NPG: SystemDictionary::find(...) unnecessarily keeps class loaders alive
stefank
parents:
7956
diff
changeset
|
298 static ClassLoaderData* class_loader_data_or_null(oop loader); |
7185
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6757
diff
changeset
|
299 static ClassLoaderData* anonymous_class_loader_data(oop loader, TRAPS); |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
300 static void print_loader(ClassLoaderData *loader_data, outputStream *out); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
301 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
302 // CDS support |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
303 Metaspace* ro_metaspace(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
304 Metaspace* rw_metaspace(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
305 void initialize_shared_metaspaces(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
306 }; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
307 |
20278
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
308 // An iterator that distributes Klasses to parallel worker threads. |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
309 class ClassLoaderDataGraphKlassIteratorAtomic : public StackObj { |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
310 volatile Klass* _next_klass; |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
311 public: |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
312 ClassLoaderDataGraphKlassIteratorAtomic(); |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
313 Klass* next_klass(); |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
314 private: |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
315 static Klass* next_klass_in_cldg(Klass* klass); |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
316 }; |
2c6ef90f030a
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
20260
diff
changeset
|
317 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
318 class ClassLoaderDataGraphMetaspaceIterator : public StackObj { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
319 ClassLoaderData* _data; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
320 public: |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
321 ClassLoaderDataGraphMetaspaceIterator(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
322 ~ClassLoaderDataGraphMetaspaceIterator(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
323 bool repeat() { return _data != NULL; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
324 Metaspace* get_next() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
325 assert(_data != NULL, "Should not be NULL in call to the iterator"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
326 Metaspace* result = _data->metaspace_or_null(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
327 _data = _data->next(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
328 // This result might be NULL for class loaders without metaspace |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
329 // yet. It would be nice to return only non-null results but |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
330 // there is no guarantee that there will be a non-null result |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
331 // down the list so the caller is going to have to check. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
332 return result; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
333 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
334 }; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
diff
changeset
|
335 #endif // SHARE_VM_CLASSFILE_CLASSLOADERDATA_HPP |