< prev index next >
src/share/vm/gc_implementation/g1/g1Allocator.hpp
Print this page
*** 145,154 ****
--- 145,180 ----
}
return result;
}
};
+ class G1PLABWasteStat VALUE_OBJ_CLASS_SPEC {
+ private:
+ size_t _wasted;
+ size_t _undo_wasted;
+ public:
+
+ G1PLABWasteStat() : _wasted(0), _undo_wasted(0) {
+ }
+
+ void add_wasted(size_t word_sz) {
+ _wasted += word_sz;
+ }
+
+ void add_undo_wasted(size_t word_sz) {
+ _undo_wasted += word_sz;
+ }
+
+ size_t wasted() {
+ return _wasted;
+ }
+
+ size_t undo_wasted() {
+ return _undo_wasted;
+ }
+ };
+
class G1ParGCAllocBuffer: public ParGCAllocBuffer {
private:
bool _retired;
public:
*** 181,196 ****
// != 0 : align survivors to that alignment
// These values were chosen to favor the non-alignment case since some
// architectures have a special compare against zero instructions.
const uint _survivor_alignment_bytes;
- size_t _alloc_buffer_waste;
- size_t _undo_waste;
-
- void add_to_alloc_buffer_waste(size_t waste) { _alloc_buffer_waste += waste; }
- void add_to_undo_waste(size_t waste) { _undo_waste += waste; }
-
virtual void retire_alloc_buffers() = 0;
virtual G1ParGCAllocBuffer* alloc_buffer(InCSetState dest, AllocationContext_t context) = 0;
// Calculate the survivor space object alignment in bytes. Returns that or 0 if
// there are no restrictions on survivor alignment.
--- 207,216 ----
*** 206,223 ****
}
}
public:
G1ParGCAllocator(G1CollectedHeap* g1h) :
! _g1h(g1h), _survivor_alignment_bytes(calc_survivor_alignment_bytes()),
! _alloc_buffer_waste(0), _undo_waste(0) {
}
static G1ParGCAllocator* create_allocator(G1CollectedHeap* g1h);
! size_t alloc_buffer_waste() { return _alloc_buffer_waste; }
! size_t undo_waste() {return _undo_waste; }
// Allocate word_sz words in dest, either directly into the regions or by
// allocating a new PLAB. Returns the address of the allocated memory, NULL if
// not successful.
HeapWord* allocate_direct_or_new_plab(InCSetState dest,
--- 226,241 ----
}
}
public:
G1ParGCAllocator(G1CollectedHeap* g1h) :
! _g1h(g1h), _survivor_alignment_bytes(calc_survivor_alignment_bytes()) {
}
static G1ParGCAllocator* create_allocator(G1CollectedHeap* g1h);
! virtual G1PLABWasteStat wasted() = 0;
// Allocate word_sz words in dest, either directly into the regions or by
// allocating a new PLAB. Returns the address of the allocated memory, NULL if
// not successful.
HeapWord* allocate_direct_or_new_plab(InCSetState dest,
*** 245,262 ****
}
return allocate_direct_or_new_plab(dest, word_sz, context);
}
void undo_allocation(InCSetState dest, HeapWord* obj, size_t word_sz, AllocationContext_t context) {
- if (alloc_buffer(dest, context)->contains(obj)) {
- assert(alloc_buffer(dest, context)->contains(obj + word_sz - 1),
- "should contain whole object");
alloc_buffer(dest, context)->undo_allocation(obj, word_sz);
- } else {
- CollectedHeap::fill_with_object(obj, word_sz);
- add_to_undo_waste(word_sz);
- }
}
};
class G1DefaultParGCAllocator : public G1ParGCAllocator {
G1ParGCAllocBuffer _surviving_alloc_buffer;
--- 263,273 ----
*** 272,280 ****
assert(_alloc_buffers[dest.value()] != NULL,
err_msg("Allocation buffer is NULL: " CSETSTATE_FORMAT, dest.value()));
return _alloc_buffers[dest.value()];
}
! virtual void retire_alloc_buffers() ;
};
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCATOR_HPP
--- 283,293 ----
assert(_alloc_buffers[dest.value()] != NULL,
err_msg("Allocation buffer is NULL: " CSETSTATE_FORMAT, dest.value()));
return _alloc_buffers[dest.value()];
}
! virtual void retire_alloc_buffers();
!
! virtual G1PLABWasteStat wasted();
};
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCATOR_HPP
< prev index next >