< prev index next >

src/hotspot/share/gc/g1/heapRegion.cpp

Print this page
@@ -858,14 +858,23 @@
  HeapWord* HeapRegion::cross_threshold(HeapWord* start, HeapWord* end) {
    _bot_part.alloc_block(start, end);
    return _bot_part.threshold();
  }
  
- void HeapRegion::object_iterate(ObjectClosure* blk) {
+ template<bool RESOLVE>
+ void HeapRegion::object_iterate_impl(ObjectClosure* blk) {
    HeapWord* p = bottom();
    while (p < top()) {
      if (block_is_obj(p)) {
        blk->do_object(cast_to_oop(p));
      }
-     p += block_size(p);
+     p += block_size<RESOLVE>(p);
+   }
+ }
+ 
+ void HeapRegion::object_iterate(ObjectClosure* blk) {
+   if (!UseCompactObjectHeaders || G1CollectedHeap::heap()->collector_state()->in_full_gc()) {
+     object_iterate_impl<false>(blk);
+   } else {
+     object_iterate_impl<true>(blk);
    }
  }
< prev index next >