diff src/share/vm/memory/threadLocalAllocBuffer.hpp @ 17727:cfd4aac53239

8030177: G1: Enable TLAB resizing Reviewed-by: tschatzl, stefank, jmasa
author brutisso
date Mon, 27 Jan 2014 13:14:53 +0100
parents b9a9ed0f8eeb
children 4ca6dc0799b6 060cdf93040c
line wrap: on
line diff
--- a/src/share/vm/memory/threadLocalAllocBuffer.hpp	Thu Jan 23 12:08:28 2014 +0100
+++ b/src/share/vm/memory/threadLocalAllocBuffer.hpp	Mon Jan 27 13:14:53 2014 +0100
@@ -45,7 +45,9 @@
   HeapWord* _end;                                // allocation end (excluding alignment_reserve)
   size_t    _desired_size;                       // desired size   (including alignment_reserve)
   size_t    _refill_waste_limit;                 // hold onto tlab if free() is larger than this
+  size_t    _allocated_before_last_gc;           // total bytes allocated up until the last gc
 
+  static size_t   _max_size;                     // maximum size of any TLAB
   static unsigned _target_refills;               // expected number of refills between GCs
 
   unsigned  _number_of_refills;
@@ -99,12 +101,13 @@
   static GlobalTLABStats* global_stats() { return _global_stats; }
 
 public:
-  ThreadLocalAllocBuffer() : _allocation_fraction(TLABAllocationWeight) {
+  ThreadLocalAllocBuffer() : _allocation_fraction(TLABAllocationWeight), _allocated_before_last_gc(0) {
     // do nothing.  tlabs must be inited by initialize() calls
   }
 
   static const size_t min_size()                 { return align_object_size(MinTLABSize / HeapWordSize); }
-  static const size_t max_size();
+  static const size_t max_size()                 { assert(_max_size != 0, "max_size not set up"); return _max_size; }
+  static void set_max_size(size_t max_size)      { _max_size = max_size; }
 
   HeapWord* start() const                        { return _start; }
   HeapWord* end() const                          { return _end; }