< prev index next >

src/share/vm/gc/g1/g1PageBasedVirtualSpace.cpp

Print this page
rev 13101 : imported patch 8176571-fine-bitmaps-allocated-as-mtgc


  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/g1/g1PageBasedVirtualSpace.hpp"
  27 #include "gc/shared/workgroup.hpp"
  28 #include "oops/markOop.hpp"
  29 #include "oops/oop.inline.hpp"
  30 #include "runtime/atomic.hpp"
  31 #include "runtime/os.inline.hpp"
  32 #include "services/memTracker.hpp"
  33 #include "utilities/bitMap.inline.hpp"
  34 
  35 G1PageBasedVirtualSpace::G1PageBasedVirtualSpace(ReservedSpace rs, size_t used_size, size_t page_size) :
  36   _low_boundary(NULL), _high_boundary(NULL), _committed(), _page_size(0), _special(false),
  37   _dirty(), _executable(false) {
  38   initialize_with_page_size(rs, used_size, page_size);
  39 }
  40 
  41 void G1PageBasedVirtualSpace::initialize_with_page_size(ReservedSpace rs, size_t used_size, size_t page_size) {
  42   guarantee(rs.is_reserved(), "Given reserved space must have been reserved already.");
  43 
  44   vmassert(_low_boundary == NULL, "VirtualSpace already initialized");
  45   vmassert(page_size > 0, "Page size must be non-zero.");
  46 
  47   guarantee(is_ptr_aligned(rs.base(), page_size),
  48             "Reserved space base " PTR_FORMAT " is not aligned to requested page size " SIZE_FORMAT, p2i(rs.base()), page_size);
  49   guarantee(is_size_aligned(used_size, os::vm_page_size()),
  50             "Given used reserved space size needs to be OS page size aligned (%d bytes) but is " SIZE_FORMAT, os::vm_page_size(), used_size);
  51   guarantee(used_size <= rs.size(),
  52             "Used size of reserved space " SIZE_FORMAT " bytes is smaller than reservation at " SIZE_FORMAT " bytes", used_size, rs.size());
  53   guarantee(is_size_aligned(rs.size(), page_size),
  54             "Expected that the virtual space is size aligned, but " SIZE_FORMAT " is not aligned to page size " SIZE_FORMAT, rs.size(), page_size);
  55 
  56   _low_boundary  = rs.base();
  57   _high_boundary = _low_boundary + used_size;




  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/g1/g1PageBasedVirtualSpace.hpp"
  27 #include "gc/shared/workgroup.hpp"
  28 #include "oops/markOop.hpp"
  29 #include "oops/oop.inline.hpp"
  30 #include "runtime/atomic.hpp"
  31 #include "runtime/os.inline.hpp"
  32 #include "services/memTracker.hpp"
  33 #include "utilities/bitMap.inline.hpp"
  34 
  35 G1PageBasedVirtualSpace::G1PageBasedVirtualSpace(ReservedSpace rs, size_t used_size, size_t page_size) :
  36   _low_boundary(NULL), _high_boundary(NULL), _committed(mtGC), _page_size(0), _special(false),
  37   _dirty(mtGC), _executable(false) {
  38   initialize_with_page_size(rs, used_size, page_size);
  39 }
  40 
  41 void G1PageBasedVirtualSpace::initialize_with_page_size(ReservedSpace rs, size_t used_size, size_t page_size) {
  42   guarantee(rs.is_reserved(), "Given reserved space must have been reserved already.");
  43 
  44   vmassert(_low_boundary == NULL, "VirtualSpace already initialized");
  45   vmassert(page_size > 0, "Page size must be non-zero.");
  46 
  47   guarantee(is_ptr_aligned(rs.base(), page_size),
  48             "Reserved space base " PTR_FORMAT " is not aligned to requested page size " SIZE_FORMAT, p2i(rs.base()), page_size);
  49   guarantee(is_size_aligned(used_size, os::vm_page_size()),
  50             "Given used reserved space size needs to be OS page size aligned (%d bytes) but is " SIZE_FORMAT, os::vm_page_size(), used_size);
  51   guarantee(used_size <= rs.size(),
  52             "Used size of reserved space " SIZE_FORMAT " bytes is smaller than reservation at " SIZE_FORMAT " bytes", used_size, rs.size());
  53   guarantee(is_size_aligned(rs.size(), page_size),
  54             "Expected that the virtual space is size aligned, but " SIZE_FORMAT " is not aligned to page size " SIZE_FORMAT, rs.size(), page_size);
  55 
  56   _low_boundary  = rs.base();
  57   _high_boundary = _low_boundary + used_size;


< prev index next >