< prev index next >
src/share/vm/memory/threadLocalAllocBuffer.hpp
Print this page
@@ -56,12 +56,12 @@
unsigned _gc_waste;
unsigned _slow_allocations;
AdaptiveWeightedAverage _allocation_fraction; // fraction of eden allocated in tlabs
- void accumulate_statistics();
- void initialize_statistics();
+ bool _gclab;
+ bool _initialized;
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; }
@@ -76,13 +76,10 @@
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,14 +96,16 @@
static GlobalTLABStats* _global_stats;
static GlobalTLABStats* global_stats() { return _global_stats; }
public:
- ThreadLocalAllocBuffer() : _allocation_fraction(TLABAllocationWeight), _allocated_before_last_gc(0) {
+ ThreadLocalAllocBuffer() : _allocation_fraction(TLABAllocationWeight), _allocated_before_last_gc(0), _initialized(false) {
// do nothing. tlabs must be inited by initialize() calls
}
+ bool is_initialized() const { return _initialized; };
+
static const size_t min_size() { return align_object_size(MinTLABSize / HeapWordSize) + alignment_reserve(); }
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; }
@@ -129,10 +128,20 @@
// Reserve space at the end of TLAB
static size_t end_reserve() {
int reserve_size = typeArrayOopDesc::header_size(T_INT);
return MAX2(reserve_size, VM_Version::reserve_for_allocation_prefetch());
}
+
+ // 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);
+
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.
@@ -156,11 +165,11 @@
// Resize tlabs for all threads
static void resize_all_tlabs();
void fill(HeapWord* start, HeapWord* top, size_t new_size);
- void initialize();
+ void initialize(bool gclab);
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 >