< prev index next >

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

Print this page
rev 54012 : imported patch autouncommit-metachunks


  88   MetaWord* _top;
  89 
  90   // A 32bit sentinel for debugging purposes.
  91   enum { CHUNK_SENTINEL = 0x4d4554EF,  // "MET"
  92          CHUNK_SENTINEL_INVALID = 0xFEEEEEEF
  93   };
  94 
  95   uint32_t _sentinel;
  96 
  97   const ChunkIndex _chunk_type;
  98   const bool _is_class;
  99   // Whether the chunk is free (in freelist) or in use by some class loader.
 100   bool _is_tagged_free;
 101 
 102   ChunkOrigin _origin;
 103   int _use_count;
 104 
 105   MetaWord* initial_top() const { return (MetaWord*)this + overhead(); }
 106   MetaWord* top() const         { return _top; }
 107 


 108  public:
 109   // Metachunks are allocated out of a MetadataVirtualSpace and
 110   // and use some of its space to describe itself (plus alignment
 111   // considerations).  Metadata is allocated in the rest of the chunk.
 112   // This size is the overhead of maintaining the Metachunk within
 113   // the space.
 114 
 115   // Alignment of each allocation in the chunks.
 116   static size_t object_alignment();
 117 
 118   // Size of the Metachunk header, in words, including alignment.
 119   static size_t overhead();
 120 
 121   Metachunk(ChunkIndex chunktype, bool is_class, size_t word_size, VirtualSpaceNode* container);
 122 
 123   MetaWord* allocate(size_t word_size);
 124 
 125   VirtualSpaceNode* container() const { return _container; }
 126 
 127   MetaWord* bottom() const { return (MetaWord*) this; }


 140   void set_is_tagged_free(bool v) { _is_tagged_free = v; }
 141 
 142   bool contains(const void* ptr) { return bottom() <= ptr && ptr < _top; }
 143 
 144   void print_on(outputStream* st) const;
 145 
 146   bool is_valid_sentinel() const        { return _sentinel == CHUNK_SENTINEL; }
 147   void remove_sentinel()                { _sentinel = CHUNK_SENTINEL_INVALID; }
 148 
 149   int get_use_count() const             { return _use_count; }
 150   void inc_use_count()                  { _use_count ++; }
 151 
 152   ChunkOrigin get_origin() const        { return _origin; }
 153   void set_origin(ChunkOrigin orig)     { _origin = orig; }
 154 
 155   ChunkIndex get_chunk_type() const     { return _chunk_type; }
 156   bool is_class() const                 { return _is_class; }
 157 
 158   DEBUG_ONLY(void mangle(juint word_value);)
 159   DEBUG_ONLY(void verify() const;)



 160 
 161 };
 162 
 163 
 164 // Helper function that does a bunch of checks for a chunk.
 165 DEBUG_ONLY(void do_verify_chunk(Metachunk* chunk);)
 166 
 167 // Given a Metachunk, update its in-use information (both in the
 168 // chunk and the occupancy map).
 169 void do_update_in_use_info_for_chunk(Metachunk* chunk, bool inuse);
 170 
 171 } // namespace metaspace
 172 
 173 #endif // SHARE_MEMORY_METASPACE_METACHUNK_HPP


  88   MetaWord* _top;
  89 
  90   // A 32bit sentinel for debugging purposes.
  91   enum { CHUNK_SENTINEL = 0x4d4554EF,  // "MET"
  92          CHUNK_SENTINEL_INVALID = 0xFEEEEEEF
  93   };
  94 
  95   uint32_t _sentinel;
  96 
  97   const ChunkIndex _chunk_type;
  98   const bool _is_class;
  99   // Whether the chunk is free (in freelist) or in use by some class loader.
 100   bool _is_tagged_free;
 101 
 102   ChunkOrigin _origin;
 103   int _use_count;
 104 
 105   MetaWord* initial_top() const { return (MetaWord*)this + overhead(); }
 106   MetaWord* top() const         { return _top; }
 107 
 108   bool calc_uncommit_range(address* start, size_t* len) const;
 109 
 110  public:
 111   // Metachunks are allocated out of a MetadataVirtualSpace and
 112   // and use some of its space to describe itself (plus alignment
 113   // considerations).  Metadata is allocated in the rest of the chunk.
 114   // This size is the overhead of maintaining the Metachunk within
 115   // the space.
 116 
 117   // Alignment of each allocation in the chunks.
 118   static size_t object_alignment();
 119 
 120   // Size of the Metachunk header, in words, including alignment.
 121   static size_t overhead();
 122 
 123   Metachunk(ChunkIndex chunktype, bool is_class, size_t word_size, VirtualSpaceNode* container);
 124 
 125   MetaWord* allocate(size_t word_size);
 126 
 127   VirtualSpaceNode* container() const { return _container; }
 128 
 129   MetaWord* bottom() const { return (MetaWord*) this; }


 142   void set_is_tagged_free(bool v) { _is_tagged_free = v; }
 143 
 144   bool contains(const void* ptr) { return bottom() <= ptr && ptr < _top; }
 145 
 146   void print_on(outputStream* st) const;
 147 
 148   bool is_valid_sentinel() const        { return _sentinel == CHUNK_SENTINEL; }
 149   void remove_sentinel()                { _sentinel = CHUNK_SENTINEL_INVALID; }
 150 
 151   int get_use_count() const             { return _use_count; }
 152   void inc_use_count()                  { _use_count ++; }
 153 
 154   ChunkOrigin get_origin() const        { return _origin; }
 155   void set_origin(ChunkOrigin orig)     { _origin = orig; }
 156 
 157   ChunkIndex get_chunk_type() const     { return _chunk_type; }
 158   bool is_class() const                 { return _is_class; }
 159 
 160   DEBUG_ONLY(void mangle(juint word_value);)
 161   DEBUG_ONLY(void verify() const;)
 162 
 163   bool commit();
 164   bool uncommit();
 165 
 166 };
 167 
 168 
 169 // Helper function that does a bunch of checks for a chunk.
 170 DEBUG_ONLY(void do_verify_chunk(Metachunk* chunk);)
 171 
 172 // Given a Metachunk, update its in-use information (both in the
 173 // chunk and the occupancy map).
 174 void do_update_in_use_info_for_chunk(Metachunk* chunk, bool inuse);
 175 
 176 } // namespace metaspace
 177 
 178 #endif // SHARE_MEMORY_METASPACE_METACHUNK_HPP
< prev index next >