comparison src/share/vm/memory/metaspace.hpp @ 12303:b960c9df4f11

8025096: Move the ChunkManager instances out of the VirtualSpaceLists Reviewed-by: coleenp, mgerdin, jmasa
author stefank
date Sat, 21 Sep 2013 10:09:42 +0200
parents c4c768305a8f
children bc918fd1e584
comparison
equal deleted inserted replaced
12302:9361de86a50f 12303:b960c9df4f11
54 // | | 54 // | |
55 // | | 55 // | |
56 // +-------------------+ 56 // +-------------------+
57 // 57 //
58 58
59 class ChunkManager;
59 class ClassLoaderData; 60 class ClassLoaderData;
60 class Metablock; 61 class Metablock;
62 class Metachunk;
61 class MetaWord; 63 class MetaWord;
62 class Mutex; 64 class Mutex;
63 class outputStream; 65 class outputStream;
64 class SpaceManager; 66 class SpaceManager;
67 class VirtualSpaceList;
65 68
66 // Metaspaces each have a SpaceManager and allocations 69 // Metaspaces each have a SpaceManager and allocations
67 // are done by the SpaceManager. Allocations are done 70 // are done by the SpaceManager. Allocations are done
68 // out of the current Metachunk. When the current Metachunk 71 // out of the current Metachunk. When the current Metachunk
69 // is exhausted, the SpaceManager gets a new one from 72 // is exhausted, the SpaceManager gets a new one from
73 // 76 //
74 // Currently the space manager maintains the list of 77 // Currently the space manager maintains the list of
75 // virtual spaces and the list of chunks in use. Its 78 // virtual spaces and the list of chunks in use. Its
76 // allocate() method returns a block for use as a 79 // allocate() method returns a block for use as a
77 // quantum of metadata. 80 // quantum of metadata.
78
79 class VirtualSpaceList;
80 81
81 class Metaspace : public CHeapObj<mtClass> { 82 class Metaspace : public CHeapObj<mtClass> {
82 friend class VMStructs; 83 friend class VMStructs;
83 friend class SpaceManager; 84 friend class SpaceManager;
84 friend class VM_CollectForMetadataAllocation; 85 friend class VM_CollectForMetadataAllocation;
100 }; 101 };
101 102
102 private: 103 private:
103 void initialize(Mutex* lock, MetaspaceType type); 104 void initialize(Mutex* lock, MetaspaceType type);
104 105
106 Metachunk* get_initialization_chunk(MetadataType mdtype,
107 size_t chunk_word_size,
108 size_t chunk_bunch);
109
105 // Align up the word size to the allocation word size 110 // Align up the word size to the allocation word size
106 static size_t align_word_size_up(size_t); 111 static size_t align_word_size_up(size_t);
107 112
108 // Aligned size of the metaspace. 113 // Aligned size of the metaspace.
109 static size_t _class_metaspace_size; 114 static size_t _class_metaspace_size;
132 137
133 // Virtual Space lists for both classes and other metadata 138 // Virtual Space lists for both classes and other metadata
134 static VirtualSpaceList* _space_list; 139 static VirtualSpaceList* _space_list;
135 static VirtualSpaceList* _class_space_list; 140 static VirtualSpaceList* _class_space_list;
136 141
142 static ChunkManager* _chunk_manager_metadata;
143 static ChunkManager* _chunk_manager_class;
144
145 public:
137 static VirtualSpaceList* space_list() { return _space_list; } 146 static VirtualSpaceList* space_list() { return _space_list; }
138 static VirtualSpaceList* class_space_list() { return _class_space_list; } 147 static VirtualSpaceList* class_space_list() { return _class_space_list; }
139 static VirtualSpaceList* get_space_list(MetadataType mdtype) { 148 static VirtualSpaceList* get_space_list(MetadataType mdtype) {
140 assert(mdtype != MetadataTypeCount, "MetadaTypeCount can't be used as mdtype"); 149 assert(mdtype != MetadataTypeCount, "MetadaTypeCount can't be used as mdtype");
141 return mdtype == ClassType ? class_space_list() : space_list(); 150 return mdtype == ClassType ? class_space_list() : space_list();
142 } 151 }
143 152
153 static ChunkManager* chunk_manager_metadata() { return _chunk_manager_metadata; }
154 static ChunkManager* chunk_manager_class() { return _chunk_manager_class; }
155 static ChunkManager* get_chunk_manager(MetadataType mdtype) {
156 assert(mdtype != MetadataTypeCount, "MetadaTypeCount can't be used as mdtype");
157 return mdtype == ClassType ? chunk_manager_class() : chunk_manager_metadata();
158 }
159
160 private:
144 // This is used by DumpSharedSpaces only, where only _vsm is used. So we will 161 // This is used by DumpSharedSpaces only, where only _vsm is used. So we will
145 // maintain a single list for now. 162 // maintain a single list for now.
146 void record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size); 163 void record_allocation(void* ptr, MetaspaceObj::Type type, size_t word_size);
147 164
148 #ifdef _LP64 165 #ifdef _LP64
197 214
198 static bool contains(const void *ptr); 215 static bool contains(const void *ptr);
199 void dump(outputStream* const out) const; 216 void dump(outputStream* const out) const;
200 217
201 // Free empty virtualspaces 218 // Free empty virtualspaces
219 static void purge(MetadataType mdtype);
202 static void purge(); 220 static void purge();
203 221
204 void print_on(outputStream* st) const; 222 void print_on(outputStream* st) const;
205 // Debugging support 223 // Debugging support
206 void verify(); 224 void verify();