src/share/vm/gc_implementation/parNew/parGCAllocBuffer.cpp

Print this page


   1 /*
   2  * Copyright (c) 2001, 2009, 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 "incls/_precompiled.incl"
  26 # include "incls/_parGCAllocBuffer.cpp.incl"



  27 
  28 ParGCAllocBuffer::ParGCAllocBuffer(size_t desired_plab_sz_) :
  29   _word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL),
  30   _end(NULL), _hard_end(NULL),
  31   _retained(false), _retained_filler(),
  32   _allocated(0), _wasted(0)
  33 {
  34   assert (min_size() > AlignmentReserve, "Inconsistency!");
  35   // arrayOopDesc::header_size depends on command line initialization.
  36   FillerHeaderSize = align_object_size(arrayOopDesc::header_size(T_INT));
  37   AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? FillerHeaderSize : 0;
  38 }
  39 
  40 size_t ParGCAllocBuffer::FillerHeaderSize;
  41 
  42 // If the minimum object size is greater than MinObjAlignment, we can
  43 // end up with a shard at the end of the buffer that's smaller than
  44 // the smallest object.  We can't allow that because the buffer must
  45 // look like it's full of objects when we retire it, so we make
  46 // sure we have enough space for a filler int array object.


   1 /*
   2  * Copyright (c) 2001, 2010, 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_implementation/parNew/parGCAllocBuffer.hpp"
  27 #include "memory/sharedHeap.hpp"
  28 #include "oops/arrayOop.hpp"
  29 #include "oops/oop.inline.hpp"
  30 
  31 ParGCAllocBuffer::ParGCAllocBuffer(size_t desired_plab_sz_) :
  32   _word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL),
  33   _end(NULL), _hard_end(NULL),
  34   _retained(false), _retained_filler(),
  35   _allocated(0), _wasted(0)
  36 {
  37   assert (min_size() > AlignmentReserve, "Inconsistency!");
  38   // arrayOopDesc::header_size depends on command line initialization.
  39   FillerHeaderSize = align_object_size(arrayOopDesc::header_size(T_INT));
  40   AlignmentReserve = oopDesc::header_size() > MinObjAlignment ? FillerHeaderSize : 0;
  41 }
  42 
  43 size_t ParGCAllocBuffer::FillerHeaderSize;
  44 
  45 // If the minimum object size is greater than MinObjAlignment, we can
  46 // end up with a shard at the end of the buffer that's smaller than
  47 // the smallest object.  We can't allow that because the buffer must
  48 // look like it's full of objects when we retire it, so we make
  49 // sure we have enough space for a filler int array object.