< prev index next >

src/share/vm/memory/metachunk.cpp

Print this page




  25 #include "precompiled.hpp"
  26 #include "memory/allocation.hpp"
  27 #include "memory/metachunk.hpp"
  28 #include "utilities/copy.hpp"
  29 #include "utilities/debug.hpp"
  30 
  31 class VirtualSpaceNode;
  32 
  33 size_t Metachunk::object_alignment() {
  34   // Must align pointers and sizes to 8,
  35   // so that 64 bit types get correctly aligned.
  36   const size_t alignment = 8;
  37 
  38   // Make sure that the Klass alignment also agree.
  39   STATIC_ASSERT(alignment == (size_t)KlassAlignmentInBytes);
  40 
  41   return alignment;
  42 }
  43 
  44 size_t Metachunk::overhead() {
  45   return align_size_up(sizeof(Metachunk), object_alignment()) / BytesPerWord;
  46 }
  47 
  48 // Metachunk methods
  49 
  50 Metachunk::Metachunk(size_t word_size,
  51                      VirtualSpaceNode* container)
  52     : Metabase<Metachunk>(word_size),
  53     _top(NULL),
  54     _container(container)
  55 {
  56   _top = initial_top();
  57 #ifdef ASSERT
  58   set_is_tagged_free(false);
  59   mangle(uninitMetaWordVal);
  60 #endif
  61 }
  62 
  63 MetaWord* Metachunk::allocate(size_t word_size) {
  64   MetaWord* result = NULL;
  65   // If available, bump the pointer to allocate.




  25 #include "precompiled.hpp"
  26 #include "memory/allocation.hpp"
  27 #include "memory/metachunk.hpp"
  28 #include "utilities/copy.hpp"
  29 #include "utilities/debug.hpp"
  30 
  31 class VirtualSpaceNode;
  32 
  33 size_t Metachunk::object_alignment() {
  34   // Must align pointers and sizes to 8,
  35   // so that 64 bit types get correctly aligned.
  36   const size_t alignment = 8;
  37 
  38   // Make sure that the Klass alignment also agree.
  39   STATIC_ASSERT(alignment == (size_t)KlassAlignmentInBytes);
  40 
  41   return alignment;
  42 }
  43 
  44 size_t Metachunk::overhead() {
  45   return align_up(sizeof(Metachunk), object_alignment()) / BytesPerWord;
  46 }
  47 
  48 // Metachunk methods
  49 
  50 Metachunk::Metachunk(size_t word_size,
  51                      VirtualSpaceNode* container)
  52     : Metabase<Metachunk>(word_size),
  53     _top(NULL),
  54     _container(container)
  55 {
  56   _top = initial_top();
  57 #ifdef ASSERT
  58   set_is_tagged_free(false);
  59   mangle(uninitMetaWordVal);
  60 #endif
  61 }
  62 
  63 MetaWord* Metachunk::allocate(size_t word_size) {
  64   MetaWord* result = NULL;
  65   // If available, bump the pointer to allocate.


< prev index next >