< prev index next >

src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp

Print this page
rev 56112 : [mq]: lkorinth_review


   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_GC_G1_G1DIRTYCARDQUEUE_HPP
  26 #define SHARE_GC_G1_G1DIRTYCARDQUEUE_HPP
  27 

  28 #include "gc/shared/ptrQueue.hpp"
  29 #include "memory/allocation.hpp"
  30 
  31 class G1CardTableEntryClosure;
  32 class G1DirtyCardQueueSet;
  33 class G1FreeIdSet;
  34 class G1RedirtyCardsQueueSet;
  35 class Thread;
  36 class Monitor;
  37 
  38 // A ptrQueue whose elements are "oops", pointers to object heads.
  39 class G1DirtyCardQueue: public PtrQueue {
  40 protected:
  41   virtual void handle_completed_buffer();
  42 
  43 public:
  44   G1DirtyCardQueue(G1DirtyCardQueueSet* qset);
  45 
  46   // Flush before destroying; queue may be used to capture pending work while
  47   // doing something else, with auto-flush on completion.
  48   ~G1DirtyCardQueue();
  49 
  50   // Process queue entries and release resources.
  51   void flush() { flush_impl(); }
  52 
  53   inline G1DirtyCardQueueSet* dirty_card_qset() const;


 101   // invocation returns false, processing is stopped and the partially
 102   // processed buffer (with its index updated to exclude the processed
 103   // elements, e.g. up to the element for which the closure returned
 104   // false) is returned to the completed buffer set.
 105   //
 106   // If during_pause is true, stop_at must be zero, and the closure
 107   // must never return false.
 108   bool apply_closure_to_completed_buffer(G1CardTableEntryClosure* cl,
 109                                          uint worker_i,
 110                                          size_t stop_at,
 111                                          bool during_pause);
 112 
 113   bool mut_process_buffer(BufferNode* node);
 114 
 115   // If the queue contains more buffers than configured here, the
 116   // mutator must start doing some of the concurrent refinement work,
 117   size_t _max_completed_buffers;
 118   size_t _completed_buffers_padding;
 119   static const size_t MaxCompletedBuffersUnlimited = SIZE_MAX;
 120 
 121   G1FreeIdSet* _free_ids;
 122 
 123   // The number of completed buffers processed by mutator and rs thread,
 124   // respectively.
 125   jint _processed_buffers_mut;
 126   jint _processed_buffers_rs_thread;
 127 
 128 public:
 129   G1DirtyCardQueueSet(bool notify_when_complete = true);
 130   ~G1DirtyCardQueueSet();
 131 
 132   void initialize(Monitor* cbl_mon, BufferNode::Allocator* allocator);
 133 
 134   // The number of parallel ids that can be claimed to allow collector or
 135   // mutator threads to do card-processing work.
 136   static uint num_par_ids();
 137 
 138   static void handle_zero_index_for_thread(Thread* t);
 139 
 140   // Either process the entire buffer and return true, or enqueue the
 141   // buffer and return false.  If the buffer is completely processed,




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_GC_G1_G1DIRTYCARDQUEUE_HPP
  26 #define SHARE_GC_G1_G1DIRTYCARDQUEUE_HPP
  27 
  28 #include "gc/g1/g1FreeIdSet.hpp"
  29 #include "gc/shared/ptrQueue.hpp"
  30 #include "memory/allocation.hpp"
  31 
  32 class G1CardTableEntryClosure;
  33 class G1DirtyCardQueueSet;

  34 class G1RedirtyCardsQueueSet;
  35 class Thread;
  36 class Monitor;
  37 
  38 // A ptrQueue whose elements are "oops", pointers to object heads.
  39 class G1DirtyCardQueue: public PtrQueue {
  40 protected:
  41   virtual void handle_completed_buffer();
  42 
  43 public:
  44   G1DirtyCardQueue(G1DirtyCardQueueSet* qset);
  45 
  46   // Flush before destroying; queue may be used to capture pending work while
  47   // doing something else, with auto-flush on completion.
  48   ~G1DirtyCardQueue();
  49 
  50   // Process queue entries and release resources.
  51   void flush() { flush_impl(); }
  52 
  53   inline G1DirtyCardQueueSet* dirty_card_qset() const;


 101   // invocation returns false, processing is stopped and the partially
 102   // processed buffer (with its index updated to exclude the processed
 103   // elements, e.g. up to the element for which the closure returned
 104   // false) is returned to the completed buffer set.
 105   //
 106   // If during_pause is true, stop_at must be zero, and the closure
 107   // must never return false.
 108   bool apply_closure_to_completed_buffer(G1CardTableEntryClosure* cl,
 109                                          uint worker_i,
 110                                          size_t stop_at,
 111                                          bool during_pause);
 112 
 113   bool mut_process_buffer(BufferNode* node);
 114 
 115   // If the queue contains more buffers than configured here, the
 116   // mutator must start doing some of the concurrent refinement work,
 117   size_t _max_completed_buffers;
 118   size_t _completed_buffers_padding;
 119   static const size_t MaxCompletedBuffersUnlimited = SIZE_MAX;
 120 
 121   G1FreeIdSet _free_ids;
 122 
 123   // The number of completed buffers processed by mutator and rs thread,
 124   // respectively.
 125   jint _processed_buffers_mut;
 126   jint _processed_buffers_rs_thread;
 127 
 128 public:
 129   G1DirtyCardQueueSet(bool notify_when_complete = true);
 130   ~G1DirtyCardQueueSet();
 131 
 132   void initialize(Monitor* cbl_mon, BufferNode::Allocator* allocator);
 133 
 134   // The number of parallel ids that can be claimed to allow collector or
 135   // mutator threads to do card-processing work.
 136   static uint num_par_ids();
 137 
 138   static void handle_zero_index_for_thread(Thread* t);
 139 
 140   // Either process the entire buffer and return true, or enqueue the
 141   // buffer and return false.  If the buffer is completely processed,


< prev index next >