< prev index next >

src/share/vm/gc/shared/plab.hpp

Print this page
rev 8362 : [mq]: hotspot


   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_SHARED_PLAB_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_PLAB_HPP
  27 
  28 #include "gc_implementation/shared/gcUtil.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "runtime/atomic.hpp"
  31 #include "utilities/globalDefinitions.hpp"
  32 
  33 // Forward declarations.
  34 class PLABStats;
  35 
  36 // A per-thread allocation buffer used during GC.
  37 class PLAB: public CHeapObj<mtGC> {
  38 protected:
  39   char      head[32];
  40   size_t    _word_sz;          // In HeapWord units
  41   HeapWord* _bottom;
  42   HeapWord* _top;
  43   HeapWord* _end;           // Last allocatable address + 1
  44   HeapWord* _hard_end;      // _end + AlignmentReserve
  45   // In support of ergonomic sizing of PLAB's
  46   size_t    _allocated;     // in HeapWord units
  47   size_t    _wasted;        // in HeapWord units
  48   size_t    _undo_wasted;


 190   // updates _desired_plab_sz and clears sensor accumulators.
 191   void adjust_desired_plab_sz(uint no_of_gc_workers);
 192 
 193   void add_allocated(size_t v) {
 194     Atomic::add_ptr(v, &_allocated);
 195   }
 196 
 197   void add_unused(size_t v) {
 198     Atomic::add_ptr(v, &_unused);
 199   }
 200 
 201   void add_wasted(size_t v) {
 202     Atomic::add_ptr(v, &_wasted);
 203   }
 204 
 205   void add_undo_wasted(size_t v) {
 206     Atomic::add_ptr(v, &_undo_wasted);
 207   }
 208 };
 209 
 210 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_PLAB_HPP


   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_SHARED_PLAB_HPP
  26 #define SHARE_VM_GC_SHARED_PLAB_HPP
  27 
  28 #include "gc/shared/gcUtil.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "runtime/atomic.hpp"
  31 #include "utilities/globalDefinitions.hpp"
  32 
  33 // Forward declarations.
  34 class PLABStats;
  35 
  36 // A per-thread allocation buffer used during GC.
  37 class PLAB: public CHeapObj<mtGC> {
  38 protected:
  39   char      head[32];
  40   size_t    _word_sz;          // In HeapWord units
  41   HeapWord* _bottom;
  42   HeapWord* _top;
  43   HeapWord* _end;           // Last allocatable address + 1
  44   HeapWord* _hard_end;      // _end + AlignmentReserve
  45   // In support of ergonomic sizing of PLAB's
  46   size_t    _allocated;     // in HeapWord units
  47   size_t    _wasted;        // in HeapWord units
  48   size_t    _undo_wasted;


 190   // updates _desired_plab_sz and clears sensor accumulators.
 191   void adjust_desired_plab_sz(uint no_of_gc_workers);
 192 
 193   void add_allocated(size_t v) {
 194     Atomic::add_ptr(v, &_allocated);
 195   }
 196 
 197   void add_unused(size_t v) {
 198     Atomic::add_ptr(v, &_unused);
 199   }
 200 
 201   void add_wasted(size_t v) {
 202     Atomic::add_ptr(v, &_wasted);
 203   }
 204 
 205   void add_undo_wasted(size_t v) {
 206     Atomic::add_ptr(v, &_undo_wasted);
 207   }
 208 };
 209 
 210 #endif // SHARE_VM_GC_SHARED_PLAB_HPP
< prev index next >