< prev index next >
src/share/vm/prims/jvmtiGetLoadedClasses.cpp
Print this page
@@ -44,11 +44,11 @@
// CLD/SD, and its _java_mirror or _class_loader can be stored in a root
// or a reachable object making it alive again. The SATB part of G1 needs
// to get notified about this potential resurrection, otherwise the marking
// might not find the object.
#if INCLUDE_ALL_GCS
- if (UseG1GC && o != NULL) {
+ if ((o != NULL) && (UseG1GC || (UseShenandoahGC && ShenandoahSATBBarrier))) {
G1SATBCardTableModRefBS::enqueue(o);
}
#endif
}
@@ -58,21 +58,23 @@
}
void do_klass(Klass* k) {
// Collect all jclasses
_classStack.push((jclass) _env->jni_reference(k->java_mirror()));
- ensure_klass_alive(k->java_mirror());
}
int extract(jclass* result_list) {
// The size of the Stack will be 0 after extract, so get it here
int count = (int)_classStack.size();
int i = count;
// Pop all jclasses, fill backwards
while (!_classStack.is_empty()) {
- result_list[--i] = _classStack.pop();
+ jclass klass_handle = _classStack.pop();
+ oop klass_mirror = JNIHandles::resolve(klass_handle);
+ ensure_klass_alive(klass_mirror);
+ result_list[--i] = klass_handle;
}
// Return the number of elements written
return count;
}
< prev index next >