< prev index next >

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

Print this page
rev 8362 : [mq]: hotspot


   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_implementation/shared/plab.hpp"
  27 #include "gc_interface/collectedHeap.hpp"
  28 #include "memory/threadLocalAllocBuffer.hpp"
  29 #include "oops/arrayOop.hpp"
  30 #include "oops/oop.inline.hpp"
  31 
  32 size_t PLAB::min_size() {
  33   // Make sure that we return something that is larger than AlignmentReserve
  34   return align_object_size(MAX2(MinTLABSize / HeapWordSize, (uintx)oopDesc::header_size())) + AlignmentReserve;
  35 }
  36 
  37 size_t PLAB::max_size() {
  38   return ThreadLocalAllocBuffer::max_size();
  39 }
  40 
  41 PLAB::PLAB(size_t desired_plab_sz_) :
  42   _word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL),
  43   _end(NULL), _hard_end(NULL), _allocated(0), _wasted(0), _undo_wasted(0)
  44 {
  45   // ArrayOopDesc::header_size depends on command line initialization.
  46   AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? align_object_size(arrayOopDesc::header_size(T_INT)) : 0;
  47   assert(min_size() > AlignmentReserve,
  48          err_msg("Minimum PLAB size " SIZE_FORMAT" must be larger than alignment reserve " SIZE_FORMAT" "




   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.hpp"
  28 #include "gc/shared/threadLocalAllocBuffer.hpp"
  29 #include "oops/arrayOop.hpp"
  30 #include "oops/oop.inline.hpp"
  31 
  32 size_t PLAB::min_size() {
  33   // Make sure that we return something that is larger than AlignmentReserve
  34   return align_object_size(MAX2(MinTLABSize / HeapWordSize, (uintx)oopDesc::header_size())) + AlignmentReserve;
  35 }
  36 
  37 size_t PLAB::max_size() {
  38   return ThreadLocalAllocBuffer::max_size();
  39 }
  40 
  41 PLAB::PLAB(size_t desired_plab_sz_) :
  42   _word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL),
  43   _end(NULL), _hard_end(NULL), _allocated(0), _wasted(0), _undo_wasted(0)
  44 {
  45   // ArrayOopDesc::header_size depends on command line initialization.
  46   AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? align_object_size(arrayOopDesc::header_size(T_INT)) : 0;
  47   assert(min_size() > AlignmentReserve,
  48          err_msg("Minimum PLAB size " SIZE_FORMAT" must be larger than alignment reserve " SIZE_FORMAT" "


< prev index next >