src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp

Print this page
rev 6796 : [mq]: templateOopIterate
rev 6799 : [mq]: latestChanges

@@ -25,15 +25,17 @@
 #include "precompiled.hpp"
 #include "gc_implementation/concurrentMarkSweep/cmsLockVerifier.hpp"
 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp"
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
+#include "gc_implementation/concurrentMarkSweep/promotionInfo.inline.hpp"
 #include "gc_implementation/shared/liveRange.hpp"
 #include "gc_implementation/shared/spaceDecorator.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/blockOffsetTable.inline.hpp"
+#include "memory/space.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/space.inline.hpp"
 #include "memory/universe.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/globals.hpp"

@@ -673,11 +675,11 @@
 };
 
 // We de-virtualize the block-related calls below, since we know that our
 // space is a CompactibleFreeListSpace.
 
-#define FreeListSpace_DCTOC__walk_mem_region_with_cl_DEFN(ClosureType)          \
+#define FreeListSpace_DCTOC__walk_mem_region_with_cl_DEFN(ClosureType, nv)      \
 void FreeListSpace_DCTOC::walk_mem_region_with_cl(MemRegion mr,                 \
                                                  HeapWord* bottom,              \
                                                  HeapWord* top,                 \
                                                  ClosureType* cl) {             \
    bool is_par = SharedHeap::heap()->n_par_threads() > 0;                       \

@@ -707,11 +709,11 @@
   while (bottom < top) {                                                        \
     if (_cfls->CompactibleFreeListSpace::block_is_obj(bottom) &&                \
         !_cfls->CompactibleFreeListSpace::obj_allocated_since_save_marks(       \
                     oop(bottom)) &&                                             \
         !_collector->CMSCollector::is_dead_obj(oop(bottom))) {                  \
-      size_t word_sz = oop(bottom)->oop_iterate(cl, mr);                        \
+      size_t word_sz = oop(bottom)->oop_iterate<nv>(cl, mr);                        \
       bottom += _cfls->adjustObjectSize(word_sz);                               \
     } else {                                                                    \
       bottom += _cfls->CompactibleFreeListSpace::block_size(bottom);            \
     }                                                                           \
   }                                                                             \

@@ -734,23 +736,23 @@
   while (bottom < top) {                                                        \
     if (_cfls->CompactibleFreeListSpace::block_is_obj_nopar(bottom) &&          \
         !_cfls->CompactibleFreeListSpace::obj_allocated_since_save_marks(       \
                     oop(bottom)) &&                                             \
         !_collector->CMSCollector::is_dead_obj(oop(bottom))) {                  \
-      size_t word_sz = oop(bottom)->oop_iterate(cl, mr);                        \
+      size_t word_sz = oop(bottom)->oop_iterate<nv>(cl, mr);                        \
       bottom += _cfls->adjustObjectSize(word_sz);                               \
     } else {                                                                    \
       bottom += _cfls->CompactibleFreeListSpace::block_size_nopar(bottom);      \
     }                                                                           \
   }                                                                             \
 }
 
 // (There are only two of these, rather than N, because the split is due
 // only to the introduction of the FilteringClosure, a local part of the
 // impl of this abstraction.)
-FreeListSpace_DCTOC__walk_mem_region_with_cl_DEFN(ExtendedOopClosure)
-FreeListSpace_DCTOC__walk_mem_region_with_cl_DEFN(FilteringClosure)
+FreeListSpace_DCTOC__walk_mem_region_with_cl_DEFN(ExtendedOopClosure, false)
+FreeListSpace_DCTOC__walk_mem_region_with_cl_DEFN(FilteringClosure, true)
 
 DirtyCardToOopClosure*
 CompactibleFreeListSpace::new_dcto_cl(ExtendedOopClosure* cl,
                                       CardTableModRefBS::PrecisionStyle precision,
                                       HeapWord* boundary) {

@@ -788,11 +790,11 @@
   size_t curSize;
   for (cur = bottom(), limit = end(); cur < limit;
        cur += curSize) {
     curSize = block_size(cur);
     if (block_is_obj(cur)) {
-      oop(cur)->oop_iterate(cl);
+      oop(cur)->oop_iterate<false>(cl);
     }
   }
 }
 
 // NOTE: In the following methods, in order to safely be able to

@@ -1996,28 +1998,10 @@
   assert(SharedHeap::heap()->n_par_threads() == 0,
          "Shouldn't be called if using parallel gc.");
   return _promoInfo.noPromotions();
 }
 
-#define CFLS_OOP_SINCE_SAVE_MARKS_DEFN(OopClosureType, nv_suffix)           \
-                                                                            \
-void CompactibleFreeListSpace::                                             \
-oop_since_save_marks_iterate##nv_suffix(OopClosureType* blk) {              \
-  assert(SharedHeap::heap()->n_par_threads() == 0,                          \
-         "Shouldn't be called (yet) during parallel part of gc.");          \
-  _promoInfo.promoted_oops_iterate##nv_suffix(blk);                         \
-  /*                                                                        \
-   * This also restores any displaced headers and removes the elements from \
-   * the iteration set as they are processed, so that we have a clean slate \
-   * at the end of the iteration. Note, thus, that if new objects are       \
-   * promoted as a result of the iteration they are iterated over as well.  \
-   */                                                                       \
-  assert(_promoInfo.noPromotions(), "_promoInfo inconsistency");            \
-}
-
-ALL_SINCE_SAVE_MARKS_CLOSURES(CFLS_OOP_SINCE_SAVE_MARKS_DEFN)
-
 bool CompactibleFreeListSpace::linearAllocationWouldFail() const {
   return _smallLinearAllocBlock._word_size == 0;
 }
 
 void CompactibleFreeListSpace::repairLinearAllocationBlocks() {