< prev index next >

src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp

Print this page
rev 48920 : [backport] Use PLAB for evacuations instead of TLAB

@@ -59,12 +59,12 @@
   unsigned  _gc_waste;
   unsigned  _slow_allocations;
 
   AdaptiveWeightedAverage _allocation_fraction;  // fraction of eden allocated in tlabs
 
-  bool _gclab;
-  bool _initialized;
+  void accumulate_statistics();
+  void initialize_statistics();
 
   void set_start(HeapWord* start)                { _start = start; }
   void set_end(HeapWord* end)                    { _end = end; }
   void set_top(HeapWord* top)                    { _top = top; }
   void set_pf_top(HeapWord* pf_top)              { _pf_top = pf_top; }

@@ -79,10 +79,13 @@
   size_t remaining() const                       { return end() == NULL ? 0 : pointer_delta(hard_end(), top()); }
 
   // Make parsable and release it.
   void reset();
 
+  // Resize based on amount of allocation, etc.
+  void resize();
+
   void invariants() const { assert(top() >= start() && top() <= end(), "invalid tlab"); }
 
   void initialize(HeapWord* start, HeapWord* top, HeapWord* end);
 
   void print_stats(const char* tag);

@@ -99,16 +102,14 @@
 
   static GlobalTLABStats* _global_stats;
   static GlobalTLABStats* global_stats() { return _global_stats; }
 
 public:
-  ThreadLocalAllocBuffer() : _allocation_fraction(TLABAllocationWeight), _allocated_before_last_gc(0), _initialized(false) {
+  ThreadLocalAllocBuffer() : _allocation_fraction(TLABAllocationWeight), _allocated_before_last_gc(0) {
     // do nothing.  tlabs must be inited by initialize() calls
   }
 
-  bool is_initialized() const { return _initialized; };
-
   static size_t min_size()                       { return align_object_size(MinTLABSize / HeapWordSize) + alignment_reserve(); }
   static size_t max_size()                       { assert(_max_size != 0, "max_size not set up"); return _max_size; }
   static size_t max_size_in_bytes()              { return max_size() * BytesPerWord; }
   static void set_max_size(size_t max_size)      { _max_size = max_size; }
 

@@ -125,21 +126,15 @@
   size_t refill_waste_limit() const              { return _refill_waste_limit; }
 
   // Allocate size HeapWords. The memory is NOT initialized to zero.
   inline HeapWord* allocate(size_t size);
 
-  // Resize based on amount of allocation, etc.
-  void resize();
-
-  void accumulate_statistics();
-  void initialize_statistics();
-
-  // Rolls back a single allocation of the given size.
-  void rollback(size_t size);
-
   // Reserve space at the end of TLAB
-  static size_t end_reserve();
+  static size_t end_reserve() {
+    int reserve_size = typeArrayOopDesc::header_size(T_INT);
+    return MAX2(reserve_size, _reserve_for_allocation_prefetch);
+  }
   static size_t alignment_reserve()              { return align_object_size(end_reserve()); }
   static size_t alignment_reserve_in_bytes()     { return alignment_reserve() * HeapWordSize; }
 
   // Return tlab size or remaining space in eden such that the
   // space is large enough to hold obj_size and necessary fill space.

@@ -163,11 +158,11 @@
 
   // Resize tlabs for all threads
   static void resize_all_tlabs();
 
   void fill(HeapWord* start, HeapWord* top, size_t new_size);
-  void initialize(bool gclab);
+  void initialize();
 
   static size_t refill_waste_limit_increment()   { return TLABWasteIncrement; }
 
   // Code generation support
   static ByteSize start_offset()                 { return byte_offset_of(ThreadLocalAllocBuffer, _start); }
< prev index next >