< prev index next >

src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp

Access_GetLoadedClasses

*** 27,71 **** #include "gc/shared/collectedHeap.hpp" #include "memory/universe.inline.hpp" #include "prims/jvmtiGetLoadedClasses.hpp" #include "runtime/thread.hpp" #include "utilities/stack.inline.hpp" - #if INCLUDE_ALL_GCS - #include "gc/g1/g1SATBCardTableModRefBS.hpp" - #endif // The closure for GetLoadedClasses class LoadedClassesClosure : public KlassClosure { private: Stack<jclass, mtInternal> _classStack; JvmtiEnv* _env; Thread* _cur_thread; - // Tell the GC to keep this klass alive - static void ensure_klass_alive(oop o) { - // A klass that was previously considered dead can be looked up in the - // 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) { - G1SATBCardTableModRefBS::enqueue(o); - } - #endif - } - public: LoadedClassesClosure(Thread* thread, JvmtiEnv* env) : _cur_thread(thread), _env(env) { assert(_cur_thread == Thread::current(), "must be current thread"); } void do_klass(Klass* k) { // Collect all jclasses ! _classStack.push((jclass) _env->jni_reference(Handle(_cur_thread, 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(); --- 27,55 ---- #include "gc/shared/collectedHeap.hpp" #include "memory/universe.inline.hpp" #include "prims/jvmtiGetLoadedClasses.hpp" #include "runtime/thread.hpp" #include "utilities/stack.inline.hpp" // The closure for GetLoadedClasses class LoadedClassesClosure : public KlassClosure { private: Stack<jclass, mtInternal> _classStack; JvmtiEnv* _env; Thread* _cur_thread; public: LoadedClassesClosure(Thread* thread, JvmtiEnv* env) : _cur_thread(thread), _env(env) { assert(_cur_thread == Thread::current(), "must be current thread"); } void do_klass(Klass* k) { // Collect all jclasses ! oop mirror = k->java_mirror_phantom(); // make sure the class is not unloaded during ! // concurrent marking by using the phantom getter. ! _classStack.push((jclass) _env->jni_reference(Handle(_cur_thread, 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();
< prev index next >