src/share/vm/gc_implementation/g1/ptrQueue.hpp

Print this page


   1 /*
   2  * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   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 // There are various techniques that require threads to be able to log
  26 // addresses.  For example, a generational write barrier might log
  27 // the addresses of modified old-generation objects.  This type supports
  28 // this operation.
  29 
  30 // The definition of placement operator new(size_t, void*) in the <new>.
  31 #include <new>
  32 
  33 class PtrQueueSet;
  34 class PtrQueue VALUE_OBJ_CLASS_SPEC {
  35 
  36 protected:
  37   // The ptr queue set to which this queue belongs.
  38   PtrQueueSet* _qset;
  39 
  40   // Whether updates should be logged.
  41   bool _active;
  42 
  43   // The buffer.
  44   void** _buf;


 276   void set_process_completed_threshold(int sz) { _process_completed_threshold = sz; }
 277   int process_completed_threshold() const { return _process_completed_threshold; }
 278 
 279   // Must only be called at a safe point.  Indicates that the buffer free
 280   // list size may be reduced, if that is deemed desirable.
 281   void reduce_free_list();
 282 
 283   int completed_buffers_num() { return _n_completed_buffers; }
 284 
 285   void merge_bufferlists(PtrQueueSet* src);
 286 
 287   void set_max_completed_queue(int m) { _max_completed_queue = m; }
 288   int max_completed_queue() { return _max_completed_queue; }
 289 
 290   void set_completed_queue_padding(int padding) { _completed_queue_padding = padding; }
 291   int completed_queue_padding() { return _completed_queue_padding; }
 292 
 293   // Notify the consumer if the number of buffers crossed the threshold
 294   void notify_if_necessary();
 295 };


   1 /*
   2  * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   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_VM_GC_IMPLEMENTATION_G1_PTRQUEUE_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_PTRQUEUE_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "utilities/sizes.hpp"
  30 
  31 // There are various techniques that require threads to be able to log
  32 // addresses.  For example, a generational write barrier might log
  33 // the addresses of modified old-generation objects.  This type supports
  34 // this operation.
  35 
  36 // The definition of placement operator new(size_t, void*) in the <new>.
  37 #include <new>
  38 
  39 class PtrQueueSet;
  40 class PtrQueue VALUE_OBJ_CLASS_SPEC {
  41 
  42 protected:
  43   // The ptr queue set to which this queue belongs.
  44   PtrQueueSet* _qset;
  45 
  46   // Whether updates should be logged.
  47   bool _active;
  48 
  49   // The buffer.
  50   void** _buf;


 282   void set_process_completed_threshold(int sz) { _process_completed_threshold = sz; }
 283   int process_completed_threshold() const { return _process_completed_threshold; }
 284 
 285   // Must only be called at a safe point.  Indicates that the buffer free
 286   // list size may be reduced, if that is deemed desirable.
 287   void reduce_free_list();
 288 
 289   int completed_buffers_num() { return _n_completed_buffers; }
 290 
 291   void merge_bufferlists(PtrQueueSet* src);
 292 
 293   void set_max_completed_queue(int m) { _max_completed_queue = m; }
 294   int max_completed_queue() { return _max_completed_queue; }
 295 
 296   void set_completed_queue_padding(int padding) { _completed_queue_padding = padding; }
 297   int completed_queue_padding() { return _completed_queue_padding; }
 298 
 299   // Notify the consumer if the number of buffers crossed the threshold
 300   void notify_if_necessary();
 301 };
 302 
 303 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_PTRQUEUE_HPP