src/hotspot/share/gc/z/zMark.cpp
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 54488 25199b48f34f
child 58679 9c3209ff7550
equal deleted inserted replaced
58677:13588c901957 58678:9cf78a70fa4f
    20  * or visit www.oracle.com if you need additional information or have any
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 #include "precompiled.hpp"
    24 #include "precompiled.hpp"
       
    25 #include "classfile/classLoaderDataGraph.hpp"
    25 #include "gc/z/zBarrier.inline.hpp"
    26 #include "gc/z/zBarrier.inline.hpp"
    26 #include "gc/z/zMark.inline.hpp"
    27 #include "gc/z/zMark.inline.hpp"
    27 #include "gc/z/zMarkCache.inline.hpp"
    28 #include "gc/z/zMarkCache.inline.hpp"
    28 #include "gc/z/zMarkStack.inline.hpp"
    29 #include "gc/z/zMarkStack.inline.hpp"
    29 #include "gc/z/zMarkTerminate.inline.hpp"
    30 #include "gc/z/zMarkTerminate.inline.hpp"
   130 
   131 
   131   virtual void do_thread(Thread* thread) {
   132   virtual void do_thread(Thread* thread) {
   132     // Update thread local address bad mask
   133     // Update thread local address bad mask
   133     ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask);
   134     ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask);
   134 
   135 
       
   136     // Mark invisible root
       
   137     ZThreadLocalData::do_invisible_root(thread, ZBarrier::mark_barrier_on_invisible_root_oop_field);
       
   138 
   135     // Retire TLAB
   139     // Retire TLAB
   136     ZThreadLocalAllocBuffer::retire(thread);
   140     ZThreadLocalAllocBuffer::retire(thread);
   137   }
   141   }
   138 
   142 
   139   virtual void do_oop(oop* p) {
   143   virtual void do_oop(oop* p) {
   153 
   157 
   154 public:
   158 public:
   155   ZMarkRootsTask(ZMark* mark) :
   159   ZMarkRootsTask(ZMark* mark) :
   156       ZTask("ZMarkRootsTask"),
   160       ZTask("ZMarkRootsTask"),
   157       _mark(mark),
   161       _mark(mark),
   158       _roots() {}
   162       _roots(false /* visit_jvmti_weak_export */) {}
   159 
   163 
   160   virtual void work() {
   164   virtual void work() {
   161     _roots.oops_do(&_cl);
   165     _roots.oops_do(&_cl);
   162 
   166 
   163     // Flush and free worker stacks. Needed here since
   167     // Flush and free worker stacks. Needed here since
   336   if (partial_array) {
   340   if (partial_array) {
   337     follow_partial_array(entry, finalizable);
   341     follow_partial_array(entry, finalizable);
   338     return;
   342     return;
   339   }
   343   }
   340 
   344 
   341   // Decode object address
   345   // Decode object address and follow flag
   342   const uintptr_t addr = entry.object_address();
   346   const uintptr_t addr = entry.object_address();
   343 
   347 
   344   if (!try_mark_object(cache, addr, finalizable)) {
   348   if (!try_mark_object(cache, addr, finalizable)) {
   345     // Already marked
   349     // Already marked
   346     return;
   350     return;
   347   }
   351   }
   348 
   352 
   349   if (is_array(addr)) {
   353   if (is_array(addr)) {
   350     follow_array_object(objArrayOop(ZOop::from_address(addr)), finalizable);
   354     // Decode follow flag
       
   355     const bool follow = entry.follow();
       
   356 
       
   357     // The follow flag is currently only relevant for object arrays
       
   358     if (follow) {
       
   359       follow_array_object(objArrayOop(ZOop::from_address(addr)), finalizable);
       
   360     }
   351   } else {
   361   } else {
   352     follow_object(ZOop::from_address(addr), finalizable);
   362     follow_object(ZOop::from_address(addr), finalizable);
   353   }
   363   }
   354 }
   364 }
   355 
   365 
   630 };
   640 };
   631 
   641 
   632 
   642 
   633 class ZMarkConcurrentRootsTask : public ZTask {
   643 class ZMarkConcurrentRootsTask : public ZTask {
   634 private:
   644 private:
   635   ZConcurrentRootsIterator            _roots;
   645   SuspendibleThreadSetJoiner          _sts_joiner;
       
   646   ZConcurrentRootsIteratorClaimStrong _roots;
   636   ZMarkConcurrentRootsIteratorClosure _cl;
   647   ZMarkConcurrentRootsIteratorClosure _cl;
   637 
   648 
   638 public:
   649 public:
   639   ZMarkConcurrentRootsTask(ZMark* mark) :
   650   ZMarkConcurrentRootsTask(ZMark* mark) :
   640       ZTask("ZMarkConcurrentRootsTask"),
   651       ZTask("ZMarkConcurrentRootsTask"),
   641       _roots(true /* marking */),
   652       _sts_joiner(),
   642       _cl() {}
   653       _roots(),
       
   654       _cl() {
       
   655     ClassLoaderDataGraph_lock->lock();
       
   656   }
       
   657 
       
   658   ~ZMarkConcurrentRootsTask() {
       
   659     ClassLoaderDataGraph_lock->unlock();
       
   660   }
   643 
   661 
   644   virtual void work() {
   662   virtual void work() {
   645     _roots.oops_do(&_cl);
   663     _roots.oops_do(&_cl);
   646   }
   664   }
   647 };
   665 };