154 static const MetaspaceTracer* _tracer;
155
156 public:
157 static VirtualSpaceList* space_list() { return _space_list; }
158 static VirtualSpaceList* class_space_list() { return _class_space_list; }
159 static VirtualSpaceList* get_space_list(MetadataType mdtype) {
160 assert(mdtype != MetadataTypeCount, "MetadaTypeCount can't be used as mdtype");
161 return mdtype == ClassType ? class_space_list() : space_list();
162 }
163
164 static ChunkManager* chunk_manager_metadata() { return _chunk_manager_metadata; }
165 static ChunkManager* chunk_manager_class() { return _chunk_manager_class; }
166 static ChunkManager* get_chunk_manager(MetadataType mdtype) {
167 assert(mdtype != MetadataTypeCount, "MetadaTypeCount can't be used as mdtype");
168 return mdtype == ClassType ? chunk_manager_class() : chunk_manager_metadata();
169 }
170
171 static const MetaspaceTracer* tracer() { return _tracer; }
172
173 private:
174 // This is used by DumpSharedSpaces only, where only _vsm is used. So we will
175 // maintain a single list for now.
176 void record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size);
177
178 #ifdef _LP64
179 static void set_narrow_klass_base_and_shift(address metaspace_base, address cds_base);
180
181 // Returns true if can use CDS with metaspace allocated as specified address.
182 static bool can_use_cds_with_metaspace_addr(char* metaspace_base, address cds_base);
183
184 static void allocate_metaspace_compressed_klass_ptrs(char* requested_addr, address cds_base);
185
186 static void initialize_class_space(ReservedSpace rs);
187 #endif
188
189 class AllocRecord : public CHeapObj<mtClass> {
190 public:
191 AllocRecord(address ptr, MetaspaceObj::Type type, int byte_size)
192 : _next(NULL), _ptr(ptr), _type(type), _byte_size(byte_size) {}
193 AllocRecord *_next;
194 address _ptr;
195 MetaspaceObj::Type _type;
196 int _byte_size;
|
154 static const MetaspaceTracer* _tracer;
155
156 public:
157 static VirtualSpaceList* space_list() { return _space_list; }
158 static VirtualSpaceList* class_space_list() { return _class_space_list; }
159 static VirtualSpaceList* get_space_list(MetadataType mdtype) {
160 assert(mdtype != MetadataTypeCount, "MetadaTypeCount can't be used as mdtype");
161 return mdtype == ClassType ? class_space_list() : space_list();
162 }
163
164 static ChunkManager* chunk_manager_metadata() { return _chunk_manager_metadata; }
165 static ChunkManager* chunk_manager_class() { return _chunk_manager_class; }
166 static ChunkManager* get_chunk_manager(MetadataType mdtype) {
167 assert(mdtype != MetadataTypeCount, "MetadaTypeCount can't be used as mdtype");
168 return mdtype == ClassType ? chunk_manager_class() : chunk_manager_metadata();
169 }
170
171 static const MetaspaceTracer* tracer() { return _tracer; }
172
173 private:
174 // These 2 methods are used by DumpSharedSpaces only, where only _vsm is used. So we will
175 // maintain a single list for now.
176 void record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size);
177 void record_deallocation(void* ptr, size_t word_size);
178
179 #ifdef _LP64
180 static void set_narrow_klass_base_and_shift(address metaspace_base, address cds_base);
181
182 // Returns true if can use CDS with metaspace allocated as specified address.
183 static bool can_use_cds_with_metaspace_addr(char* metaspace_base, address cds_base);
184
185 static void allocate_metaspace_compressed_klass_ptrs(char* requested_addr, address cds_base);
186
187 static void initialize_class_space(ReservedSpace rs);
188 #endif
189
190 class AllocRecord : public CHeapObj<mtClass> {
191 public:
192 AllocRecord(address ptr, MetaspaceObj::Type type, int byte_size)
193 : _next(NULL), _ptr(ptr), _type(type), _byte_size(byte_size) {}
194 AllocRecord *_next;
195 address _ptr;
196 MetaspaceObj::Type _type;
197 int _byte_size;
|