< prev index next >

src/hotspot/share/gc/z/zRootsIterator.cpp

Print this page

        

@@ -27,10 +27,11 @@
 #include "classfile/symbolTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "compiler/oopMap.hpp"
 #include "gc/shared/oopStorageParState.inline.hpp"
+#include "gc/z/zGlobals.hpp"
 #include "gc/z/zNMethodTable.hpp"
 #include "gc/z/zOopClosures.inline.hpp"
 #include "gc/z/zRootsIterator.hpp"
 #include "gc/z/zStat.hpp"
 #include "memory/universe.hpp"

@@ -212,14 +213,35 @@
   ZStatTimer timer(ZSubPhasePauseRootsClassLoaderDataGraph);
   CLDToOopClosure cld_cl(cl);
   ClassLoaderDataGraph::cld_do(&cld_cl);
 }
 
+class ZRootsIteratorThreadClosure : public ThreadClosure {
+private:
+  OopClosure* const _cl;
+
+public:
+  ZRootsIteratorThreadClosure(OopClosure* cl) :
+      _cl(cl) {}
+
+  virtual void do_thread(Thread* thread) {
+    if (thread->is_Java_thread()) {
+      // Update thread local adddress bad mask
+      JavaThread* const java_thread = (JavaThread*)thread;
+      java_thread->set_zaddress_bad_mask(ZAddressBadMask);
+    }
+
+    // Process thread oops
+    thread->oops_do(_cl, NULL);
+  }
+};
+
 void ZRootsIterator::do_threads(OopClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRootsThreads);
   ResourceMark rm;
-  Threads::possibly_parallel_oops_do(true, cl, NULL);
+  ZRootsIteratorThreadClosure thread_cl(cl);
+  Threads::possibly_parallel_threads_do(true, &thread_cl);
 }
 
 void ZRootsIterator::do_code_cache(OopClosure* cl) {
   ZStatTimer timer(ZSubPhasePauseRootsCodeCache);
   ZNMethodTable::oops_do(cl);
< prev index next >