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

Print this page
rev 6796 : [mq]: templateOopIterate
rev 6801 : imported patch defaultToTrue

@@ -31,10 +31,11 @@
 #include "gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp"
 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.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/concurrentMarkSweep/vmCMSOperations.hpp"
 #include "gc_implementation/parNew/parNewGeneration.hpp"
 #include "gc_implementation/shared/collectorCounters.hpp"
 #include "gc_implementation/shared/gcTimer.hpp"
 #include "gc_implementation/shared/gcTrace.hpp"

@@ -50,10 +51,11 @@
 #include "memory/genOopClosures.inline.hpp"
 #include "memory/iterator.inline.hpp"
 #include "memory/padded.hpp"
 #include "memory/referencePolicy.hpp"
 #include "memory/resourceArea.hpp"
+#include "memory/space.inline.hpp"
 #include "memory/tenuredGeneration.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "runtime/atomic.inline.hpp"
 #include "runtime/globals_extension.hpp"

@@ -198,11 +200,11 @@
 
 ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration(
      ReservedSpace rs, size_t initial_byte_size, int level,
      CardTableRS* ct, bool use_adaptive_freelists,
      FreeBlockDictionary<FreeChunk>::DictionaryChoice dictionaryChoice) :
-  CardGeneration(rs, initial_byte_size, level, ct),
+  CardGeneration(rs, initial_byte_size, level, ct, _dispatch_index_generation_cms),
   _dilatation_factor(((double)MinChunkSize)/((double)(CollectedHeap::min_fill_size()))),
   _debug_collection_type(Concurrent_collection_type),
   _did_compact(false)
 {
   HeapWord* bottom = (HeapWord*) _virtual_space.low();

@@ -1438,16 +1440,19 @@
 par_promote_alloc_done(int thread_num) {
   CMSParGCThreadState* ps = _par_gc_thread_states[thread_num];
   ps->lab.retire(thread_num);
 }
 
+// SSS: Temporary include
+#include "gc_implementation/parNew/parOopClosures.inline.hpp"
+
 void
 ConcurrentMarkSweepGeneration::
 par_oop_since_save_marks_iterate_done(int thread_num) {
   CMSParGCThreadState* ps = _par_gc_thread_states[thread_num];
   ParScanWithoutBarrierClosure* dummy_cl = NULL;
-  ps->promo.promoted_oops_iterate_nv(dummy_cl);
+  ps->promo.promoted_oops_iterate<false>(dummy_cl);
 }
 
 bool ConcurrentMarkSweepGeneration::should_collect(bool   full,
                                                    size_t size,
                                                    bool   tlab)

@@ -3118,22 +3123,10 @@
 
 bool ConcurrentMarkSweepGeneration::no_allocs_since_save_marks() {
   return cmsSpace()->no_allocs_since_save_marks();
 }
 
-#define CMS_SINCE_SAVE_MARKS_DEFN(OopClosureType, nv_suffix)    \
-                                                                \
-void ConcurrentMarkSweepGeneration::                            \
-oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl) {   \
-  cl->set_generation(this);                                     \
-  cmsSpace()->oop_since_save_marks_iterate##nv_suffix(cl);      \
-  cl->reset_generation();                                       \
-  save_marks();                                                 \
-}
-
-ALL_SINCE_SAVE_MARKS_CLOSURES(CMS_SINCE_SAVE_MARKS_DEFN)
-
 void
 ConcurrentMarkSweepGeneration::younger_refs_iterate(OopsInGenClosure* cl) {
   cl->set_generation(this);
   younger_refs_in_space_iterate(_cmsSpace, cl);
   cl->reset_generation();

@@ -4211,11 +4204,12 @@
     oop new_oop;
     if (_work_queue->pop_local(new_oop)) {
       assert(new_oop->is_oop(), "Should be an oop");
       assert(_bit_map->isMarked((HeapWord*)new_oop), "Grey object");
       assert(_span.contains((HeapWord*)new_oop), "Not in span");
-      new_oop->oop_iterate(this);  // do_oop() above
+      // SSS: Opportunity to devirtualize
+      new_oop->oop_iterate<false>(this);  // do_oop() above
       do_yield_check();
     }
   }
 }
 

@@ -4251,11 +4245,12 @@
       // assert(work_q->size() > 0, "Work from overflow stack");
       continue;
     } else if (task_queues()->steal(i, seed, /* reference */ obj_to_scan)) {
       assert(obj_to_scan->is_oop(), "Should be an oop");
       assert(bm->isMarked((HeapWord*)obj_to_scan), "Grey object");
-      obj_to_scan->oop_iterate(&cl);
+      // SSS: Opportunity to devirtualize
+      obj_to_scan->oop_iterate<false>(&cl);
     } else if (terminator()->offer_termination(&_term_term)) {
       assert(work_q->size() == 0, "Impossible!");
       break;
     } else if (yielding() || should_yield()) {
       yield();

@@ -5432,11 +5427,11 @@
       assert(mr.is_empty() || space->used_region().contains(mr),
              "Should be in space");
       // Verify that "start" is an object boundary
       assert(mr.is_empty() || oop(mr.start())->is_oop(),
              "Should be an oop");
-      space->par_oop_iterate(mr, cl);
+      space->par_oop_iterate<false>(mr, cl);
     }
     pst->all_tasks_completed();
   }
 }
 

@@ -6068,11 +6063,12 @@
     if (task_queues()->steal(i, seed, /* reference */ obj_to_scan)) {
       NOT_PRODUCT(num_steals++;)
       assert(obj_to_scan->is_oop(), "Oops, not an oop!");
       assert(_mark_bit_map->isMarked((HeapWord*)obj_to_scan), "Stole an unmarked oop?");
       // Do scanning work
-      obj_to_scan->oop_iterate(keep_alive);
+      // SSS: Opportunity to devirtualize
+      obj_to_scan->oop_iterate<false>(keep_alive);
       // Loop around, finish this work, and try to steal some more
     } else if (terminator()->offer_termination()) {
       break;  // nirvana from the infinite cycle
     }
   }

@@ -7629,11 +7625,12 @@
   assert(res, "Empty non-zero size stack should have space for single push");
   while (!_mark_stack->isEmpty()) {
     oop new_oop = _mark_stack->pop();
     assert(new_oop->is_oop(), "Oops! expected to pop an oop");
     // now scan this oop's oops
-    new_oop->oop_iterate(&_pam_verify_closure);
+    // SSS: This is not devirtualized, opportunity to fix?
+    new_oop->oop_iterate<false>(&_pam_verify_closure);
   }
   assert(_mark_stack->isEmpty(), "tautology, emphasizing post-condition");
   return true;
 }