< prev index next >

src/hotspot/share/memory/metaspace/metachunk.cpp

Print this page
rev 50187 : imported patch metaspace-split
rev 50188 : [mq]: 8176808-split-metaspace-cpp-2


  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 "memory/allocation.hpp"
  27 #include "memory/metaspace/metachunk.hpp"
  28 #include "memory/metaspace/occupancyMap.hpp"
  29 #include "memory/metaspace/virtualSpaceNode.hpp"
  30 #include "utilities/align.hpp"
  31 #include "utilities/copy.hpp"
  32 #include "utilities/debug.hpp"
  33 
  34 namespace metaspace {
  35 namespace internals {
  36 
  37 size_t Metachunk::object_alignment() {
  38   // Must align pointers and sizes to 8,
  39   // so that 64 bit types get correctly aligned.
  40   const size_t alignment = 8;
  41 
  42   // Make sure that the Klass alignment also agree.
  43   STATIC_ASSERT(alignment == (size_t)KlassAlignmentInBytes);
  44 
  45   return alignment;
  46 }
  47 
  48 size_t Metachunk::overhead() {
  49   return align_up(sizeof(Metachunk), object_alignment()) / BytesPerWord;
  50 }
  51 
  52 // Metachunk methods
  53 
  54 Metachunk::Metachunk(ChunkIndex chunktype, bool is_class, size_t word_size,
  55                      VirtualSpaceNode* container)


 153 
 154 #ifdef ASSERT
 155 void do_verify_chunk(Metachunk* chunk) {
 156   guarantee(chunk != NULL, "Sanity");
 157   // Verify chunk itself; then verify that it is consistent with the
 158   // occupany map of its containing node.
 159   chunk->verify();
 160   VirtualSpaceNode* const vsn = chunk->container();
 161   OccupancyMap* const ocmap = vsn->occupancy_map();
 162   ocmap->verify_for_chunk(chunk);
 163 }
 164 #endif
 165 
 166 void do_update_in_use_info_for_chunk(Metachunk* chunk, bool inuse) {
 167   chunk->set_is_tagged_free(!inuse);
 168   OccupancyMap* const ocmap = chunk->container()->occupancy_map();
 169   ocmap->set_region_in_use((MetaWord*)chunk, chunk->word_size(), inuse);
 170 }
 171 
 172 } // namespace metaspace
 173 } // namespace internals


  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 "memory/allocation.hpp"
  27 #include "memory/metaspace/metachunk.hpp"
  28 #include "memory/metaspace/occupancyMap.hpp"
  29 #include "memory/metaspace/virtualSpaceNode.hpp"
  30 #include "utilities/align.hpp"
  31 #include "utilities/copy.hpp"
  32 #include "utilities/debug.hpp"
  33 
  34 namespace metaspace {

  35 
  36 size_t Metachunk::object_alignment() {
  37   // Must align pointers and sizes to 8,
  38   // so that 64 bit types get correctly aligned.
  39   const size_t alignment = 8;
  40 
  41   // Make sure that the Klass alignment also agree.
  42   STATIC_ASSERT(alignment == (size_t)KlassAlignmentInBytes);
  43 
  44   return alignment;
  45 }
  46 
  47 size_t Metachunk::overhead() {
  48   return align_up(sizeof(Metachunk), object_alignment()) / BytesPerWord;
  49 }
  50 
  51 // Metachunk methods
  52 
  53 Metachunk::Metachunk(ChunkIndex chunktype, bool is_class, size_t word_size,
  54                      VirtualSpaceNode* container)


 152 
 153 #ifdef ASSERT
 154 void do_verify_chunk(Metachunk* chunk) {
 155   guarantee(chunk != NULL, "Sanity");
 156   // Verify chunk itself; then verify that it is consistent with the
 157   // occupany map of its containing node.
 158   chunk->verify();
 159   VirtualSpaceNode* const vsn = chunk->container();
 160   OccupancyMap* const ocmap = vsn->occupancy_map();
 161   ocmap->verify_for_chunk(chunk);
 162 }
 163 #endif
 164 
 165 void do_update_in_use_info_for_chunk(Metachunk* chunk, bool inuse) {
 166   chunk->set_is_tagged_free(!inuse);
 167   OccupancyMap* const ocmap = chunk->container()->occupancy_map();
 168   ocmap->set_region_in_use((MetaWord*)chunk, chunk->word_size(), inuse);
 169 }
 170 
 171 } // namespace metaspace
 172 
< prev index next >