src/share/vm/memory/heap.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/memory

src/share/vm/memory/heap.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2012, 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  *


 107 
 108   const size_t rs_align = page_size == (size_t) os::vm_page_size() ? 0 :
 109     MAX2(page_size, granularity);
 110   ReservedCodeSpace rs(r_size, rs_align, rs_align > 0);
 111   os::trace_page_sizes("code heap", committed_size, reserved_size, page_size,
 112                        rs.base(), rs.size());
 113   if (!_memory.initialize(rs, c_size)) {
 114     return false;
 115   }
 116 
 117   on_code_mapping(_memory.low(), _memory.committed_size());
 118   _number_of_committed_segments = size_to_segments(_memory.committed_size());
 119   _number_of_reserved_segments  = size_to_segments(_memory.reserved_size());
 120   assert(_number_of_reserved_segments >= _number_of_committed_segments, "just checking");
 121 
 122   // reserve space for _segmap
 123   if (!_segmap.initialize(align_to_page_size(_number_of_reserved_segments), align_to_page_size(_number_of_committed_segments))) {
 124     return false;
 125   }
 126 
 127   MemTracker::record_virtual_memory_type((address)_segmap.low_boundary(), mtCode);

 128 
 129   assert(_segmap.committed_size() >= (size_t) _number_of_committed_segments, "could not commit  enough space for segment map");
 130   assert(_segmap.reserved_size()  >= (size_t) _number_of_reserved_segments , "could not reserve enough space for segment map");
 131   assert(_segmap.reserved_size()  >= _segmap.committed_size()     , "just checking");
 132 
 133   // initialize remaining instance variables
 134   clear();
 135   return true;
 136 }
 137 
 138 
 139 void CodeHeap::release() {
 140   Unimplemented();
 141 }
 142 
 143 
 144 bool CodeHeap::expand_by(size_t size) {
 145   // expand _memory space
 146   size_t dm = align_to_page_size(_memory.committed_size() + size) - _memory.committed_size();
 147   if (dm > 0) {


   1 /*
   2  * Copyright (c) 1997, 2013, 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  *


 107 
 108   const size_t rs_align = page_size == (size_t) os::vm_page_size() ? 0 :
 109     MAX2(page_size, granularity);
 110   ReservedCodeSpace rs(r_size, rs_align, rs_align > 0);
 111   os::trace_page_sizes("code heap", committed_size, reserved_size, page_size,
 112                        rs.base(), rs.size());
 113   if (!_memory.initialize(rs, c_size)) {
 114     return false;
 115   }
 116 
 117   on_code_mapping(_memory.low(), _memory.committed_size());
 118   _number_of_committed_segments = size_to_segments(_memory.committed_size());
 119   _number_of_reserved_segments  = size_to_segments(_memory.reserved_size());
 120   assert(_number_of_reserved_segments >= _number_of_committed_segments, "just checking");
 121 
 122   // reserve space for _segmap
 123   if (!_segmap.initialize(align_to_page_size(_number_of_reserved_segments), align_to_page_size(_number_of_committed_segments))) {
 124     return false;
 125   }
 126 
 127   NMTTrackOp op(NMTTrackOp::TypeOp);
 128   op.execute_op((address)_segmap.low_boundary(), 0, mtCode);
 129 
 130   assert(_segmap.committed_size() >= (size_t) _number_of_committed_segments, "could not commit  enough space for segment map");
 131   assert(_segmap.reserved_size()  >= (size_t) _number_of_reserved_segments , "could not reserve enough space for segment map");
 132   assert(_segmap.reserved_size()  >= _segmap.committed_size()     , "just checking");
 133 
 134   // initialize remaining instance variables
 135   clear();
 136   return true;
 137 }
 138 
 139 
 140 void CodeHeap::release() {
 141   Unimplemented();
 142 }
 143 
 144 
 145 bool CodeHeap::expand_by(size_t size) {
 146   // expand _memory space
 147   size_t dm = align_to_page_size(_memory.committed_size() + size) - _memory.committed_size();
 148   if (dm > 0) {


src/share/vm/memory/heap.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File