43 _end(NULL), _hard_end(NULL), _allocated(0), _wasted(0), _undo_wasted(0) |
43 _end(NULL), _hard_end(NULL), _allocated(0), _wasted(0), _undo_wasted(0) |
44 { |
44 { |
45 // ArrayOopDesc::header_size depends on command line initialization. |
45 // ArrayOopDesc::header_size depends on command line initialization. |
46 AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? align_object_size(arrayOopDesc::header_size(T_INT)) : 0; |
46 AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? align_object_size(arrayOopDesc::header_size(T_INT)) : 0; |
47 assert(min_size() > AlignmentReserve, |
47 assert(min_size() > AlignmentReserve, |
48 err_msg("Minimum PLAB size " SIZE_FORMAT " must be larger than alignment reserve " SIZE_FORMAT " " |
48 "Minimum PLAB size " SIZE_FORMAT " must be larger than alignment reserve " SIZE_FORMAT " " |
49 "to be able to contain objects", min_size(), AlignmentReserve)); |
49 "to be able to contain objects", min_size(), AlignmentReserve); |
50 } |
50 } |
51 |
51 |
52 // If the minimum object size is greater than MinObjAlignment, we can |
52 // If the minimum object size is greater than MinObjAlignment, we can |
53 // end up with a shard at the end of the buffer that's smaller than |
53 // end up with a shard at the end of the buffer that's smaller than |
54 // the smallest object. We can't allow that because the buffer must |
54 // the smallest object. We can't allow that because the buffer must |
123 assert(is_object_aligned(max_size()) && min_size() <= max_size(), |
123 assert(is_object_aligned(max_size()) && min_size() <= max_size(), |
124 "PLAB clipping computation may be incorrect"); |
124 "PLAB clipping computation may be incorrect"); |
125 |
125 |
126 if (_allocated == 0) { |
126 if (_allocated == 0) { |
127 assert(_unused == 0, |
127 assert(_unused == 0, |
128 err_msg("Inconsistency in PLAB stats: " |
128 "Inconsistency in PLAB stats: " |
129 "_allocated: " SIZE_FORMAT ", " |
129 "_allocated: " SIZE_FORMAT ", " |
130 "_wasted: " SIZE_FORMAT ", " |
130 "_wasted: " SIZE_FORMAT ", " |
131 "_unused: " SIZE_FORMAT ", " |
131 "_unused: " SIZE_FORMAT ", " |
132 "_undo_wasted: " SIZE_FORMAT, |
132 "_undo_wasted: " SIZE_FORMAT, |
133 _allocated, _wasted, _unused, _undo_wasted)); |
133 _allocated, _wasted, _unused, _undo_wasted); |
134 |
134 |
135 _allocated = 1; |
135 _allocated = 1; |
136 } |
136 } |
137 double wasted_frac = (double)_unused / (double)_allocated; |
137 double wasted_frac = (double)_unused / (double)_allocated; |
138 size_t target_refills = (size_t)((wasted_frac * TargetSurvivorRatio) / TargetPLABWastePct); |
138 size_t target_refills = (size_t)((wasted_frac * TargetSurvivorRatio) / TargetPLABWastePct); |