author | mockner |
Wed, 03 Feb 2016 11:40:30 -0500 | |
changeset 35917 | 463d67f86eaa |
parent 35900 | d64cf9290fc4 |
child 35918 | 1e48ea715a0b |
permissions | -rw-r--r-- |
1 | 1 |
/* |
35917
463d67f86eaa
8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents:
35900
diff
changeset
|
2 |
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4584
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4584
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4584
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
30764 | 26 |
#include "classfile/dictionary.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
27 |
#include "classfile/javaClasses.hpp" |
7397 | 28 |
#include "classfile/systemDictionary.hpp" |
29 |
#include "classfile/vmSymbols.hpp" |
|
30764 | 30 |
#include "gc/shared/collectedHeap.inline.hpp" |
35917
463d67f86eaa
8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents:
35900
diff
changeset
|
31 |
#include "logging/log.hpp" |
15437 | 32 |
#include "memory/heapInspection.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
33 |
#include "memory/metadataFactory.hpp" |
7397 | 34 |
#include "memory/oopFactory.hpp" |
35 |
#include "memory/resourceArea.hpp" |
|
36 |
#include "oops/instanceKlass.hpp" |
|
37 |
#include "oops/klass.inline.hpp" |
|
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28731
diff
changeset
|
38 |
#include "oops/oop.inline.hpp" |
24351
61b33cc6d3cf
8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
24330
diff
changeset
|
39 |
#include "runtime/atomic.inline.hpp" |
61b33cc6d3cf
8042195: Introduce umbrella header orderAccess.inline.hpp.
goetz
parents:
24330
diff
changeset
|
40 |
#include "runtime/orderAccess.inline.hpp" |
18025 | 41 |
#include "trace/traceMacros.hpp" |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
14588
diff
changeset
|
42 |
#include "utilities/macros.hpp" |
29702
9ed339a5e096
8075809: Add missing includes of stack.inline.hpp
stefank
parents:
29081
diff
changeset
|
43 |
#include "utilities/stack.inline.hpp" |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
14588
diff
changeset
|
44 |
#if INCLUDE_ALL_GCS |
30764 | 45 |
#include "gc/g1/g1SATBCardTableModRefBS.hpp" |
15482
470d0b0c09f1
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents:
14588
diff
changeset
|
46 |
#endif // INCLUDE_ALL_GCS |
1 | 47 |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
48 |
void Klass::set_name(Symbol* n) { |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
49 |
_name = n; |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
50 |
if (_name != NULL) _name->increment_refcount(); |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
51 |
} |
1 | 52 |
|
17370
59a0620561fa
8003557: NPG: Klass* const k should be const Klass* k.
minqi
parents:
16352
diff
changeset
|
53 |
bool Klass::is_subclass_of(const Klass* k) const { |
1 | 54 |
// Run up the super chain and check |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
55 |
if (this == k) return true; |
1 | 56 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
57 |
Klass* t = const_cast<Klass*>(this)->super(); |
1 | 58 |
|
59 |
while (t != NULL) { |
|
60 |
if (t == k) return true; |
|
14488 | 61 |
t = t->super(); |
1 | 62 |
} |
63 |
return false; |
|
64 |
} |
|
65 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
66 |
bool Klass::search_secondary_supers(Klass* k) const { |
1 | 67 |
// Put some extra logic here out-of-line, before the search proper. |
68 |
// This cuts down the size of the inline method. |
|
69 |
||
70 |
// This is necessary, since I am never in my own secondary_super list. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
71 |
if (this == k) |
1 | 72 |
return true; |
73 |
// Scan the array-of-objects for a match |
|
74 |
int cnt = secondary_supers()->length(); |
|
75 |
for (int i = 0; i < cnt; i++) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
76 |
if (secondary_supers()->at(i) == k) { |
1 | 77 |
((Klass*)this)->set_secondary_super_cache(k); |
78 |
return true; |
|
79 |
} |
|
80 |
} |
|
81 |
return false; |
|
82 |
} |
|
83 |
||
84 |
// Return self, except for abstract classes with exactly 1 |
|
85 |
// implementor. Then return the 1 concrete implementation. |
|
86 |
Klass *Klass::up_cast_abstract() { |
|
87 |
Klass *r = this; |
|
88 |
while( r->is_abstract() ) { // Receiver is abstract? |
|
89 |
Klass *s = r->subklass(); // Check for exactly 1 subklass |
|
90 |
if( !s || s->next_sibling() ) // Oops; wrong count; give up |
|
91 |
return this; // Return 'this' as a no-progress flag |
|
92 |
r = s; // Loop till find concrete class |
|
93 |
} |
|
94 |
return r; // Return the 1 concrete class |
|
95 |
} |
|
96 |
||
2131 | 97 |
// Find LCA in class hierarchy |
1 | 98 |
Klass *Klass::LCA( Klass *k2 ) { |
99 |
Klass *k1 = this; |
|
100 |
while( 1 ) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
101 |
if( k1->is_subtype_of(k2) ) return k2; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
102 |
if( k2->is_subtype_of(k1) ) return k1; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
103 |
k1 = k1->super(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
104 |
k2 = k2->super(); |
1 | 105 |
} |
106 |
} |
|
107 |
||
108 |
||
109 |
void Klass::check_valid_for_instantiation(bool throwError, TRAPS) { |
|
110 |
ResourceMark rm(THREAD); |
|
111 |
THROW_MSG(throwError ? vmSymbols::java_lang_InstantiationError() |
|
112 |
: vmSymbols::java_lang_InstantiationException(), external_name()); |
|
113 |
} |
|
114 |
||
115 |
||
116 |
void Klass::copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS) { |
|
117 |
THROW(vmSymbols::java_lang_ArrayStoreException()); |
|
118 |
} |
|
119 |
||
120 |
||
121 |
void Klass::initialize(TRAPS) { |
|
122 |
ShouldNotReachHere(); |
|
123 |
} |
|
124 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
125 |
bool Klass::compute_is_subtype_of(Klass* k) { |
1 | 126 |
assert(k->is_klass(), "argument must be a class"); |
127 |
return is_subclass_of(k); |
|
128 |
} |
|
129 |
||
27020 | 130 |
Klass* Klass::find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const { |
131 |
#ifdef ASSERT |
|
132 |
tty->print_cr("Error: find_field called on a klass oop." |
|
133 |
" Likely error: reflection method does not correctly" |
|
134 |
" wrap return value in a mirror object."); |
|
135 |
#endif |
|
136 |
ShouldNotReachHere(); |
|
137 |
return NULL; |
|
138 |
} |
|
1 | 139 |
|
34666 | 140 |
Method* Klass::uncached_lookup_method(const Symbol* name, const Symbol* signature, OverpassLookupMode overpass_mode) const { |
1 | 141 |
#ifdef ASSERT |
142 |
tty->print_cr("Error: uncached_lookup_method called on a klass oop." |
|
143 |
" Likely error: reflection method does not correctly" |
|
144 |
" wrap return value in a mirror object."); |
|
145 |
#endif |
|
146 |
ShouldNotReachHere(); |
|
147 |
return NULL; |
|
148 |
} |
|
149 |
||
19696
bd5a0131bde1
8021954: VM SIGSEGV during classloading on MacOS; hs_err_pid file produced
coleenp
parents:
18687
diff
changeset
|
150 |
void* Klass::operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, TRAPS) throw() { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
151 |
return Metaspace::allocate(loader_data, word_size, /*read_only*/false, |
27680
8ecc0871c18e
8064811: Use THREAD instead of CHECK_NULL in return statements
stefank
parents:
27020
diff
changeset
|
152 |
MetaspaceObj::ClassType, THREAD); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
153 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
154 |
|
34666 | 155 |
// "Normal" instantiation is preceeded by a MetaspaceObj allocation |
156 |
// which zeros out memory - calloc equivalent. |
|
157 |
// The constructor is also used from init_self_patching_vtbl_list, |
|
158 |
// which doesn't zero out the memory before calling the constructor. |
|
159 |
// Need to set the _java_mirror field explicitly to not hit an assert that the field |
|
160 |
// should be NULL before setting it. |
|
161 |
Klass::Klass() : _prototype_header(markOopDesc::prototype()), |
|
162 |
_shared_class_path_index(-1), |
|
163 |
_java_mirror(NULL) { |
|
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
164 |
|
34666 | 165 |
_primary_supers[0] = this; |
166 |
set_super_check_offset(in_bytes(primary_supers_offset())); |
|
1 | 167 |
} |
168 |
||
169 |
jint Klass::array_layout_helper(BasicType etype) { |
|
170 |
assert(etype >= T_BOOLEAN && etype <= T_OBJECT, "valid etype"); |
|
171 |
// Note that T_ARRAY is not allowed here. |
|
172 |
int hsize = arrayOopDesc::base_offset_in_bytes(etype); |
|
202
dc13bf0e5d5d
6633953: type2aelembytes{T_ADDRESS} should be 8 bytes in 64 bit VM
kvn
parents:
1
diff
changeset
|
173 |
int esize = type2aelembytes(etype); |
1 | 174 |
bool isobj = (etype == T_OBJECT); |
175 |
int tag = isobj ? _lh_array_tag_obj_value : _lh_array_tag_type_value; |
|
176 |
int lh = array_layout_helper(tag, hsize, etype, exact_log2(esize)); |
|
177 |
||
178 |
assert(lh < (int)_lh_neutral_value, "must look like an array layout"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
179 |
assert(layout_helper_is_array(lh), "correct kind"); |
1 | 180 |
assert(layout_helper_is_objArray(lh) == isobj, "correct kind"); |
181 |
assert(layout_helper_is_typeArray(lh) == !isobj, "correct kind"); |
|
182 |
assert(layout_helper_header_size(lh) == hsize, "correct decode"); |
|
183 |
assert(layout_helper_element_type(lh) == etype, "correct decode"); |
|
184 |
assert(1 << layout_helper_log2_element_size(lh) == esize, "correct decode"); |
|
185 |
||
186 |
return lh; |
|
187 |
} |
|
188 |
||
189 |
bool Klass::can_be_primary_super_slow() const { |
|
190 |
if (super() == NULL) |
|
191 |
return true; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
192 |
else if (super()->super_depth() >= primary_super_limit()-1) |
1 | 193 |
return false; |
194 |
else |
|
195 |
return true; |
|
196 |
} |
|
197 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
198 |
void Klass::initialize_supers(Klass* k, TRAPS) { |
1 | 199 |
if (FastSuperclassLimit == 0) { |
200 |
// None of the other machinery matters. |
|
201 |
set_super(k); |
|
202 |
return; |
|
203 |
} |
|
204 |
if (k == NULL) { |
|
205 |
set_super(NULL); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
206 |
_primary_supers[0] = this; |
1 | 207 |
assert(super_depth() == 0, "Object must already be initialized properly"); |
4571 | 208 |
} else if (k != super() || k == SystemDictionary::Object_klass()) { |
209 |
assert(super() == NULL || super() == SystemDictionary::Object_klass(), |
|
1 | 210 |
"initialize this only once to a non-trivial value"); |
211 |
set_super(k); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
212 |
Klass* sup = k; |
1 | 213 |
int sup_depth = sup->super_depth(); |
214 |
juint my_depth = MIN2(sup_depth + 1, (int)primary_super_limit()); |
|
215 |
if (!can_be_primary_super_slow()) |
|
216 |
my_depth = primary_super_limit(); |
|
217 |
for (juint i = 0; i < my_depth; i++) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
218 |
_primary_supers[i] = sup->_primary_supers[i]; |
1 | 219 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
220 |
Klass* *super_check_cell; |
1 | 221 |
if (my_depth < primary_super_limit()) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
222 |
_primary_supers[my_depth] = this; |
1 | 223 |
super_check_cell = &_primary_supers[my_depth]; |
224 |
} else { |
|
225 |
// Overflow of the primary_supers array forces me to be secondary. |
|
226 |
super_check_cell = &_secondary_super_cache; |
|
227 |
} |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
228 |
set_super_check_offset((address)super_check_cell - (address) this); |
1 | 229 |
|
230 |
#ifdef ASSERT |
|
231 |
{ |
|
232 |
juint j = super_depth(); |
|
233 |
assert(j == my_depth, "computed accessor gets right answer"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
234 |
Klass* t = this; |
14488 | 235 |
while (!t->can_be_primary_super()) { |
236 |
t = t->super(); |
|
237 |
j = t->super_depth(); |
|
1 | 238 |
} |
239 |
for (juint j1 = j+1; j1 < primary_super_limit(); j1++) { |
|
240 |
assert(primary_super_of_depth(j1) == NULL, "super list padding"); |
|
241 |
} |
|
242 |
while (t != NULL) { |
|
243 |
assert(primary_super_of_depth(j) == t, "super list initialization"); |
|
14488 | 244 |
t = t->super(); |
1 | 245 |
--j; |
246 |
} |
|
247 |
assert(j == (juint)-1, "correct depth count"); |
|
248 |
} |
|
249 |
#endif |
|
250 |
} |
|
251 |
||
252 |
if (secondary_supers() == NULL) { |
|
253 |
KlassHandle this_kh (THREAD, this); |
|
254 |
||
255 |
// Now compute the list of secondary supertypes. |
|
256 |
// Secondaries can occasionally be on the super chain, |
|
257 |
// if the inline "_primary_supers" array overflows. |
|
258 |
int extras = 0; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
259 |
Klass* p; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
260 |
for (p = super(); !(p == NULL || p->can_be_primary_super()); p = p->super()) { |
1 | 261 |
++extras; |
262 |
} |
|
263 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
264 |
ResourceMark rm(THREAD); // need to reclaim GrowableArrays allocated below |
1 | 265 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
266 |
// Compute the "real" non-extra secondaries. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
267 |
GrowableArray<Klass*>* secondaries = compute_secondary_supers(extras); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
268 |
if (secondaries == NULL) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
269 |
// secondary_supers set by compute_secondary_supers |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
270 |
return; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
271 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
272 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
273 |
GrowableArray<Klass*>* primaries = new GrowableArray<Klass*>(extras); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
274 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
275 |
for (p = this_kh->super(); !(p == NULL || p->can_be_primary_super()); p = p->super()) { |
1 | 276 |
int i; // Scan for overflow primaries being duplicates of 2nd'arys |
277 |
||
278 |
// This happens frequently for very deeply nested arrays: the |
|
279 |
// primary superclass chain overflows into the secondary. The |
|
280 |
// secondary list contains the element_klass's secondaries with |
|
281 |
// an extra array dimension added. If the element_klass's |
|
282 |
// secondary list already contains some primary overflows, they |
|
283 |
// (with the extra level of array-ness) will collide with the |
|
284 |
// normal primary superclass overflows. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
285 |
for( i = 0; i < secondaries->length(); i++ ) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
286 |
if( secondaries->at(i) == p ) |
1 | 287 |
break; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
288 |
} |
1 | 289 |
if( i < secondaries->length() ) |
290 |
continue; // It's a dup, don't put it in |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
291 |
primaries->push(p); |
1 | 292 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
293 |
// Combine the two arrays into a metadata object to pack the array. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
294 |
// The primaries are added in the reverse order, then the secondaries. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
295 |
int new_length = primaries->length() + secondaries->length(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
296 |
Array<Klass*>* s2 = MetadataFactory::new_array<Klass*>( |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
297 |
class_loader_data(), new_length, CHECK); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
298 |
int fill_p = primaries->length(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
299 |
for (int j = 0; j < fill_p; j++) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
300 |
s2->at_put(j, primaries->pop()); // add primaries in reverse order. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
301 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
302 |
for( int j = 0; j < secondaries->length(); j++ ) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
303 |
s2->at_put(j+fill_p, secondaries->at(j)); // add secondaries on the end. |
1 | 304 |
} |
305 |
||
306 |
#ifdef ASSERT |
|
307 |
// We must not copy any NULL placeholders left over from bootstrap. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
308 |
for (int j = 0; j < s2->length(); j++) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
309 |
assert(s2->at(j) != NULL, "correct bootstrapping order"); |
1 | 310 |
} |
311 |
#endif |
|
312 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
313 |
this_kh->set_secondary_supers(s2); |
1 | 314 |
} |
315 |
} |
|
316 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
317 |
GrowableArray<Klass*>* Klass::compute_secondary_supers(int num_extra_slots) { |
1 | 318 |
assert(num_extra_slots == 0, "override for complex klasses"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
319 |
set_secondary_supers(Universe::the_empty_klass_array()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
320 |
return NULL; |
1 | 321 |
} |
322 |
||
323 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
324 |
InstanceKlass* Klass::superklass() const { |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33602
diff
changeset
|
325 |
assert(super() == NULL || super()->is_instance_klass(), "must be instance klass"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
326 |
return _super == NULL ? NULL : InstanceKlass::cast(_super); |
1 | 327 |
} |
328 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
329 |
void Klass::set_subklass(Klass* s) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
330 |
assert(s != this, "sanity check"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
331 |
_subklass = s; |
1 | 332 |
} |
333 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
334 |
void Klass::set_next_sibling(Klass* s) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
335 |
assert(s != this, "sanity check"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
336 |
_next_sibling = s; |
1 | 337 |
} |
338 |
||
339 |
void Klass::append_to_sibling_list() { |
|
14078 | 340 |
debug_only(verify();) |
1 | 341 |
// add ourselves to superklass' subklass list |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
342 |
InstanceKlass* super = superklass(); |
1 | 343 |
if (super == NULL) return; // special case: class Object |
14078 | 344 |
assert((!super->is_interface() // interfaces cannot be supers |
1 | 345 |
&& (super->superklass() == NULL || !is_interface())), |
346 |
"an interface can only be a subklass of Object"); |
|
23515
f4872ef5df09
8031820: NPG: Fix remaining references to metadata as oops in comments
coleenp
parents:
22908
diff
changeset
|
347 |
Klass* prev_first_subklass = super->subklass(); |
1 | 348 |
if (prev_first_subklass != NULL) { |
349 |
// set our sibling to be the superklass' previous first subklass |
|
350 |
set_next_sibling(prev_first_subklass); |
|
351 |
} |
|
352 |
// make ourselves the superklass' first subklass |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
353 |
super->set_subklass(this); |
14078 | 354 |
debug_only(verify();) |
1 | 355 |
} |
356 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
357 |
bool Klass::is_loader_alive(BoolObjectClosure* is_alive) { |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
358 |
#ifdef ASSERT |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
359 |
// The class is alive iff the class loader is alive. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
360 |
oop loader = class_loader(); |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
361 |
bool loader_alive = (loader == NULL) || is_alive->do_object_b(loader); |
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
362 |
#endif // ASSERT |
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
363 |
|
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
364 |
// The class is alive if it's mirror is alive (which should be marked if the |
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
365 |
// loader is alive) unless it's an anoymous class. |
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
366 |
bool mirror_alive = is_alive->do_object_b(java_mirror()); |
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
367 |
assert(!mirror_alive || loader_alive, "loader must be alive if the mirror is" |
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
368 |
" but not the other way around with anonymous classes"); |
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
369 |
return mirror_alive; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
370 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
371 |
|
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
372 |
void Klass::clean_weak_klass_links(BoolObjectClosure* is_alive, bool clean_alive_klasses) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
373 |
if (!ClassUnloading) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
374 |
return; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
375 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
376 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
377 |
Klass* root = SystemDictionary::Object_klass(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
378 |
Stack<Klass*, mtGC> stack; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
379 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
380 |
stack.push(root); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
381 |
while (!stack.is_empty()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
382 |
Klass* current = stack.pop(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
383 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
384 |
assert(current->is_loader_alive(is_alive), "just checking, this should be live"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
385 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
386 |
// Find and set the first alive subklass |
23515
f4872ef5df09
8031820: NPG: Fix remaining references to metadata as oops in comments
coleenp
parents:
22908
diff
changeset
|
387 |
Klass* sub = current->subklass(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
388 |
while (sub != NULL && !sub->is_loader_alive(is_alive)) { |
1 | 389 |
#ifndef PRODUCT |
35917
463d67f86eaa
8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents:
35900
diff
changeset
|
390 |
if (log_is_enabled(Trace, classunload)) { |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
391 |
ResourceMark rm; |
35917
463d67f86eaa
8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents:
35900
diff
changeset
|
392 |
log_trace(classunload)("unlinking class (subclass): %s", sub->external_name()); |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
393 |
} |
1 | 394 |
#endif |
23515
f4872ef5df09
8031820: NPG: Fix remaining references to metadata as oops in comments
coleenp
parents:
22908
diff
changeset
|
395 |
sub = sub->next_sibling(); |
1 | 396 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
397 |
current->set_subklass(sub); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
398 |
if (sub != NULL) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
399 |
stack.push(sub); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
400 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
401 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
402 |
// Find and set the first alive sibling |
23515
f4872ef5df09
8031820: NPG: Fix remaining references to metadata as oops in comments
coleenp
parents:
22908
diff
changeset
|
403 |
Klass* sibling = current->next_sibling(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
404 |
while (sibling != NULL && !sibling->is_loader_alive(is_alive)) { |
35917
463d67f86eaa
8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents:
35900
diff
changeset
|
405 |
if (log_is_enabled(Trace, classunload)) { |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
406 |
ResourceMark rm; |
35917
463d67f86eaa
8079408: Reimplement TraceClassLoading, TraceClassUnloading, and TraceClassLoaderData with Unified Logging.
mockner
parents:
35900
diff
changeset
|
407 |
log_trace(classunload)("[Unlinking class (sibling) %s]", sibling->external_name()); |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
408 |
} |
23515
f4872ef5df09
8031820: NPG: Fix remaining references to metadata as oops in comments
coleenp
parents:
22908
diff
changeset
|
409 |
sibling = sibling->next_sibling(); |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
410 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
411 |
current->set_next_sibling(sibling); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
412 |
if (sibling != NULL) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
413 |
stack.push(sibling); |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
414 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
415 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
416 |
// Clean the implementors list and method data. |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33602
diff
changeset
|
417 |
if (clean_alive_klasses && current->is_instance_klass()) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
418 |
InstanceKlass* ik = InstanceKlass::cast(current); |
33576
6dbde58b08a6
8058563: InstanceKlass::_dependencies list isn't cleared from empty nmethodBucket entries
stefank
parents:
33151
diff
changeset
|
419 |
ik->clean_weak_instanceklass_links(is_alive); |
1 | 420 |
} |
421 |
} |
|
422 |
} |
|
423 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
424 |
void Klass::klass_update_barrier_set(oop v) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
425 |
record_modified_oops(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
426 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
427 |
|
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
428 |
// This barrier is used by G1 to remember the old oop values, so |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
429 |
// that we don't forget any objects that were live at the snapshot at |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
430 |
// the beginning. This function is only used when we write oops into Klasses. |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
431 |
void Klass::klass_update_barrier_set_pre(oop* p, oop v) { |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
432 |
#if INCLUDE_ALL_GCS |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
433 |
if (UseG1GC) { |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
434 |
oop obj = *p; |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
435 |
if (obj != NULL) { |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
436 |
G1SATBCardTableModRefBS::enqueue(obj); |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
437 |
} |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
438 |
} |
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
439 |
#endif |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
440 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
441 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
442 |
void Klass::klass_oop_store(oop* p, oop v) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
443 |
assert(!Universe::heap()->is_in_reserved((void*)p), "Should store pointer into metadata"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
444 |
assert(v == NULL || Universe::heap()->is_in_reserved((void*)v), "Should store pointer to an object"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
445 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
446 |
// do the store |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
447 |
if (always_do_update_barrier) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
448 |
klass_oop_store((volatile oop*)p, v); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
449 |
} else { |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
450 |
klass_update_barrier_set_pre(p, v); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
451 |
*p = v; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
452 |
klass_update_barrier_set(v); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
453 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
454 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
455 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
456 |
void Klass::klass_oop_store(volatile oop* p, oop v) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
457 |
assert(!Universe::heap()->is_in_reserved((void*)p), "Should store pointer into metadata"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
458 |
assert(v == NULL || Universe::heap()->is_in_reserved((void*)v), "Should store pointer to an object"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
459 |
|
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
460 |
klass_update_barrier_set_pre((oop*)p, v); // Cast away volatile. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
461 |
OrderAccess::release_store_ptr(p, v); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
462 |
klass_update_barrier_set(v); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
463 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
464 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
465 |
void Klass::oops_do(OopClosure* cl) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
466 |
cl->do_oop(&_java_mirror); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
467 |
} |
1 | 468 |
|
469 |
void Klass::remove_unshareable_info() { |
|
23872
536c66fc43d3
8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)
coleenp
parents:
23515
diff
changeset
|
470 |
assert (DumpSharedSpaces, "only called for DumpSharedSpaces"); |
536c66fc43d3
8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)
coleenp
parents:
23515
diff
changeset
|
471 |
|
1 | 472 |
set_subklass(NULL); |
473 |
set_next_sibling(NULL); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
474 |
// Clear the java mirror |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
475 |
set_java_mirror(NULL); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
476 |
set_next_link(NULL); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
477 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
478 |
// Null out class_loader_data because we don't share that yet. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
479 |
set_class_loader_data(NULL); |
1 | 480 |
} |
481 |
||
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25492
diff
changeset
|
482 |
void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) { |
24240
1b9b92b51f60
8041723: Event Based tracing ids to be reassigned for CDS klasses
mgronlun
parents:
23999
diff
changeset
|
483 |
TRACE_INIT_ID(this); |
23872
536c66fc43d3
8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)
coleenp
parents:
23515
diff
changeset
|
484 |
// If an exception happened during CDS restore, some of these fields may already be |
536c66fc43d3
8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)
coleenp
parents:
23515
diff
changeset
|
485 |
// set. We leave the class on the CLD list, even if incomplete so that we don't |
536c66fc43d3
8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)
coleenp
parents:
23515
diff
changeset
|
486 |
// modify the CLD list outside a safepoint. |
536c66fc43d3
8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)
coleenp
parents:
23515
diff
changeset
|
487 |
if (class_loader_data() == NULL) { |
536c66fc43d3
8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)
coleenp
parents:
23515
diff
changeset
|
488 |
// Restore class_loader_data to the null class loader data |
536c66fc43d3
8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)
coleenp
parents:
23515
diff
changeset
|
489 |
set_class_loader_data(loader_data); |
1 | 490 |
|
23872
536c66fc43d3
8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)
coleenp
parents:
23515
diff
changeset
|
491 |
// Add to null class loader list first before creating the mirror |
536c66fc43d3
8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)
coleenp
parents:
23515
diff
changeset
|
492 |
// (same order as class file parsing) |
536c66fc43d3
8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)
coleenp
parents:
23515
diff
changeset
|
493 |
loader_data->add_class(this); |
536c66fc43d3
8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)
coleenp
parents:
23515
diff
changeset
|
494 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
495 |
|
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25492
diff
changeset
|
496 |
// Recreate the class mirror. |
23872
536c66fc43d3
8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)
coleenp
parents:
23515
diff
changeset
|
497 |
// Only recreate it if not present. A previous attempt to restore may have |
536c66fc43d3
8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)
coleenp
parents:
23515
diff
changeset
|
498 |
// gotten an OOM later but keep the mirror if it was created. |
536c66fc43d3
8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)
coleenp
parents:
23515
diff
changeset
|
499 |
if (java_mirror() == NULL) { |
26135
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25492
diff
changeset
|
500 |
Handle loader = loader_data->class_loader(); |
82b516c550f7
8046070: Class Data Sharing clean up and refactoring
iklam
parents:
25492
diff
changeset
|
501 |
java_lang_Class::create_mirror(this, loader, protection_domain, CHECK); |
23872
536c66fc43d3
8028497: SIGSEGV at ClassLoaderData::oops_do(OopClosure*, KlassClosure*, bool)
coleenp
parents:
23515
diff
changeset
|
502 |
} |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
503 |
} |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
504 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
505 |
Klass* Klass::array_klass_or_null(int rank) { |
1 | 506 |
EXCEPTION_MARK; |
507 |
// No exception can be thrown by array_klass_impl when called with or_null == true. |
|
508 |
// (In anycase, the execption mark will fail if it do so) |
|
509 |
return array_klass_impl(true, rank, THREAD); |
|
510 |
} |
|
511 |
||
512 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
513 |
Klass* Klass::array_klass_or_null() { |
1 | 514 |
EXCEPTION_MARK; |
515 |
// No exception can be thrown by array_klass_impl when called with or_null == true. |
|
516 |
// (In anycase, the execption mark will fail if it do so) |
|
517 |
return array_klass_impl(true, THREAD); |
|
518 |
} |
|
519 |
||
520 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
521 |
Klass* Klass::array_klass_impl(bool or_null, int rank, TRAPS) { |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
522 |
fatal("array_klass should be dispatched to InstanceKlass, ObjArrayKlass or TypeArrayKlass"); |
1 | 523 |
return NULL; |
524 |
} |
|
525 |
||
526 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
527 |
Klass* Klass::array_klass_impl(bool or_null, TRAPS) { |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
528 |
fatal("array_klass should be dispatched to InstanceKlass, ObjArrayKlass or TypeArrayKlass"); |
1 | 529 |
return NULL; |
530 |
} |
|
531 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
532 |
oop Klass::class_loader() const { return class_loader_data()->class_loader(); } |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
533 |
|
33602 | 534 |
// In product mode, this function doesn't have virtual function calls so |
535 |
// there might be some performance advantage to handling InstanceKlass here. |
|
1 | 536 |
const char* Klass::external_name() const { |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33602
diff
changeset
|
537 |
if (is_instance_klass()) { |
33602 | 538 |
const InstanceKlass* ik = static_cast<const InstanceKlass*>(this); |
1550
be2fc37a817f
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
670
diff
changeset
|
539 |
if (ik->is_anonymous()) { |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
540 |
intptr_t hash = 0; |
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
541 |
if (ik->java_mirror() != NULL) { |
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
542 |
// java_mirror might not be created yet, return 0 as hash. |
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
543 |
hash = ik->java_mirror()->identity_hash(); |
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
544 |
} |
1550
be2fc37a817f
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
670
diff
changeset
|
545 |
char hash_buf[40]; |
be2fc37a817f
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
670
diff
changeset
|
546 |
sprintf(hash_buf, "/" UINTX_FORMAT, (uintx)hash); |
be2fc37a817f
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
670
diff
changeset
|
547 |
size_t hash_len = strlen(hash_buf); |
be2fc37a817f
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
670
diff
changeset
|
548 |
|
be2fc37a817f
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
670
diff
changeset
|
549 |
size_t result_len = name()->utf8_length(); |
be2fc37a817f
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
670
diff
changeset
|
550 |
char* result = NEW_RESOURCE_ARRAY(char, result_len + hash_len + 1); |
be2fc37a817f
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
670
diff
changeset
|
551 |
name()->as_klass_external_name(result, (int) result_len + 1); |
be2fc37a817f
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
670
diff
changeset
|
552 |
assert(strlen(result) == result_len, ""); |
be2fc37a817f
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
670
diff
changeset
|
553 |
strcpy(result + result_len, hash_buf); |
be2fc37a817f
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
670
diff
changeset
|
554 |
assert(strlen(result) == result_len + hash_len, ""); |
be2fc37a817f
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
670
diff
changeset
|
555 |
return result; |
be2fc37a817f
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
670
diff
changeset
|
556 |
} |
be2fc37a817f
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
670
diff
changeset
|
557 |
} |
4094
1f424b2b2171
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
2131
diff
changeset
|
558 |
if (name() == NULL) return "<unknown>"; |
1 | 559 |
return name()->as_klass_external_name(); |
560 |
} |
|
561 |
||
562 |
||
4094
1f424b2b2171
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
2131
diff
changeset
|
563 |
const char* Klass::signature_name() const { |
1f424b2b2171
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
2131
diff
changeset
|
564 |
if (name() == NULL) return "<unknown>"; |
1 | 565 |
return name()->as_C_string(); |
566 |
} |
|
567 |
||
568 |
// Unless overridden, modifier_flags is 0. |
|
569 |
jint Klass::compute_modifier_flags(TRAPS) const { |
|
570 |
return 0; |
|
571 |
} |
|
572 |
||
573 |
int Klass::atomic_incr_biased_lock_revocation_count() { |
|
574 |
return (int) Atomic::add(1, &_biased_lock_revocation_count); |
|
575 |
} |
|
576 |
||
577 |
// Unless overridden, jvmti_class_status has no flags set. |
|
578 |
jint Klass::jvmti_class_status() const { |
|
579 |
return 0; |
|
580 |
} |
|
581 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
582 |
|
1 | 583 |
// Printing |
584 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
585 |
void Klass::print_on(outputStream* st) const { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
586 |
ResourceMark rm; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
587 |
// print title |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
588 |
st->print("%s", internal_name()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
589 |
print_address_on(st); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
590 |
st->cr(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
591 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
592 |
|
1 | 593 |
void Klass::oop_print_on(oop obj, outputStream* st) { |
594 |
ResourceMark rm; |
|
595 |
// print title |
|
596 |
st->print_cr("%s ", internal_name()); |
|
597 |
obj->print_address_on(st); |
|
598 |
||
599 |
if (WizardMode) { |
|
600 |
// print header |
|
601 |
obj->mark()->print_on(st); |
|
602 |
} |
|
603 |
||
604 |
// print class |
|
605 |
st->print(" - klass: "); |
|
606 |
obj->klass()->print_value_on(st); |
|
607 |
st->cr(); |
|
608 |
} |
|
609 |
||
610 |
void Klass::oop_print_value_on(oop obj, outputStream* st) { |
|
611 |
// print title |
|
612 |
ResourceMark rm; // Cannot print in debug mode without this |
|
613 |
st->print("%s", internal_name()); |
|
614 |
obj->print_address_on(st); |
|
615 |
} |
|
616 |
||
15437 | 617 |
#if INCLUDE_SERVICES |
618 |
// Size Statistics |
|
619 |
void Klass::collect_statistics(KlassSizeStats *sz) const { |
|
620 |
sz->_klass_bytes = sz->count(this); |
|
621 |
sz->_mirror_bytes = sz->count(java_mirror()); |
|
622 |
sz->_secondary_supers_bytes = sz->count_array(secondary_supers()); |
|
623 |
||
624 |
sz->_ro_bytes += sz->_secondary_supers_bytes; |
|
625 |
sz->_rw_bytes += sz->_klass_bytes + sz->_mirror_bytes; |
|
626 |
} |
|
627 |
#endif // INCLUDE_SERVICES |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
628 |
|
1 | 629 |
// Verification |
630 |
||
22794
f1c014ad3754
8027146: Class loading verification failure if GC occurs in Universe::flush_dependents_on
coleenp
parents:
22201
diff
changeset
|
631 |
void Klass::verify_on(outputStream* st) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
632 |
|
18439 | 633 |
// This can be expensive, but it is worth checking that this klass is actually |
634 |
// in the CLD graph but not in production. |
|
24457
0e20b36df5c4
8038212: Method::is_valid_method() check has performance regression impact for stackwalking
coleenp
parents:
24351
diff
changeset
|
635 |
assert(Metaspace::contains((address)this), "Should be"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
636 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
637 |
guarantee(this->is_klass(),"should be klass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
638 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
639 |
if (super() != NULL) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
640 |
guarantee(super()->is_klass(), "should be klass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
641 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
642 |
if (secondary_super_cache() != NULL) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
643 |
Klass* ko = secondary_super_cache(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
644 |
guarantee(ko->is_klass(), "should be klass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
645 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
646 |
for ( uint i = 0; i < primary_super_limit(); i++ ) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
647 |
Klass* ko = _primary_supers[i]; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
648 |
if (ko != NULL) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
649 |
guarantee(ko->is_klass(), "should be klass"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
650 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
651 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
652 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
653 |
if (java_mirror() != NULL) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
654 |
guarantee(java_mirror()->is_oop(), "should be instance"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
655 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
656 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12379
diff
changeset
|
657 |
|
1 | 658 |
void Klass::oop_verify_on(oop obj, outputStream* st) { |
659 |
guarantee(obj->is_oop(), "should be oop"); |
|
660 |
guarantee(obj->klass()->is_klass(), "klass field is not a klass"); |
|
661 |
} |
|
662 |
||
35900 | 663 |
klassVtable* Klass::vtable() const { |
664 |
return new klassVtable(this, start_of_vtable(), vtable_length() / vtableEntry::size()); |
|
665 |
} |
|
666 |
||
667 |
vtableEntry* Klass::start_of_vtable() const { |
|
668 |
return (vtableEntry*) ((address)this + in_bytes(vtable_start_offset())); |
|
669 |
} |
|
670 |
||
671 |
Method* Klass::method_at_vtable(int index) { |
|
672 |
#ifndef PRODUCT |
|
673 |
assert(index >= 0, "valid vtable index"); |
|
674 |
if (DebugVtables) { |
|
675 |
verify_vtable_index(index); |
|
676 |
} |
|
677 |
#endif |
|
678 |
return start_of_vtable()[index].method(); |
|
679 |
} |
|
680 |
||
35899 | 681 |
ByteSize Klass::vtable_start_offset() { |
682 |
return in_ByteSize(InstanceKlass::header_size() * wordSize); |
|
683 |
} |
|
684 |
||
1 | 685 |
#ifndef PRODUCT |
686 |
||
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
19696
diff
changeset
|
687 |
bool Klass::verify_vtable_index(int i) { |
33602 | 688 |
int limit = vtable_length()/vtableEntry::size(); |
689 |
assert(i >= 0 && i < limit, "index %d out of bounds %d", i, limit); |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
19696
diff
changeset
|
690 |
return true; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
19696
diff
changeset
|
691 |
} |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
19696
diff
changeset
|
692 |
|
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
19696
diff
changeset
|
693 |
bool Klass::verify_itable_index(int i) { |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33602
diff
changeset
|
694 |
assert(is_instance_klass(), ""); |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
19696
diff
changeset
|
695 |
int method_count = klassItable::method_count_for_interface(this); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
19696
diff
changeset
|
696 |
assert(i >= 0 && i < method_count, "index out of bounds"); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
19696
diff
changeset
|
697 |
return true; |
1 | 698 |
} |
699 |
||
700 |
#endif |
|
22908
8c4f06f6ea15
8035746: Add missing Klass::oop_is_instanceClassLoader() function
stefank
parents:
22794
diff
changeset
|
701 |
|
8c4f06f6ea15
8035746: Add missing Klass::oop_is_instanceClassLoader() function
stefank
parents:
22794
diff
changeset
|
702 |
/////////////// Unit tests /////////////// |
8c4f06f6ea15
8035746: Add missing Klass::oop_is_instanceClassLoader() function
stefank
parents:
22794
diff
changeset
|
703 |
|
8c4f06f6ea15
8035746: Add missing Klass::oop_is_instanceClassLoader() function
stefank
parents:
22794
diff
changeset
|
704 |
#ifndef PRODUCT |
8c4f06f6ea15
8035746: Add missing Klass::oop_is_instanceClassLoader() function
stefank
parents:
22794
diff
changeset
|
705 |
|
8c4f06f6ea15
8035746: Add missing Klass::oop_is_instanceClassLoader() function
stefank
parents:
22794
diff
changeset
|
706 |
class TestKlass { |
8c4f06f6ea15
8035746: Add missing Klass::oop_is_instanceClassLoader() function
stefank
parents:
22794
diff
changeset
|
707 |
public: |
8c4f06f6ea15
8035746: Add missing Klass::oop_is_instanceClassLoader() function
stefank
parents:
22794
diff
changeset
|
708 |
static void test_oop_is_instanceClassLoader() { |
33151
686d694f5c6a
8138659: Speed up InstanceKlass subclass discrimination
kbarrett
parents:
33105
diff
changeset
|
709 |
Klass* klass = SystemDictionary::ClassLoader_klass(); |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33602
diff
changeset
|
710 |
guarantee(klass->is_instance_klass(), "assert"); |
33151
686d694f5c6a
8138659: Speed up InstanceKlass subclass discrimination
kbarrett
parents:
33105
diff
changeset
|
711 |
guarantee(InstanceKlass::cast(klass)->is_class_loader_instance_klass(), "test failed"); |
686d694f5c6a
8138659: Speed up InstanceKlass subclass discrimination
kbarrett
parents:
33105
diff
changeset
|
712 |
|
686d694f5c6a
8138659: Speed up InstanceKlass subclass discrimination
kbarrett
parents:
33105
diff
changeset
|
713 |
klass = SystemDictionary::String_klass(); |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33602
diff
changeset
|
714 |
guarantee(!klass->is_instance_klass() || |
33151
686d694f5c6a
8138659: Speed up InstanceKlass subclass discrimination
kbarrett
parents:
33105
diff
changeset
|
715 |
!InstanceKlass::cast(klass)->is_class_loader_instance_klass(), |
686d694f5c6a
8138659: Speed up InstanceKlass subclass discrimination
kbarrett
parents:
33105
diff
changeset
|
716 |
"test failed"); |
22908
8c4f06f6ea15
8035746: Add missing Klass::oop_is_instanceClassLoader() function
stefank
parents:
22794
diff
changeset
|
717 |
} |
8c4f06f6ea15
8035746: Add missing Klass::oop_is_instanceClassLoader() function
stefank
parents:
22794
diff
changeset
|
718 |
}; |
8c4f06f6ea15
8035746: Add missing Klass::oop_is_instanceClassLoader() function
stefank
parents:
22794
diff
changeset
|
719 |
|
8c4f06f6ea15
8035746: Add missing Klass::oop_is_instanceClassLoader() function
stefank
parents:
22794
diff
changeset
|
720 |
void TestKlass_test() { |
8c4f06f6ea15
8035746: Add missing Klass::oop_is_instanceClassLoader() function
stefank
parents:
22794
diff
changeset
|
721 |
TestKlass::test_oop_is_instanceClassLoader(); |
8c4f06f6ea15
8035746: Add missing Klass::oop_is_instanceClassLoader() function
stefank
parents:
22794
diff
changeset
|
722 |
} |
8c4f06f6ea15
8035746: Add missing Klass::oop_is_instanceClassLoader() function
stefank
parents:
22794
diff
changeset
|
723 |
|
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33602
diff
changeset
|
724 |
#endif // PRODUCT |