comparison src/share/vm/memory/allocation.hpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents d2a62e0f25eb
children fb19af007ffc
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
67 // For embedded objects. 67 // For embedded objects.
68 // - ValueObj 68 // - ValueObj
69 // 69 //
70 // For classes used as name spaces. 70 // For classes used as name spaces.
71 // - AllStatic 71 // - AllStatic
72 //
73 // For classes in Metaspace (class data)
74 // - MetaspaceObj
72 // 75 //
73 // The printable subclasses are used for debugging and define virtual 76 // The printable subclasses are used for debugging and define virtual
74 // member functions for printing. Classes that avoid allocating the 77 // member functions for printing. Classes that avoid allocating the
75 // vtbl entries in the objects should therefore not be the printable 78 // vtbl entries in the objects should therefore not be the printable
76 // subclasses. 79 // subclasses.
209 public: 212 public:
210 void* operator new(size_t size); 213 void* operator new(size_t size);
211 void operator delete(void* p); 214 void operator delete(void* p);
212 }; 215 };
213 216
217
218 // Base class for objects stored in Metaspace.
219 // Calling delete will result in fatal error.
220 //
221 // Do not inherit from something with a vptr because this class does
222 // not introduce one. This class is used to allocate both shared read-only
223 // and shared read-write classes.
224 //
225
226 class ClassLoaderData;
227
228 class MetaspaceObj {
229 public:
230 bool is_metadata() const;
231 bool is_shared() const;
232 void print_address_on(outputStream* st) const; // nonvirtual address printing
233
234 void* operator new(size_t size, ClassLoaderData* loader_data,
235 size_t word_size, bool read_only, Thread* thread);
236 // can't use TRAPS from this header file.
237 void operator delete(void* p) { ShouldNotCallThis(); }
238 };
239
214 // Base class for classes that constitute name spaces. 240 // Base class for classes that constitute name spaces.
215 241
216 class AllStatic { 242 class AllStatic {
217 public: 243 public:
218 AllStatic() { ShouldNotCallThis(); } 244 AllStatic() { ShouldNotCallThis(); }
250 }; 276 };
251 277
252 void chop(); // Chop this chunk 278 void chop(); // Chop this chunk
253 void next_chop(); // Chop next chunk 279 void next_chop(); // Chop next chunk
254 static size_t aligned_overhead_size(void) { return ARENA_ALIGN(sizeof(Chunk)); } 280 static size_t aligned_overhead_size(void) { return ARENA_ALIGN(sizeof(Chunk)); }
281 static size_t aligned_overhead_size(size_t byte_size) { return ARENA_ALIGN(byte_size); }
255 282
256 size_t length() const { return _len; } 283 size_t length() const { return _len; }
257 Chunk* next() const { return _next; } 284 Chunk* next() const { return _next; }
258 void set_next(Chunk* n) { _next = n; } 285 void set_next(Chunk* n) { _next = n; }
259 // Boundaries of data area (possibly unused) 286 // Boundaries of data area (possibly unused)