< prev index next >
src/hotspot/share/gc/z/zRootsIterator.cpp
Print this page
@@ -133,33 +133,42 @@
_completed = true;
}
}
}
-class ZCodeBlobClosure : public CodeBlobToOopClosure {
+class ZRootsIteratorCodeBlobClosure : public CodeBlobToOopClosure {
private:
BarrierSetNMethod* _bs;
public:
- ZCodeBlobClosure(OopClosure* cl) :
+ ZRootsIteratorCodeBlobClosure(OopClosure* cl) :
CodeBlobToOopClosure(cl, true /* fix_relocations */),
_bs(BarrierSet::barrier_set()->barrier_set_nmethod()) {}
virtual void do_code_blob(CodeBlob* cb) {
nmethod* const nm = cb->as_nmethod_or_null();
- if (nm == NULL || nm->test_set_oops_do_mark()) {
- return;
+ if (nm != NULL && !nm->test_set_oops_do_mark()) {
+ CodeBlobToOopClosure::do_code_blob(cb);
+ _bs->disarm(nm);
}
- CodeBlobToOopClosure::do_code_blob(cb);
- _bs->disarm(nm);
}
};
-void ZRootsIteratorClosure::do_thread(Thread* thread) {
- ZCodeBlobClosure code_cl(this);
- thread->oops_do(this, ClassUnloading ? &code_cl : NULL);
-}
+class ZRootsIteratorThreadClosure : public ThreadClosure {
+private:
+ ZRootsIteratorClosure* _cl;
+
+public:
+ ZRootsIteratorThreadClosure(ZRootsIteratorClosure* cl) :
+ _cl(cl) {}
+
+ virtual void do_thread(Thread* thread) {
+ ZRootsIteratorCodeBlobClosure code_cl(_cl);
+ thread->oops_do(_cl, ClassUnloading ? &code_cl : NULL);
+ _cl->do_thread(thread);
+ }
+};
ZRootsIterator::ZRootsIterator() :
_universe(this),
_object_synchronizer(this),
_management(this),
@@ -225,11 +234,12 @@
}
void ZRootsIterator::do_threads(ZRootsIteratorClosure* cl) {
ZStatTimer timer(ZSubPhasePauseRootsThreads);
ResourceMark rm;
- Threads::possibly_parallel_threads_do(true, cl);
+ ZRootsIteratorThreadClosure thread_cl(cl);
+ Threads::possibly_parallel_threads_do(true, &thread_cl);
}
void ZRootsIterator::do_code_cache(ZRootsIteratorClosure* cl) {
ZStatTimer timer(ZSubPhasePauseRootsCodeCache);
ZNMethodTable::oops_do(cl);
< prev index next >