src/hotspot/share/gc/z/zHeap.cpp
changeset 55307 ed12027517c0
parent 55285 9a120214e732
child 55311 d60b24a09900
equal deleted inserted replaced
55306:ea43db53de91 55307:ed12027517c0
   326 
   326 
   327 void ZHeap::mark_flush_and_free(Thread* thread) {
   327 void ZHeap::mark_flush_and_free(Thread* thread) {
   328   _mark.flush_and_free(thread);
   328   _mark.flush_and_free(thread);
   329 }
   329 }
   330 
   330 
   331 class ZFixupPartialLoadsClosure : public ZRootsIteratorClosure {
       
   332 public:
       
   333   virtual void do_oop(oop* p) {
       
   334     ZBarrier::mark_barrier_on_root_oop_field(p);
       
   335   }
       
   336 
       
   337   virtual void do_oop(narrowOop* p) {
       
   338     ShouldNotReachHere();
       
   339   }
       
   340 };
       
   341 
       
   342 class ZFixupPartialLoadsTask : public ZTask {
       
   343 private:
       
   344   ZThreadRootsIterator _thread_roots;
       
   345 
       
   346 public:
       
   347   ZFixupPartialLoadsTask() :
       
   348       ZTask("ZFixupPartialLoadsTask"),
       
   349       _thread_roots() {}
       
   350 
       
   351   virtual void work() {
       
   352     ZFixupPartialLoadsClosure cl;
       
   353     _thread_roots.oops_do(&cl);
       
   354   }
       
   355 };
       
   356 
       
   357 void ZHeap::fixup_partial_loads() {
       
   358   ZFixupPartialLoadsTask task;
       
   359   _workers.run_parallel(&task);
       
   360 }
       
   361 
       
   362 bool ZHeap::mark_end() {
   331 bool ZHeap::mark_end() {
   363   assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
   332   assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
   364 
       
   365   // C2 can generate code where a safepoint poll is inserted
       
   366   // between a load and the associated load barrier. To handle
       
   367   // this case we need to rescan the thread stack here to make
       
   368   // sure such oops are marked.
       
   369   fixup_partial_loads();
       
   370 
   333 
   371   // Try end marking
   334   // Try end marking
   372   if (!_mark.end()) {
   335   if (!_mark.end()) {
   373     // Marking not completed, continue concurrent mark
   336     // Marking not completed, continue concurrent mark
   374     return false;
   337     return false;