24 #ifndef SHARE_VM_MEMORY_METASPACE_HPP |
24 #ifndef SHARE_VM_MEMORY_METASPACE_HPP |
25 #define SHARE_VM_MEMORY_METASPACE_HPP |
25 #define SHARE_VM_MEMORY_METASPACE_HPP |
26 |
26 |
27 #include "memory/allocation.hpp" |
27 #include "memory/allocation.hpp" |
28 #include "memory/memRegion.hpp" |
28 #include "memory/memRegion.hpp" |
|
29 #include "memory/metaspaceChunkFreeListSummary.hpp" |
29 #include "runtime/virtualspace.hpp" |
30 #include "runtime/virtualspace.hpp" |
30 #include "utilities/exceptions.hpp" |
31 #include "utilities/exceptions.hpp" |
31 |
32 |
32 // Metaspace |
33 // Metaspace |
33 // |
34 // |
147 static VirtualSpaceList* _class_space_list; |
149 static VirtualSpaceList* _class_space_list; |
148 |
150 |
149 static ChunkManager* _chunk_manager_metadata; |
151 static ChunkManager* _chunk_manager_metadata; |
150 static ChunkManager* _chunk_manager_class; |
152 static ChunkManager* _chunk_manager_class; |
151 |
153 |
|
154 static const MetaspaceTracer* _tracer; |
|
155 |
152 public: |
156 public: |
153 static VirtualSpaceList* space_list() { return _space_list; } |
157 static VirtualSpaceList* space_list() { return _space_list; } |
154 static VirtualSpaceList* class_space_list() { return _class_space_list; } |
158 static VirtualSpaceList* class_space_list() { return _class_space_list; } |
155 static VirtualSpaceList* get_space_list(MetadataType mdtype) { |
159 static VirtualSpaceList* get_space_list(MetadataType mdtype) { |
156 assert(mdtype != MetadataTypeCount, "MetadaTypeCount can't be used as mdtype"); |
160 assert(mdtype != MetadataTypeCount, "MetadaTypeCount can't be used as mdtype"); |
161 static ChunkManager* chunk_manager_class() { return _chunk_manager_class; } |
165 static ChunkManager* chunk_manager_class() { return _chunk_manager_class; } |
162 static ChunkManager* get_chunk_manager(MetadataType mdtype) { |
166 static ChunkManager* get_chunk_manager(MetadataType mdtype) { |
163 assert(mdtype != MetadataTypeCount, "MetadaTypeCount can't be used as mdtype"); |
167 assert(mdtype != MetadataTypeCount, "MetadaTypeCount can't be used as mdtype"); |
164 return mdtype == ClassType ? chunk_manager_class() : chunk_manager_metadata(); |
168 return mdtype == ClassType ? chunk_manager_class() : chunk_manager_metadata(); |
165 } |
169 } |
|
170 |
|
171 static const MetaspaceTracer* tracer() { return _tracer; } |
166 |
172 |
167 private: |
173 private: |
168 // This is used by DumpSharedSpaces only, where only _vsm is used. So we will |
174 // This is used by DumpSharedSpaces only, where only _vsm is used. So we will |
169 // maintain a single list for now. |
175 // maintain a single list for now. |
170 void record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size); |
176 void record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size); |
232 // Free empty virtualspaces |
238 // Free empty virtualspaces |
233 static void purge(MetadataType mdtype); |
239 static void purge(MetadataType mdtype); |
234 static void purge(); |
240 static void purge(); |
235 |
241 |
236 static void report_metadata_oome(ClassLoaderData* loader_data, size_t word_size, |
242 static void report_metadata_oome(ClassLoaderData* loader_data, size_t word_size, |
237 MetadataType mdtype, TRAPS); |
243 MetaspaceObj::Type type, MetadataType mdtype, TRAPS); |
|
244 |
|
245 static const char* metadata_type_name(Metaspace::MetadataType mdtype); |
238 |
246 |
239 void print_on(outputStream* st) const; |
247 void print_on(outputStream* st) const; |
240 // Debugging support |
248 // Debugging support |
241 void verify(); |
249 void verify(); |
242 |
250 |
345 |
353 |
346 static size_t min_chunk_size_words(); |
354 static size_t min_chunk_size_words(); |
347 static size_t min_chunk_size_bytes() { |
355 static size_t min_chunk_size_bytes() { |
348 return min_chunk_size_words() * BytesPerWord; |
356 return min_chunk_size_words() * BytesPerWord; |
349 } |
357 } |
|
358 |
|
359 static bool has_chunk_free_list(Metaspace::MetadataType mdtype); |
|
360 static MetaspaceChunkFreeListSummary chunk_free_list_summary(Metaspace::MetadataType mdtype); |
350 |
361 |
351 // Print change in used metadata. |
362 // Print change in used metadata. |
352 static void print_metaspace_change(size_t prev_metadata_used); |
363 static void print_metaspace_change(size_t prev_metadata_used); |
353 static void print_on(outputStream * out); |
364 static void print_on(outputStream * out); |
354 static void print_on(outputStream * out, Metaspace::MetadataType mdtype); |
365 static void print_on(outputStream * out, Metaspace::MetadataType mdtype); |