30 _end(NULL), _hard_end(NULL), |
30 _end(NULL), _hard_end(NULL), |
31 _retained(false), _retained_filler(), |
31 _retained(false), _retained_filler(), |
32 _allocated(0), _wasted(0) |
32 _allocated(0), _wasted(0) |
33 { |
33 { |
34 assert (min_size() > AlignmentReserve, "Inconsistency!"); |
34 assert (min_size() > AlignmentReserve, "Inconsistency!"); |
35 } |
35 // arrayOopDesc::header_size depends on command line initialization. |
36 |
36 FillerHeaderSize = align_object_size(arrayOopDesc::header_size(T_INT)); |
37 const size_t ParGCAllocBuffer::FillerHeaderSize = |
37 AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? FillerHeaderSize : 0; |
38 align_object_size(arrayOopDesc::header_size(T_INT)); |
38 } |
|
39 |
|
40 size_t ParGCAllocBuffer::FillerHeaderSize; |
39 |
41 |
40 // If the minimum object size is greater than MinObjAlignment, we can |
42 // If the minimum object size is greater than MinObjAlignment, we can |
41 // end up with a shard at the end of the buffer that's smaller than |
43 // end up with a shard at the end of the buffer that's smaller than |
42 // the smallest object. We can't allow that because the buffer must |
44 // the smallest object. We can't allow that because the buffer must |
43 // look like it's full of objects when we retire it, so we make |
45 // look like it's full of objects when we retire it, so we make |
44 // sure we have enough space for a filler int array object. |
46 // sure we have enough space for a filler int array object. |
45 const size_t ParGCAllocBuffer::AlignmentReserve = |
47 size_t ParGCAllocBuffer::AlignmentReserve; |
46 oopDesc::header_size() > MinObjAlignment ? FillerHeaderSize : 0; |
|
47 |
48 |
48 void ParGCAllocBuffer::retire(bool end_of_gc, bool retain) { |
49 void ParGCAllocBuffer::retire(bool end_of_gc, bool retain) { |
49 assert(!retain || end_of_gc, "Can only retain at GC end."); |
50 assert(!retain || end_of_gc, "Can only retain at GC end."); |
50 if (_retained) { |
51 if (_retained) { |
51 // If the buffer had been retained shorten the previous filler object. |
52 // If the buffer had been retained shorten the previous filler object. |