diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp index a1e0262382cfe992321c89a499dee46b3c650e00..fb4a0c798686532c261f5bb7831e4e66f04c60e5 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @@ -1722,14 +1722,20 @@ public: } }; -void G1CollectedHeap::oop_iterate(OopClosure* cl) { +void G1CollectedHeap::oop_iterate(OopClosure* cl, bool do_perm) { IterateOopClosureRegionClosure blk(_g1_committed, cl); _hrs->iterate(&blk); + if (do_perm) { + perm_gen()->oop_iterate(cl); + } } -void G1CollectedHeap::oop_iterate(MemRegion mr, OopClosure* cl) { +void G1CollectedHeap::oop_iterate(MemRegion mr, OopClosure* cl, bool do_perm) { IterateOopClosureRegionClosure blk(mr, cl); _hrs->iterate(&blk); + if (do_perm) { + perm_gen()->oop_iterate(cl); + } } // Iterates an ObjectClosure over all objects within a HeapRegion. @@ -1746,9 +1752,12 @@ public: } }; -void G1CollectedHeap::object_iterate(ObjectClosure* cl) { +void G1CollectedHeap::object_iterate(ObjectClosure* cl, bool do_perm) { IterateObjectClosureRegionClosure blk(cl); _hrs->iterate(&blk); + if (do_perm) { + perm_gen()->object_iterate(cl); + } } void G1CollectedHeap::object_iterate_since_last_GC(ObjectClosure* cl) { @@ -2375,7 +2384,7 @@ G1CollectedHeap::checkConcurrentMark() { VerifyMarkedObjsClosure verifycl(this); // MutexLockerEx x(getMarkBitMapLock(), // Mutex::_no_safepoint_check_flag); - object_iterate(&verifycl); + object_iterate(&verifycl, false); } void G1CollectedHeap::do_sync_mark() { diff --git a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp index 9a3b0b6d9e9bc4e7a657052b2dcde5db4a1b1e46..c0eca678db888e15035b38269b59a19d7369c623 100644 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @@ -865,14 +865,25 @@ public: // Iterate over all the ref-containing fields of all objects, calling // "cl.do_oop" on each. - virtual void oop_iterate(OopClosure* cl); + virtual void oop_iterate(OopClosure* cl) { + oop_iterate(cl, true); + } + void oop_iterate(OopClosure* cl, bool do_perm); // Same as above, restricted to a memory region. - virtual void oop_iterate(MemRegion mr, OopClosure* cl); + virtual void oop_iterate(MemRegion mr, OopClosure* cl) { + oop_iterate(mr, cl, true); + } + void oop_iterate(MemRegion mr, OopClosure* cl, bool do_perm); // Iterate over all objects, calling "cl.do_object" on each. - virtual void object_iterate(ObjectClosure* cl); - virtual void safe_object_iterate(ObjectClosure* cl) { object_iterate(cl); } + virtual void object_iterate(ObjectClosure* cl) { + object_iterate(cl, true); + } + virtual void safe_object_iterate(ObjectClosure* cl) { + object_iterate(cl, true); + } + void object_iterate(ObjectClosure* cl, bool do_perm); // Iterate over all objects allocated since the last collection, calling // "cl.do_object" on each. The heap must have been initialized properly