218 virtual G1PLAB* alloc_buffer(InCSetState dest, AllocationContext_t context) = 0;
219
220 // Calculate the survivor space object alignment in bytes. Returns that or 0 if
221 // there are no restrictions on survivor alignment.
222 static uint calc_survivor_alignment_bytes() {
223 assert(SurvivorAlignmentInBytes >= ObjectAlignmentInBytes, "sanity");
224 if (SurvivorAlignmentInBytes == ObjectAlignmentInBytes) {
225 // No need to align objects in the survivors differently, return 0
226 // which means "survivor alignment is not used".
227 return 0;
228 } else {
229 assert(SurvivorAlignmentInBytes > 0, "sanity");
230 return SurvivorAlignmentInBytes;
231 }
232 }
233
234 HeapWord* allocate_new_plab(InCSetState dest,
235 size_t word_sz,
236 AllocationContext_t context);
237
238 public:
239 G1PLABAllocator(G1Allocator* allocator);
240 virtual ~G1PLABAllocator() { }
241
242 static G1PLABAllocator* create_allocator(G1Allocator* allocator);
243
244 virtual void waste(size_t& wasted, size_t& undo_wasted) = 0;
245
246 // Allocate word_sz words in dest, either directly into the regions or by
247 // allocating a new PLAB. Returns the address of the allocated memory, NULL if
248 // not successful. Plab_refill_failed indicates whether an attempt to refill the
249 // PLAB failed or not.
250 HeapWord* allocate_direct_or_new_plab(InCSetState dest,
251 size_t word_sz,
252 AllocationContext_t context,
253 bool* plab_refill_failed);
254
255 // Allocate word_sz words in the PLAB of dest. Returns the address of the
256 // allocated memory, NULL if not successful.
257 inline HeapWord* plab_allocate(InCSetState dest,
|
218 virtual G1PLAB* alloc_buffer(InCSetState dest, AllocationContext_t context) = 0;
219
220 // Calculate the survivor space object alignment in bytes. Returns that or 0 if
221 // there are no restrictions on survivor alignment.
222 static uint calc_survivor_alignment_bytes() {
223 assert(SurvivorAlignmentInBytes >= ObjectAlignmentInBytes, "sanity");
224 if (SurvivorAlignmentInBytes == ObjectAlignmentInBytes) {
225 // No need to align objects in the survivors differently, return 0
226 // which means "survivor alignment is not used".
227 return 0;
228 } else {
229 assert(SurvivorAlignmentInBytes > 0, "sanity");
230 return SurvivorAlignmentInBytes;
231 }
232 }
233
234 HeapWord* allocate_new_plab(InCSetState dest,
235 size_t word_sz,
236 AllocationContext_t context);
237
238 bool may_throw_away_buffer(size_t const allocation_word_sz, size_t const buffer_size) const;
239 public:
240 G1PLABAllocator(G1Allocator* allocator);
241 virtual ~G1PLABAllocator() { }
242
243 static G1PLABAllocator* create_allocator(G1Allocator* allocator);
244
245 virtual void waste(size_t& wasted, size_t& undo_wasted) = 0;
246
247 // Allocate word_sz words in dest, either directly into the regions or by
248 // allocating a new PLAB. Returns the address of the allocated memory, NULL if
249 // not successful. Plab_refill_failed indicates whether an attempt to refill the
250 // PLAB failed or not.
251 HeapWord* allocate_direct_or_new_plab(InCSetState dest,
252 size_t word_sz,
253 AllocationContext_t context,
254 bool* plab_refill_failed);
255
256 // Allocate word_sz words in the PLAB of dest. Returns the address of the
257 // allocated memory, NULL if not successful.
258 inline HeapWord* plab_allocate(InCSetState dest,
|