< prev index next >

src/share/vm/gc_implementation/g1/concurrentMark.cpp

Print this page




  29 #include "gc_implementation/g1/concurrentMark.inline.hpp"
  30 #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
  31 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
  32 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
  33 #include "gc_implementation/g1/g1ErgoVerbose.hpp"
  34 #include "gc_implementation/g1/g1Log.hpp"
  35 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
  36 #include "gc_implementation/g1/g1RemSet.hpp"
  37 #include "gc_implementation/g1/heapRegion.inline.hpp"
  38 #include "gc_implementation/g1/heapRegionManager.inline.hpp"
  39 #include "gc_implementation/g1/heapRegionRemSet.hpp"
  40 #include "gc_implementation/g1/heapRegionSet.inline.hpp"
  41 #include "gc_implementation/shared/vmGCOperations.hpp"
  42 #include "gc_implementation/shared/gcTimer.hpp"
  43 #include "gc_implementation/shared/gcTrace.hpp"
  44 #include "gc_implementation/shared/gcTraceTime.hpp"
  45 #include "memory/allocation.hpp"
  46 #include "memory/genOopClosures.inline.hpp"
  47 #include "memory/referencePolicy.hpp"
  48 #include "memory/resourceArea.hpp"

  49 #include "oops/oop.inline.hpp"
  50 #include "runtime/handles.inline.hpp"
  51 #include "runtime/java.hpp"
  52 #include "runtime/atomic.inline.hpp"
  53 #include "runtime/prefetch.inline.hpp"
  54 #include "services/memTracker.hpp"
  55 
  56 // Concurrent marking bit map wrapper
  57 
  58 CMBitMapRO::CMBitMapRO(int shifter) :
  59   _bm(),
  60   _shifter(shifter) {
  61   _bmStartWord = 0;
  62   _bmWordSize = 0;
  63 }
  64 
  65 HeapWord* CMBitMapRO::getNextMarkedWordAddress(const HeapWord* addr,
  66                                                const HeapWord* limit) const {
  67   // First we must round addr *up* to a possible object boundary.
  68   addr = (HeapWord*)align_size_up((intptr_t)addr,


2633       // want to abort remark and do concurrent marking again.
2634       task->record_end_time();
2635     }
2636   }
2637 
2638   CMRemarkTask(ConcurrentMark* cm, int active_workers) :
2639     AbstractGangTask("Par Remark"), _cm(cm) {
2640     _cm->terminator()->reset_for_reuse(active_workers);
2641   }
2642 };
2643 
2644 void ConcurrentMark::checkpointRootsFinalWork() {
2645   ResourceMark rm;
2646   HandleMark   hm;
2647   G1CollectedHeap* g1h = G1CollectedHeap::heap();
2648 
2649   G1CMTraceTime trace("Finalize Marking", G1Log::finer());
2650 
2651   g1h->ensure_parsability(false);
2652 
2653   G1CollectedHeap::StrongRootsScope srs(g1h);
2654   // this is remark, so we'll use up all active threads
2655   uint active_workers = g1h->workers()->active_workers();
2656   if (active_workers == 0) {
2657     assert(active_workers > 0, "Should have been set earlier");
2658     active_workers = (uint) ParallelGCThreads;
2659     g1h->workers()->set_active_workers(active_workers);
2660   }
2661   set_concurrency_and_phase(active_workers, false /* concurrent */);
2662   // Leave _parallel_marking_threads at it's
2663   // value originally calculated in the ConcurrentMark
2664   // constructor and pass values of the active workers
2665   // through the gang in the task.
2666 
2667   CMRemarkTask remarkTask(this, active_workers);
2668   // We will start all available threads, even if we decide that the
2669   // active_workers will be fewer. The extra ones will just bail out
2670   // immediately.
2671   g1h->set_par_threads(active_workers);
2672   g1h->workers()->run_task(&remarkTask);
2673   g1h->set_par_threads(0);




  29 #include "gc_implementation/g1/concurrentMark.inline.hpp"
  30 #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
  31 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
  32 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
  33 #include "gc_implementation/g1/g1ErgoVerbose.hpp"
  34 #include "gc_implementation/g1/g1Log.hpp"
  35 #include "gc_implementation/g1/g1OopClosures.inline.hpp"
  36 #include "gc_implementation/g1/g1RemSet.hpp"
  37 #include "gc_implementation/g1/heapRegion.inline.hpp"
  38 #include "gc_implementation/g1/heapRegionManager.inline.hpp"
  39 #include "gc_implementation/g1/heapRegionRemSet.hpp"
  40 #include "gc_implementation/g1/heapRegionSet.inline.hpp"
  41 #include "gc_implementation/shared/vmGCOperations.hpp"
  42 #include "gc_implementation/shared/gcTimer.hpp"
  43 #include "gc_implementation/shared/gcTrace.hpp"
  44 #include "gc_implementation/shared/gcTraceTime.hpp"
  45 #include "memory/allocation.hpp"
  46 #include "memory/genOopClosures.inline.hpp"
  47 #include "memory/referencePolicy.hpp"
  48 #include "memory/resourceArea.hpp"
  49 #include "memory/strongRootsScope.hpp"
  50 #include "oops/oop.inline.hpp"
  51 #include "runtime/handles.inline.hpp"
  52 #include "runtime/java.hpp"
  53 #include "runtime/atomic.inline.hpp"
  54 #include "runtime/prefetch.inline.hpp"
  55 #include "services/memTracker.hpp"
  56 
  57 // Concurrent marking bit map wrapper
  58 
  59 CMBitMapRO::CMBitMapRO(int shifter) :
  60   _bm(),
  61   _shifter(shifter) {
  62   _bmStartWord = 0;
  63   _bmWordSize = 0;
  64 }
  65 
  66 HeapWord* CMBitMapRO::getNextMarkedWordAddress(const HeapWord* addr,
  67                                                const HeapWord* limit) const {
  68   // First we must round addr *up* to a possible object boundary.
  69   addr = (HeapWord*)align_size_up((intptr_t)addr,


2634       // want to abort remark and do concurrent marking again.
2635       task->record_end_time();
2636     }
2637   }
2638 
2639   CMRemarkTask(ConcurrentMark* cm, int active_workers) :
2640     AbstractGangTask("Par Remark"), _cm(cm) {
2641     _cm->terminator()->reset_for_reuse(active_workers);
2642   }
2643 };
2644 
2645 void ConcurrentMark::checkpointRootsFinalWork() {
2646   ResourceMark rm;
2647   HandleMark   hm;
2648   G1CollectedHeap* g1h = G1CollectedHeap::heap();
2649 
2650   G1CMTraceTime trace("Finalize Marking", G1Log::finer());
2651 
2652   g1h->ensure_parsability(false);
2653 
2654   StrongRootsScope srs;
2655   // this is remark, so we'll use up all active threads
2656   uint active_workers = g1h->workers()->active_workers();
2657   if (active_workers == 0) {
2658     assert(active_workers > 0, "Should have been set earlier");
2659     active_workers = (uint) ParallelGCThreads;
2660     g1h->workers()->set_active_workers(active_workers);
2661   }
2662   set_concurrency_and_phase(active_workers, false /* concurrent */);
2663   // Leave _parallel_marking_threads at it's
2664   // value originally calculated in the ConcurrentMark
2665   // constructor and pass values of the active workers
2666   // through the gang in the task.
2667 
2668   CMRemarkTask remarkTask(this, active_workers);
2669   // We will start all available threads, even if we decide that the
2670   // active_workers will be fewer. The extra ones will just bail out
2671   // immediately.
2672   g1h->set_par_threads(active_workers);
2673   g1h->workers()->run_task(&remarkTask);
2674   g1h->set_par_threads(0);


< prev index next >