< prev index next >

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

Print this page

        

*** 35,55 **** // ThreadLocalAllocBuffer: a descriptor for thread-local storage used by // the threads for allocation. // It is thread-private at any time, but maybe multiplexed over // time across multiple threads. The park()/unpark() pair is // used to make it available for such multiplexing. class ThreadLocalAllocBuffer: public CHeapObj<mtThread> { friend class VMStructs; friend class JVMCIVMStructs; private: HeapWord* _start; // address of TLAB HeapWord* _top; // address after last allocation HeapWord* _pf_top; // allocation prefetch watermark ! 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 int _reserve_for_allocation_prefetch; // Reserve at the end of the TLAB static unsigned _target_refills; // expected number of refills between GCs --- 35,67 ---- // ThreadLocalAllocBuffer: a descriptor for thread-local storage used by // the threads for allocation. // It is thread-private at any time, but maybe multiplexed over // time across multiple threads. The park()/unpark() pair is // used to make it available for such multiplexing. + // + // Heap sampling is performed via the end/actual_end fields. + // actual_end contains the real end of the tlab allocation, + // whereas end can be set to an arbitrary spot in the tlab to + // trip the return and sample the allocation. + // slow_path_end is used to track if a fast tlab refill occured + // between slowpath calls. class ThreadLocalAllocBuffer: public CHeapObj<mtThread> { friend class VMStructs; friend class JVMCIVMStructs; private: HeapWord* _start; // address of TLAB HeapWord* _top; // address after last allocation HeapWord* _pf_top; // allocation prefetch watermark ! HeapWord* _end; // allocation end (can be the sampling end point or ! // the actual TLAB end, excluding alignment_reserve) ! HeapWord* _actual_end; // allocation actual_end (actual TLAB end, excluding alignment_reserve) ! HeapWord* _slow_path_end; // remember the end in case a fast refill occurs. ! 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 + size_t _bytes_until_sample; // bytes until sample. static size_t _max_size; // maximum size of any TLAB static int _reserve_for_allocation_prefetch; // Reserve at the end of the TLAB static unsigned _target_refills; // expected number of refills between GCs
*** 64,84 **** 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; } void set_desired_size(size_t desired_size) { _desired_size = desired_size; } void set_refill_waste_limit(size_t waste) { _refill_waste_limit = waste; } size_t initial_refill_waste_limit() { return desired_size() / TLABRefillWasteFraction; } static int target_refills() { return _target_refills; } size_t initial_desired_size(); ! 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. --- 76,102 ---- void accumulate_statistics(); void initialize_statistics(); void set_start(HeapWord* start) { _start = start; } void set_end(HeapWord* end) { _end = end; } + void set_actual_end(HeapWord* actual_end) { _actual_end = actual_end; } + void set_slow_path_end(HeapWord* slow_path_end) { _slow_path_end = slow_path_end; } void set_top(HeapWord* top) { _top = top; } void set_pf_top(HeapWord* pf_top) { _pf_top = pf_top; } void set_desired_size(size_t desired_size) { _desired_size = desired_size; } void set_refill_waste_limit(size_t waste) { _refill_waste_limit = waste; } + void set_bytes_until_sample(size_t bytes) { _bytes_until_sample = bytes; } size_t initial_refill_waste_limit() { return desired_size() / TLABRefillWasteFraction; } static int target_refills() { return _target_refills; } size_t initial_desired_size(); ! size_t remaining() { return end() == NULL ? 0 : pointer_delta(hard_end(), top()); } ! ! // Obtain the actual end of the TLAB. ! void set_sample_end(); // Make parsable and release it. void reset(); // Resize based on amount of allocation, etc.
*** 111,123 **** 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; } HeapWord* start() const { return _start; } HeapWord* end() const { return _end; } - HeapWord* hard_end() const { return _end + alignment_reserve(); } HeapWord* top() const { return _top; } HeapWord* pf_top() const { return _pf_top; } size_t desired_size() const { return _desired_size; } size_t used() const { return pointer_delta(top(), start()); } size_t used_bytes() const { return pointer_delta(top(), start(), 1); } --- 129,141 ---- 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; } + HeapWord* hard_end(); HeapWord* start() const { return _start; } HeapWord* end() const { return _end; } HeapWord* top() const { return _top; } HeapWord* pf_top() const { return _pf_top; } size_t desired_size() const { return _desired_size; } size_t used() const { return pointer_delta(top(), start()); } size_t used_bytes() const { return pointer_delta(top(), start(), 1); }
*** 160,169 **** --- 178,192 ---- static void resize_all_tlabs(); void fill(HeapWord* start, HeapWord* top, size_t new_size); void initialize(); + void pick_next_sample(size_t diff = 0); + void set_back_actual_end(); + void handle_sample(Thread* thread, HeapWord* result, size_t size); + bool should_sample() { return _bytes_until_sample == 0; } + static size_t refill_waste_limit_increment() { return TLABWasteIncrement; } // Code generation support static ByteSize start_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _start); } static ByteSize end_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _end ); }
< prev index next >