src/hotspot/share/gc/z/zMark.cpp
changeset 52140 3a168f782e80
parent 51818 75e4ce0fa1ba
child 52939 9a8585f60c32
equal deleted inserted replaced
52139:5a2af44ecb83 52140:3a168f782e80
   613 
   613 
   614   // Free remaining stacks
   614   // Free remaining stacks
   615   stacks->free(&_allocator);
   615   stacks->free(&_allocator);
   616 }
   616 }
   617 
   617 
       
   618 class ZMarkConcurrentRootsIteratorClosure : public ZRootsIteratorClosure {
       
   619 public:
       
   620   virtual void do_oop(oop* p) {
       
   621     ZBarrier::mark_barrier_on_oop_field(p, false /* finalizable */);
       
   622   }
       
   623 
       
   624   virtual void do_oop(narrowOop* p) {
       
   625     ShouldNotReachHere();
       
   626   }
       
   627 };
       
   628 
       
   629 
       
   630 class ZMarkConcurrentRootsTask : public ZTask {
       
   631 private:
       
   632   ZConcurrentRootsIterator            _roots;
       
   633   ZMarkConcurrentRootsIteratorClosure _cl;
       
   634 
       
   635 public:
       
   636   ZMarkConcurrentRootsTask(ZMark* mark) :
       
   637       ZTask("ZMarkConcurrentRootsTask"),
       
   638       _roots(true /* marking */),
       
   639       _cl() {}
       
   640 
       
   641   virtual void work() {
       
   642     _roots.oops_do(&_cl);
       
   643   }
       
   644 };
       
   645 
   618 class ZMarkTask : public ZTask {
   646 class ZMarkTask : public ZTask {
   619 private:
   647 private:
   620   ZMark* const   _mark;
   648   ZMark* const   _mark;
   621   const uint64_t _timeout_in_millis;
   649   const uint64_t _timeout_in_millis;
   622 
   650 
   635   virtual void work() {
   663   virtual void work() {
   636     _mark->work(_timeout_in_millis);
   664     _mark->work(_timeout_in_millis);
   637   }
   665   }
   638 };
   666 };
   639 
   667 
   640 void ZMark::mark() {
   668 void ZMark::mark(bool initial) {
       
   669   if (initial) {
       
   670     ZMarkConcurrentRootsTask task(this);
       
   671     _workers->run_concurrent(&task);
       
   672   }
       
   673 
   641   ZMarkTask task(this);
   674   ZMarkTask task(this);
   642   _workers->run_concurrent(&task);
   675   _workers->run_concurrent(&task);
   643 }
   676 }
   644 
   677 
   645 bool ZMark::try_complete() {
   678 bool ZMark::try_complete() {