15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/shared/collectedHeap.hpp"
27 #include "gc/shared/plab.inline.hpp"
28 #include "gc/shared/threadLocalAllocBuffer.hpp"
29 #include "logging/log.hpp"
30 #include "oops/arrayOop.hpp"
31 #include "oops/oop.inline.hpp"
32
33 size_t PLAB::min_size() {
34 // Make sure that we return something that is larger than AlignmentReserve
35 return align_object_size(MAX2(MinTLABSize / HeapWordSize, (uintx)oopDesc::header_size())) + AlignmentReserve;
36 }
37
38 size_t PLAB::max_size() {
39 return ThreadLocalAllocBuffer::max_size();
40 }
41
42 PLAB::PLAB(size_t desired_plab_sz_) :
43 _word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL),
44 _end(NULL), _hard_end(NULL), _allocated(0), _wasted(0), _undo_wasted(0)
45 {
46 // ArrayOopDesc::header_size depends on command line initialization.
47 AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? align_object_size(arrayOopDesc::header_size(T_INT)) : 0;
48 assert(min_size() > AlignmentReserve,
49 "Minimum PLAB size " SIZE_FORMAT " must be larger than alignment reserve " SIZE_FORMAT " "
50 "to be able to contain objects", min_size(), AlignmentReserve);
51 }
52
53 // If the minimum object size is greater than MinObjAlignment, we can
54 // end up with a shard at the end of the buffer that's smaller than
55 // the smallest object. We can't allow that because the buffer must
|
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "gc/shared/collectedHeap.hpp"
27 #include "gc/shared/plab.inline.hpp"
28 #include "gc/shared/threadLocalAllocBuffer.hpp"
29 #include "logging/log.hpp"
30 #include "oops/arrayOop.hpp"
31 #include "oops/oop.inline.hpp"
32
33 size_t PLAB::min_size() {
34 // Make sure that we return something that is larger than AlignmentReserve
35 return align_object_size(MAX2(MinTLABSize / HeapWordSize, (size_t)oopDesc::header_size())) + AlignmentReserve;
36 }
37
38 size_t PLAB::max_size() {
39 return ThreadLocalAllocBuffer::max_size();
40 }
41
42 PLAB::PLAB(size_t desired_plab_sz_) :
43 _word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL),
44 _end(NULL), _hard_end(NULL), _allocated(0), _wasted(0), _undo_wasted(0)
45 {
46 // ArrayOopDesc::header_size depends on command line initialization.
47 AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? align_object_size(arrayOopDesc::header_size(T_INT)) : 0;
48 assert(min_size() > AlignmentReserve,
49 "Minimum PLAB size " SIZE_FORMAT " must be larger than alignment reserve " SIZE_FORMAT " "
50 "to be able to contain objects", min_size(), AlignmentReserve);
51 }
52
53 // If the minimum object size is greater than MinObjAlignment, we can
54 // end up with a shard at the end of the buffer that's smaller than
55 // the smallest object. We can't allow that because the buffer must
|