equal
deleted
inserted
replaced
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 err_msg("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 |
119 "PLAB clipping computation may be incorrect"); |
119 "PLAB clipping computation may be incorrect"); |
120 |
120 |
121 if (_allocated == 0) { |
121 if (_allocated == 0) { |
122 assert(_unused == 0, |
122 assert(_unused == 0, |
123 err_msg("Inconsistency in PLAB stats: " |
123 err_msg("Inconsistency in PLAB stats: " |
124 "_allocated: "SIZE_FORMAT", " |
124 "_allocated: " SIZE_FORMAT ", " |
125 "_wasted: "SIZE_FORMAT", " |
125 "_wasted: " SIZE_FORMAT ", " |
126 "_unused: "SIZE_FORMAT", " |
126 "_unused: " SIZE_FORMAT ", " |
127 "_undo_wasted: "SIZE_FORMAT, |
127 "_undo_wasted: " SIZE_FORMAT, |
128 _allocated, _wasted, _unused, _undo_wasted)); |
128 _allocated, _wasted, _unused, _undo_wasted)); |
129 |
129 |
130 _allocated = 1; |
130 _allocated = 1; |
131 } |
131 } |
132 double wasted_frac = (double)_unused / (double)_allocated; |
132 double wasted_frac = (double)_unused / (double)_allocated; |
142 size_t new_plab_sz = MAX2(min_size(), (size_t)_filter.average()); |
142 size_t new_plab_sz = MAX2(min_size(), (size_t)_filter.average()); |
143 new_plab_sz = MIN2(max_size(), new_plab_sz); |
143 new_plab_sz = MIN2(max_size(), new_plab_sz); |
144 new_plab_sz = align_object_size(new_plab_sz); |
144 new_plab_sz = align_object_size(new_plab_sz); |
145 // Latch the result |
145 // Latch the result |
146 if (PrintPLAB) { |
146 if (PrintPLAB) { |
147 gclog_or_tty->print(" (plab_sz = " SIZE_FORMAT" desired_plab_sz = " SIZE_FORMAT") ", recent_plab_sz, new_plab_sz); |
147 gclog_or_tty->print(" (plab_sz = " SIZE_FORMAT " desired_plab_sz = " SIZE_FORMAT ") ", recent_plab_sz, new_plab_sz); |
148 } |
148 } |
149 _desired_plab_sz = new_plab_sz; |
149 _desired_plab_sz = new_plab_sz; |
150 |
150 |
151 reset(); |
151 reset(); |
152 } |
152 } |