hotspot/src/share/vm/memory/allocation.hpp
changeset 13728 882756847a04
parent 13195 be27e1b6a4b9
child 13975 2f7431485cfa
equal deleted inserted replaced
13727:caf5eb7dd4a7 13728:882756847a04
    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)