< prev index next >

src/hotspot/share/gc/shared/plab.cpp

Print this page
rev 50850 : 8203030: Zero s390 31 bit size_t type conflicts in shared code
Summary: Cast to size_t or change to size_t foe compatibility with other archs.
Reviewed-by: Duke
Contributed-by: chrisphi
   1 /*
   2  * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  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


   1 /*
   2  * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  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


< prev index next >