Skip to content

Commit fd9fa38

Browse files
committed
8209821: Make JVMTI GetClassLoaderClasses not walk CLDG
And also added function with KlassClosure to remove the hacks. Reviewed-by: lfoltan, sspitsyn
1 parent 51c04f9 commit fd9fa38

10 files changed

Lines changed: 62 additions & 258 deletions

File tree

src/hotspot/share/classfile/classLoaderData.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,15 +1254,6 @@ void ClassLoaderDataGraph::dictionary_classes_do(void f(InstanceKlass*, TRAPS),
12541254
}
12551255
}
12561256

1257-
// Walks all entries in the dictionary including entries initiated by this class loader.
1258-
void ClassLoaderDataGraph::dictionary_all_entries_do(void f(InstanceKlass*, ClassLoaderData*)) {
1259-
Thread* thread = Thread::current();
1260-
FOR_ALL_DICTIONARY(cld) {
1261-
Handle holder(thread, cld->holder_phantom());
1262-
cld->dictionary()->all_entries_do(f);
1263-
}
1264-
}
1265-
12661257
void ClassLoaderDataGraph::verify_dictionary() {
12671258
FOR_ALL_DICTIONARY(cld) {
12681259
cld->dictionary()->verify();

src/hotspot/share/classfile/classLoaderData.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ class ClassLoaderDataGraph : public AllStatic {
134134
// Added for initialize_itable_for_klass to handle exceptions.
135135
static void dictionary_classes_do(void f(InstanceKlass*, TRAPS), TRAPS);
136136

137-
// Iterate all classes and their class loaders, including initiating class loaders.
138-
static void dictionary_all_entries_do(void f(InstanceKlass*, ClassLoaderData*));
139-
140137
// VM_CounterDecay iteration support
141138
static InstanceKlass* try_get_next_class();
142139

src/hotspot/share/classfile/dictionary.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,13 @@ void Dictionary::classes_do(void f(InstanceKlass*, TRAPS), TRAPS) {
330330
}
331331

332332
// All classes, and their class loaders, including initiating class loaders
333-
void Dictionary::all_entries_do(void f(InstanceKlass*, ClassLoaderData*)) {
333+
void Dictionary::all_entries_do(KlassClosure* closure) {
334334
for (int index = 0; index < table_size(); index++) {
335335
for (DictionaryEntry* probe = bucket(index);
336336
probe != NULL;
337337
probe = probe->next()) {
338338
InstanceKlass* k = probe->instance_klass();
339-
f(k, loader_data());
339+
closure->do_klass(k);
340340
}
341341
}
342342
}

src/hotspot/share/classfile/dictionary.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class Dictionary : public Hashtable<InstanceKlass*, mtClass> {
7474

7575
void classes_do(void f(InstanceKlass*));
7676
void classes_do(void f(InstanceKlass*, TRAPS), TRAPS);
77-
void all_entries_do(void f(InstanceKlass*, ClassLoaderData*));
77+
void all_entries_do(KlassClosure* closure);
7878
void classes_do(MetaspaceClosure* it);
7979

8080
void unlink();

src/hotspot/share/memory/universe.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,15 @@ address Universe::_narrow_ptrs_base;
165165
uint64_t Universe::_narrow_klass_range = (uint64_t(max_juint)+1);
166166

167167
void Universe::basic_type_classes_do(void f(Klass*)) {
168-
f(boolArrayKlassObj());
169-
f(byteArrayKlassObj());
170-
f(charArrayKlassObj());
171-
f(intArrayKlassObj());
172-
f(shortArrayKlassObj());
173-
f(longArrayKlassObj());
174-
f(singleArrayKlassObj());
175-
f(doubleArrayKlassObj());
168+
for (int i = T_BOOLEAN; i < T_LONG+1; i++) {
169+
f(_typeArrayKlassObjs[i]);
170+
}
171+
}
172+
173+
void Universe::basic_type_classes_do(KlassClosure *closure) {
174+
for (int i = T_BOOLEAN; i < T_LONG+1; i++) {
175+
closure->do_klass(_typeArrayKlassObjs[i]);
176+
}
176177
}
177178

178179
void Universe::oops_do(OopClosure* f, bool do_all) {

src/hotspot/share/memory/universe.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ class Universe: AllStatic {
486486
// Apply "f" to all klasses for basic types (classes not present in
487487
// SystemDictionary).
488488
static void basic_type_classes_do(void f(Klass*));
489+
static void basic_type_classes_do(KlassClosure* closure);
489490
static void metaspace_pointers_do(MetaspaceClosure* it);
490491

491492
// Debugging

0 commit comments

Comments
 (0)