< prev index next >

src/share/vm/gc/g1/dirtyCardQueue.hpp

Print this page
rev 8802 : G1 performance improvements: card batching, joining, sorting, prefetching and write barrier fence elision and simplification based on a global syncrhonization using handshakes piggybacking on thread-local safepoints.


  63                      uint worker_i = 0);
  64 
  65   // Apply the closure to all elements of "buf", down to "index"
  66   // (inclusive.)  If returns "false", then a closure application returned
  67   // "false", and we return immediately.  If "consume" is true, entries are
  68   // set to NULL as they are processed, so they will not be processed again
  69   // later.
  70   static bool apply_closure_to_buffer(CardTableEntryClosure* cl,
  71                                       void** buf, size_t index, size_t sz,
  72                                       bool consume = true,
  73                                       uint worker_i = 0);
  74   void **get_buf() { return _buf;}
  75   void set_buf(void **buf) {_buf = buf;}
  76   size_t get_index() { return _index;}
  77   void reinitialize() { _buf = 0; _sz = 0; _index = 0;}
  78 };
  79 
  80 
  81 
  82 class DirtyCardQueueSet: public PtrQueueSet {
  83   // The closure used in mut_process_buffer().
  84   CardTableEntryClosure* _mut_process_closure;
  85 
  86   DirtyCardQueue _shared_dirty_card_queue;
  87 
  88   // Override.
  89   bool mut_process_buffer(void** buf);
  90 
  91   // Protected by the _cbl_mon.
  92   FreeIdSet* _free_ids;
  93 
  94   // The number of completed buffers processed by mutator and rs thread,
  95   // respectively.
  96   jint _processed_buffers_mut;
  97   jint _processed_buffers_rs_thread;
  98 
  99   // Current buffer node used for parallel iteration.
 100   BufferNode* volatile _cur_par_buffer_node;


 101 public:
 102   DirtyCardQueueSet(bool notify_when_complete = true);
 103 
 104   void initialize(CardTableEntryClosure* cl, Monitor* cbl_mon, Mutex* fl_lock,
 105                   int process_completed_threshold,
 106                   int max_completed_queue,
 107                   Mutex* lock, PtrQueueSet* fl_owner = NULL);
 108 
 109   // The number of parallel ids that can be claimed to allow collector or
 110   // mutator threads to do card-processing work.
 111   static uint num_par_ids();
 112 
 113   static void handle_zero_index_for_thread(JavaThread* t);
 114 
 115   // Apply the given closure to all entries in all currently-active buffers.
 116   // This should only be applied at a safepoint. (Currently must not be called
 117   // in parallel; this should change in the future.)  If "consume" is true,
 118   // processed entries are discarded.
 119   void iterate_closure_all_threads(CardTableEntryClosure* cl,
 120                                    bool consume = true,
 121                                    uint worker_i = 0);
 122 
 123   // If there exists some completed buffer, pop it, then apply the
 124   // specified closure to all its elements, nulling out those elements




  63                      uint worker_i = 0);
  64 
  65   // Apply the closure to all elements of "buf", down to "index"
  66   // (inclusive.)  If returns "false", then a closure application returned
  67   // "false", and we return immediately.  If "consume" is true, entries are
  68   // set to NULL as they are processed, so they will not be processed again
  69   // later.
  70   static bool apply_closure_to_buffer(CardTableEntryClosure* cl,
  71                                       void** buf, size_t index, size_t sz,
  72                                       bool consume = true,
  73                                       uint worker_i = 0);
  74   void **get_buf() { return _buf;}
  75   void set_buf(void **buf) {_buf = buf;}
  76   size_t get_index() { return _index;}
  77   void reinitialize() { _buf = 0; _sz = 0; _index = 0;}
  78 };
  79 
  80 
  81 
  82 class DirtyCardQueueSet: public PtrQueueSet {



  83   DirtyCardQueue _shared_dirty_card_queue;
  84 
  85   // Override.
  86   bool mut_process_buffer(void** buf);
  87 
  88   // Protected by the _cbl_mon.
  89   FreeIdSet* _free_ids;
  90 
  91   // The number of completed buffers processed by mutator and rs thread,
  92   // respectively.
  93   jint _processed_buffers_mut;
  94   jint _processed_buffers_rs_thread;
  95 
  96   // Current buffer node used for parallel iteration.
  97   BufferNode* volatile _cur_par_buffer_node;
  98 
  99   bool _should_do_processing;
 100 public:
 101   DirtyCardQueueSet(bool notify_when_complete = true);
 102 
 103   void initialize(bool should_do_processing, Monitor* cbl_mon, Mutex* fl_lock,
 104                   int process_completed_threshold,
 105                   int max_completed_queue,
 106                   Mutex* lock, PtrQueueSet* fl_owner = NULL);
 107 
 108   // The number of parallel ids that can be claimed to allow collector or
 109   // mutator threads to do card-processing work.
 110   static uint num_par_ids();
 111 
 112   static void handle_zero_index_for_thread(JavaThread* t);
 113 
 114   // Apply the given closure to all entries in all currently-active buffers.
 115   // This should only be applied at a safepoint. (Currently must not be called
 116   // in parallel; this should change in the future.)  If "consume" is true,
 117   // processed entries are discarded.
 118   void iterate_closure_all_threads(CardTableEntryClosure* cl,
 119                                    bool consume = true,
 120                                    uint worker_i = 0);
 121 
 122   // If there exists some completed buffer, pop it, then apply the
 123   // specified closure to all its elements, nulling out those elements


< prev index next >