author | hseigel |
Mon, 23 Oct 2017 10:42:26 -0400 | |
changeset 47684 | c3c04b6e14f8 |
parent 47216 | 71c04702a3d5 |
child 49821 | 02c08e20d66c |
permissions | -rw-r--r-- |
1 | 1 |
/* |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
2 |
* Copyright (c) 2003, 2017, 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:
5402
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5402
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:
5402
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
46729 | 26 |
#include "classfile/dictionary.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
27 |
#include "classfile/classLoaderData.inline.hpp" |
7397 | 28 |
#include "classfile/loaderConstraints.hpp" |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
29 |
#include "logging/log.hpp" |
7397 | 30 |
#include "memory/resourceArea.hpp" |
31 |
#include "oops/oop.inline.hpp" |
|
32 |
#include "runtime/handles.inline.hpp" |
|
33 |
#include "runtime/safepoint.hpp" |
|
34 |
#include "utilities/hashtable.inline.hpp" |
|
1 | 35 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
36 |
void LoaderConstraintEntry::set_loader(int i, oop p) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
37 |
set_loader_data(i, ClassLoaderData::class_loader_data(p)); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
38 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
39 |
|
46729 | 40 |
LoaderConstraintTable::LoaderConstraintTable(int table_size) |
41 |
: Hashtable<InstanceKlass*, mtClass>(table_size, sizeof(LoaderConstraintEntry)) {}; |
|
1 | 42 |
|
43 |
||
44 |
LoaderConstraintEntry* LoaderConstraintTable::new_entry( |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
45 |
unsigned int hash, Symbol* name, |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
46 |
InstanceKlass* klass, int num_loaders, |
1 | 47 |
int max_loaders) { |
48 |
LoaderConstraintEntry* entry; |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
49 |
entry = (LoaderConstraintEntry*)Hashtable<InstanceKlass*, mtClass>::new_entry(hash, klass); |
1 | 50 |
entry->set_name(name); |
51 |
entry->set_num_loaders(num_loaders); |
|
52 |
entry->set_max_loaders(max_loaders); |
|
53 |
return entry; |
|
54 |
} |
|
55 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
56 |
void LoaderConstraintTable::free_entry(LoaderConstraintEntry *entry) { |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
57 |
// decrement name refcount before freeing |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
58 |
entry->name()->decrement_refcount(); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
59 |
Hashtable<InstanceKlass*, mtClass>::free_entry(entry); |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
60 |
} |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
61 |
|
1 | 62 |
// The loaderConstraintTable must always be accessed with the |
63 |
// SystemDictionary lock held. This is true even for readers as |
|
64 |
// entries in the table could be being dynamically resized. |
|
65 |
||
66 |
LoaderConstraintEntry** LoaderConstraintTable::find_loader_constraint( |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
67 |
Symbol* name, Handle loader) { |
1 | 68 |
|
69 |
unsigned int hash = compute_hash(name); |
|
70 |
int index = hash_to_index(hash); |
|
71 |
LoaderConstraintEntry** pp = bucket_addr(index); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
72 |
ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(loader()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
73 |
|
1 | 74 |
while (*pp) { |
75 |
LoaderConstraintEntry* p = *pp; |
|
76 |
if (p->hash() == hash) { |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
77 |
if (p->name() == name) { |
1 | 78 |
for (int i = p->num_loaders() - 1; i >= 0; i--) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
79 |
if (p->loader_data(i) == loader_data) { |
1 | 80 |
return pp; |
81 |
} |
|
82 |
} |
|
83 |
} |
|
84 |
} |
|
85 |
pp = p->next_addr(); |
|
86 |
} |
|
87 |
return pp; |
|
88 |
} |
|
89 |
||
90 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
91 |
void LoaderConstraintTable::purge_loader_constraints() { |
5402
c51fd0c1d005
6888953: some calls to function-like macros are missing semicolons
jcoomes
parents:
5124
diff
changeset
|
92 |
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
93 |
LogTarget(Info, class, loader, constraints) lt; |
1 | 94 |
// Remove unloaded entries from constraint table |
95 |
for (int index = 0; index < table_size(); index++) { |
|
96 |
LoaderConstraintEntry** p = bucket_addr(index); |
|
97 |
while(*p) { |
|
98 |
LoaderConstraintEntry* probe = *p; |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
99 |
InstanceKlass* klass = probe->klass(); |
1 | 100 |
// Remove klass that is no longer alive |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
101 |
if (klass != NULL && |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
102 |
klass->class_loader_data()->is_unloading()) { |
1 | 103 |
probe->set_klass(NULL); |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
104 |
if (lt.is_enabled()) { |
1 | 105 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
106 |
lt.print("purging class object from constraint for name %s," |
1 | 107 |
" loader list:", |
108 |
probe->name()->as_C_string()); |
|
109 |
for (int i = 0; i < probe->num_loaders(); i++) { |
|
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
110 |
lt.print(" [%d]: %s", i, |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
111 |
probe->loader_data(i)->loader_name()); |
1 | 112 |
} |
113 |
} |
|
114 |
} |
|
115 |
// Remove entries no longer alive from loader array |
|
116 |
int n = 0; |
|
117 |
while (n < probe->num_loaders()) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
118 |
if (probe->loader_data(n)->is_unloading()) { |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
119 |
if (lt.is_enabled()) { |
1 | 120 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
121 |
lt.print("purging loader %s from constraint for name %s", |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
122 |
probe->loader_data(n)->loader_name(), |
1 | 123 |
probe->name()->as_C_string() |
124 |
); |
|
125 |
} |
|
126 |
||
127 |
// Compact array |
|
128 |
int num = probe->num_loaders() - 1; |
|
129 |
probe->set_num_loaders(num); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
130 |
probe->set_loader_data(n, probe->loader_data(num)); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
131 |
probe->set_loader_data(num, NULL); |
1 | 132 |
|
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
133 |
if (lt.is_enabled()) { |
1 | 134 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
135 |
lt.print("new loader list:"); |
1 | 136 |
for (int i = 0; i < probe->num_loaders(); i++) { |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
137 |
lt.print(" [%d]: %s", i, |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
138 |
probe->loader_data(i)->loader_name()); |
1 | 139 |
} |
140 |
} |
|
141 |
||
142 |
continue; // current element replaced, so restart without |
|
143 |
// incrementing n |
|
144 |
} |
|
145 |
n++; |
|
146 |
} |
|
147 |
// Check whether entry should be purged |
|
148 |
if (probe->num_loaders() < 2) { |
|
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
149 |
if (lt.is_enabled()) { |
1 | 150 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
151 |
lt.print("purging complete constraint for name %s", |
1 | 152 |
probe->name()->as_C_string()); |
153 |
} |
|
154 |
||
155 |
// Purge entry |
|
156 |
*p = probe->next(); |
|
27880
afb974a04396
8060074: os::free() takes MemoryTrackingLevel but doesn't need it
coleenp
parents:
14588
diff
changeset
|
157 |
FREE_C_HEAP_ARRAY(oop, probe->loaders()); |
1 | 158 |
free_entry(probe); |
159 |
} else { |
|
160 |
#ifdef ASSERT |
|
161 |
if (probe->klass() != NULL) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
162 |
ClassLoaderData* loader_data = |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
163 |
probe->klass()->class_loader_data(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
164 |
assert(!loader_data->is_unloading(), "klass should be live"); |
1 | 165 |
} |
166 |
#endif |
|
167 |
// Go to next entry |
|
168 |
p = probe->next_addr(); |
|
169 |
} |
|
170 |
} |
|
171 |
} |
|
172 |
} |
|
173 |
||
46468
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
174 |
void log_ldr_constraint_msg(Symbol* class_name, const char* reason, |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
175 |
Handle class_loader1, Handle class_loader2) { |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
176 |
LogTarget(Info, class, loader, constraints) lt; |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
177 |
if (lt.is_enabled()) { |
46468
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
178 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
179 |
lt.print("Failed to add constraint for name: %s, loader[0]: %s," |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
180 |
" loader[1]: %s, Reason: %s", |
46468
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
181 |
class_name->as_C_string(), |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
182 |
SystemDictionary::loader_name(class_loader1()), |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
183 |
SystemDictionary::loader_name(class_loader2()), |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
184 |
reason); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
185 |
} |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
186 |
} |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
187 |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
188 |
bool LoaderConstraintTable::add_entry(Symbol* class_name, |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
189 |
InstanceKlass* klass1, Handle class_loader1, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
190 |
InstanceKlass* klass2, Handle class_loader2) { |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
191 |
LogTarget(Info, class, loader, constraints) lt; |
46468
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
192 |
if (klass1 != NULL && klass2 != NULL) { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
193 |
if (klass1 == klass2) { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
194 |
// Same type already loaded in both places. There is no need for any constraint. |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
195 |
return true; |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
196 |
} else { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
197 |
log_ldr_constraint_msg(class_name, |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
198 |
"The class objects presented by loader[0] and loader[1] " |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
199 |
"are different", |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
200 |
class_loader1, class_loader2); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
201 |
return false; |
1 | 202 |
} |
46468
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
203 |
} |
1 | 204 |
|
46468
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
205 |
InstanceKlass* klass = klass1 != NULL ? klass1 : klass2; |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
206 |
LoaderConstraintEntry** pp1 = find_loader_constraint(class_name, class_loader1); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
207 |
if (*pp1 != NULL && (*pp1)->klass() != NULL) { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
208 |
if (klass != NULL) { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
209 |
if (klass != (*pp1)->klass()) { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
210 |
log_ldr_constraint_msg(class_name, |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
211 |
"The class object presented by loader[0] does not match " |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
212 |
"the stored class object in the constraint", |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
213 |
class_loader1, class_loader2); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
214 |
return false; |
1 | 215 |
} |
46468
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
216 |
} else { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
217 |
klass = (*pp1)->klass(); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
218 |
} |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
219 |
} |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
220 |
|
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
221 |
LoaderConstraintEntry** pp2 = find_loader_constraint(class_name, class_loader2); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
222 |
if (*pp2 != NULL && (*pp2)->klass() != NULL) { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
223 |
if (klass != NULL) { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
224 |
if (klass != (*pp2)->klass()) { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
225 |
log_ldr_constraint_msg(class_name, |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
226 |
"The class object presented by loader[1] does not match " |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
227 |
"the stored class object in the constraint", |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
228 |
class_loader1, class_loader2); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
229 |
return false; |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
230 |
} |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
231 |
} else { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
232 |
klass = (*pp2)->klass(); |
1 | 233 |
} |
234 |
} |
|
235 |
||
46468
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
236 |
if (*pp1 == NULL && *pp2 == NULL) { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
237 |
unsigned int hash = compute_hash(class_name); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
238 |
int index = hash_to_index(hash); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
239 |
LoaderConstraintEntry* p; |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
240 |
p = new_entry(hash, class_name, klass, 2, 2); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
241 |
p->set_loaders(NEW_C_HEAP_ARRAY(ClassLoaderData*, 2, mtClass)); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
242 |
p->set_loader(0, class_loader1()); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
243 |
p->set_loader(1, class_loader2()); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
244 |
p->set_klass(klass); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
245 |
p->set_next(bucket(index)); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
246 |
set_entry(index, p); |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
247 |
if (lt.is_enabled()) { |
46468
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
248 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
249 |
lt.print("adding new constraint for name: %s, loader[0]: %s," |
46468
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
250 |
" loader[1]: %s", |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
251 |
class_name->as_C_string(), |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
252 |
SystemDictionary::loader_name(class_loader1()), |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
253 |
SystemDictionary::loader_name(class_loader2()) |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
254 |
); |
1 | 255 |
} |
46468
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
256 |
} else if (*pp1 == *pp2) { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
257 |
/* constraint already imposed */ |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
258 |
if ((*pp1)->klass() == NULL) { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
259 |
(*pp1)->set_klass(klass); |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
260 |
if (lt.is_enabled()) { |
46468
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
261 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
262 |
lt.print("setting class object in existing constraint for" |
46468
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
263 |
" name: %s and loader %s", |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
264 |
class_name->as_C_string(), |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
265 |
SystemDictionary::loader_name(class_loader1()) |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
266 |
); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
267 |
} |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
268 |
} else { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
269 |
assert((*pp1)->klass() == klass, "loader constraints corrupted"); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
270 |
} |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
271 |
} else if (*pp1 == NULL) { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
272 |
extend_loader_constraint(*pp2, class_loader1, klass); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
273 |
} else if (*pp2 == NULL) { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
274 |
extend_loader_constraint(*pp1, class_loader2, klass); |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
275 |
} else { |
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
276 |
merge_loader_constraints(pp1, pp2, klass); |
1 | 277 |
} |
278 |
||
46468
be80e262d2a2
8152295: Redundant CLCs for classes resolved in both loaders
hseigel
parents:
46380
diff
changeset
|
279 |
return true; |
1 | 280 |
} |
281 |
||
282 |
||
283 |
// return true if the constraint was updated, false if the constraint is |
|
284 |
// violated |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
285 |
bool LoaderConstraintTable::check_or_update(InstanceKlass* k, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
286 |
Handle loader, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
287 |
Symbol* name) { |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
288 |
LogTarget(Info, class, loader, constraints) lt; |
1 | 289 |
LoaderConstraintEntry* p = *(find_loader_constraint(name, loader)); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
290 |
if (p && p->klass() != NULL && p->klass() != k) { |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
291 |
if (lt.is_enabled()) { |
1 | 292 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
293 |
lt.print("constraint check failed for name %s, loader %s: " |
37202
4100f25e4b09
8149996: TraceLoaderConstraints has been converted to Unified Logging.
mockner
parents:
33611
diff
changeset
|
294 |
"the presented class object differs from that stored", |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
295 |
name->as_C_string(), |
1 | 296 |
SystemDictionary::loader_name(loader())); |
297 |
} |
|
298 |
return false; |
|
299 |
} else { |
|
300 |
if (p && p->klass() == NULL) { |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
301 |
p->set_klass(k); |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
302 |
if (lt.is_enabled()) { |
1 | 303 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
304 |
lt.print("updating constraint for name %s, loader %s, " |
37202
4100f25e4b09
8149996: TraceLoaderConstraints has been converted to Unified Logging.
mockner
parents:
33611
diff
changeset
|
305 |
"by setting class object", |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
306 |
name->as_C_string(), |
1 | 307 |
SystemDictionary::loader_name(loader())); |
308 |
} |
|
309 |
} |
|
310 |
return true; |
|
311 |
} |
|
312 |
} |
|
313 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
314 |
InstanceKlass* LoaderConstraintTable::find_constrained_klass(Symbol* name, |
1 | 315 |
Handle loader) { |
316 |
LoaderConstraintEntry *p = *(find_loader_constraint(name, loader)); |
|
8314
057b1c20fd7e
6354181: nsk.logging.stress.threads.scmhml001 fails assertion in "src/share/vm/oops/instanceKlass.cpp, 111"
never
parents:
8076
diff
changeset
|
317 |
if (p != NULL && p->klass() != NULL) { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
318 |
assert(p->klass()->is_instance_klass(), "sanity"); |
46716
53915543333d
8178107: Compiler crashes with "assert(get_instanceKlass()->is_loaded()) failed: must be at least loaded"
hseigel
parents:
46701
diff
changeset
|
319 |
if (!p->klass()->is_loaded()) { |
8314
057b1c20fd7e
6354181: nsk.logging.stress.threads.scmhml001 fails assertion in "src/share/vm/oops/instanceKlass.cpp, 111"
never
parents:
8076
diff
changeset
|
320 |
// Only return fully loaded classes. Classes found through the |
057b1c20fd7e
6354181: nsk.logging.stress.threads.scmhml001 fails assertion in "src/share/vm/oops/instanceKlass.cpp, 111"
never
parents:
8076
diff
changeset
|
321 |
// constraints might still be in the process of loading. |
057b1c20fd7e
6354181: nsk.logging.stress.threads.scmhml001 fails assertion in "src/share/vm/oops/instanceKlass.cpp, 111"
never
parents:
8076
diff
changeset
|
322 |
return NULL; |
057b1c20fd7e
6354181: nsk.logging.stress.threads.scmhml001 fails assertion in "src/share/vm/oops/instanceKlass.cpp, 111"
never
parents:
8076
diff
changeset
|
323 |
} |
1 | 324 |
return p->klass(); |
8314
057b1c20fd7e
6354181: nsk.logging.stress.threads.scmhml001 fails assertion in "src/share/vm/oops/instanceKlass.cpp, 111"
never
parents:
8076
diff
changeset
|
325 |
} |
1 | 326 |
|
327 |
// No constraints, or else no klass loaded yet. |
|
328 |
return NULL; |
|
329 |
} |
|
330 |
||
331 |
void LoaderConstraintTable::ensure_loader_constraint_capacity( |
|
332 |
LoaderConstraintEntry *p, |
|
333 |
int nfree) { |
|
334 |
if (p->max_loaders() - p->num_loaders() < nfree) { |
|
335 |
int n = nfree + p->num_loaders(); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
336 |
ClassLoaderData** new_loaders = NEW_C_HEAP_ARRAY(ClassLoaderData*, n, mtClass); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
337 |
memcpy(new_loaders, p->loaders(), sizeof(ClassLoaderData*) * p->num_loaders()); |
1 | 338 |
p->set_max_loaders(n); |
27880
afb974a04396
8060074: os::free() takes MemoryTrackingLevel but doesn't need it
coleenp
parents:
14588
diff
changeset
|
339 |
FREE_C_HEAP_ARRAY(ClassLoaderData*, p->loaders()); |
1 | 340 |
p->set_loaders(new_loaders); |
341 |
} |
|
342 |
} |
|
343 |
||
344 |
||
345 |
void LoaderConstraintTable::extend_loader_constraint(LoaderConstraintEntry* p, |
|
346 |
Handle loader, |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
347 |
InstanceKlass* klass) { |
1 | 348 |
ensure_loader_constraint_capacity(p, 1); |
349 |
int num = p->num_loaders(); |
|
350 |
p->set_loader(num, loader()); |
|
351 |
p->set_num_loaders(num + 1); |
|
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
352 |
LogTarget(Info, class, loader, constraints) lt; |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
353 |
if (lt.is_enabled()) { |
1 | 354 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
355 |
lt.print("extending constraint for name %s by adding loader[%d]: %s %s", |
1 | 356 |
p->name()->as_C_string(), |
357 |
num, |
|
358 |
SystemDictionary::loader_name(loader()), |
|
37202
4100f25e4b09
8149996: TraceLoaderConstraints has been converted to Unified Logging.
mockner
parents:
33611
diff
changeset
|
359 |
(p->klass() == NULL ? " and setting class object" : "") |
1 | 360 |
); |
361 |
} |
|
362 |
if (p->klass() == NULL) { |
|
363 |
p->set_klass(klass); |
|
364 |
} else { |
|
365 |
assert(klass == NULL || p->klass() == klass, "constraints corrupted"); |
|
366 |
} |
|
367 |
} |
|
368 |
||
369 |
||
370 |
void LoaderConstraintTable::merge_loader_constraints( |
|
371 |
LoaderConstraintEntry** pp1, |
|
372 |
LoaderConstraintEntry** pp2, |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
373 |
InstanceKlass* klass) { |
1 | 374 |
// make sure *pp1 has higher capacity |
375 |
if ((*pp1)->max_loaders() < (*pp2)->max_loaders()) { |
|
376 |
LoaderConstraintEntry** tmp = pp2; |
|
377 |
pp2 = pp1; |
|
378 |
pp1 = tmp; |
|
379 |
} |
|
380 |
||
381 |
LoaderConstraintEntry* p1 = *pp1; |
|
382 |
LoaderConstraintEntry* p2 = *pp2; |
|
383 |
||
384 |
ensure_loader_constraint_capacity(p1, p2->num_loaders()); |
|
385 |
||
386 |
for (int i = 0; i < p2->num_loaders(); i++) { |
|
387 |
int num = p1->num_loaders(); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
388 |
p1->set_loader_data(num, p2->loader_data(i)); |
1 | 389 |
p1->set_num_loaders(num + 1); |
390 |
} |
|
391 |
||
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
392 |
LogTarget(Info, class, loader, constraints) lt; |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
393 |
if (lt.is_enabled()) { |
1 | 394 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
395 |
lt.print("merged constraints for name %s, new loader list:", |
1 | 396 |
p1->name()->as_C_string() |
397 |
); |
|
398 |
||
399 |
for (int i = 0; i < p1->num_loaders(); i++) { |
|
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
400 |
lt.print(" [%d]: %s", i, |
14588
8ec26d2d9339
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
14488
diff
changeset
|
401 |
p1->loader_data(i)->loader_name()); |
1 | 402 |
} |
403 |
if (p1->klass() == NULL) { |
|
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46468
diff
changeset
|
404 |
lt.print("... and setting class object"); |
1 | 405 |
} |
406 |
} |
|
407 |
||
408 |
// p1->klass() will hold NULL if klass, p2->klass(), and old |
|
409 |
// p1->klass() are all NULL. In addition, all three must have |
|
410 |
// matching non-NULL values, otherwise either the constraints would |
|
411 |
// have been violated, or the constraints had been corrupted (and an |
|
412 |
// assertion would fail). |
|
413 |
if (p2->klass() != NULL) { |
|
414 |
assert(p2->klass() == klass, "constraints corrupted"); |
|
415 |
} |
|
416 |
if (p1->klass() == NULL) { |
|
417 |
p1->set_klass(klass); |
|
418 |
} else { |
|
419 |
assert(p1->klass() == klass, "constraints corrupted"); |
|
420 |
} |
|
421 |
||
422 |
*pp2 = p2->next(); |
|
27880
afb974a04396
8060074: os::free() takes MemoryTrackingLevel but doesn't need it
coleenp
parents:
14588
diff
changeset
|
423 |
FREE_C_HEAP_ARRAY(oop, p2->loaders()); |
1 | 424 |
free_entry(p2); |
425 |
return; |
|
426 |
} |
|
427 |
||
428 |
||
46729 | 429 |
void LoaderConstraintTable::verify(PlaceholderTable* placeholders) { |
1 | 430 |
Thread *thread = Thread::current(); |
46729 | 431 |
for (int cindex = 0; cindex < table_size(); cindex++) { |
1 | 432 |
for (LoaderConstraintEntry* probe = bucket(cindex); |
433 |
probe != NULL; |
|
434 |
probe = probe->next()) { |
|
435 |
if (probe->klass() != NULL) { |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
38151
diff
changeset
|
436 |
InstanceKlass* ik = probe->klass(); |
1 | 437 |
guarantee(ik->name() == probe->name(), "name should match"); |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
438 |
Symbol* name = ik->name(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
439 |
ClassLoaderData* loader_data = ik->class_loader_data(); |
46729 | 440 |
Dictionary* dictionary = loader_data->dictionary(); |
441 |
unsigned int d_hash = dictionary->compute_hash(name); |
|
1 | 442 |
int d_index = dictionary->hash_to_index(d_hash); |
46729 | 443 |
InstanceKlass* k = dictionary->find_class(d_index, d_hash, name); |
4899
ab225bac579c
6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails
tonyp
parents:
1
diff
changeset
|
444 |
if (k != NULL) { |
46729 | 445 |
// We found the class in the dictionary, so we should |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
446 |
// make sure that the Klass* matches what we already have. |
4899
ab225bac579c
6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails
tonyp
parents:
1
diff
changeset
|
447 |
guarantee(k == probe->klass(), "klass should be in dictionary"); |
ab225bac579c
6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails
tonyp
parents:
1
diff
changeset
|
448 |
} else { |
46729 | 449 |
// If we don't find the class in the dictionary, it |
4899
ab225bac579c
6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails
tonyp
parents:
1
diff
changeset
|
450 |
// has to be in the placeholders table. |
46729 | 451 |
unsigned int p_hash = placeholders->compute_hash(name); |
4899
ab225bac579c
6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails
tonyp
parents:
1
diff
changeset
|
452 |
int p_index = placeholders->hash_to_index(p_hash); |
ab225bac579c
6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails
tonyp
parents:
1
diff
changeset
|
453 |
PlaceholderEntry* entry = placeholders->get_entry(p_index, p_hash, |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
454 |
name, loader_data); |
4899
ab225bac579c
6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails
tonyp
parents:
1
diff
changeset
|
455 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
456 |
// The InstanceKlass might not be on the entry, so the only |
4899
ab225bac579c
6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails
tonyp
parents:
1
diff
changeset
|
457 |
// thing we can check here is whether we were successful in |
ab225bac579c
6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails
tonyp
parents:
1
diff
changeset
|
458 |
// finding the class in the placeholders table. |
ab225bac579c
6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails
tonyp
parents:
1
diff
changeset
|
459 |
guarantee(entry != NULL, "klass should be in the placeholders"); |
ab225bac579c
6920977: G1: guarantee(k == probe->klass(),"klass should be in dictionary") fails
tonyp
parents:
1
diff
changeset
|
460 |
} |
1 | 461 |
} |
462 |
for (int n = 0; n< probe->num_loaders(); n++) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
463 |
assert(ClassLoaderDataGraph::contains_loader_data(probe->loader_data(n)), "The loader is missing"); |
1 | 464 |
} |
465 |
} |
|
466 |
} |
|
467 |
} |
|
468 |
||
469 |
// Called with the system dictionary lock held |
|
46742 | 470 |
void LoaderConstraintTable::print_on(outputStream* st) const { |
1 | 471 |
ResourceMark rm; |
472 |
assert_locked_or_safepoint(SystemDictionary_lock); |
|
46742 | 473 |
st->print_cr("Java loader constraints (table_size=%d, constraints=%d)", |
474 |
table_size(), number_of_entries()); |
|
46729 | 475 |
for (int cindex = 0; cindex < table_size(); cindex++) { |
1 | 476 |
for (LoaderConstraintEntry* probe = bucket(cindex); |
477 |
probe != NULL; |
|
478 |
probe = probe->next()) { |
|
46742 | 479 |
st->print("%4d: ", cindex); |
480 |
probe->name()->print_on(st); |
|
481 |
st->print(" , loaders:"); |
|
1 | 482 |
for (int n = 0; n < probe->num_loaders(); n++) { |
46742 | 483 |
probe->loader_data(n)->print_value_on(st); |
484 |
st->print(", "); |
|
1 | 485 |
} |
46742 | 486 |
st->cr(); |
1 | 487 |
} |
488 |
} |
|
489 |
} |