< prev index next >
src/hotspot/share/memory/allocation.hpp
Print this page
*** 35,59 ****
public:
enum AllocFailEnum { EXIT_OOM, RETURN_NULL };
};
typedef AllocFailStrategy::AllocFailEnum AllocFailType;
! // All classes in the virtual machine must be subclassed
! // by one of the following allocation classes:
//
// For objects allocated in the resource area (see resourceArea.hpp).
// - ResourceObj
//
! // For objects allocated in the C-heap (managed by: free & malloc).
// - CHeapObj
//
// For objects allocated on the stack.
// - StackObj
//
- // For embedded objects.
- // - ValueObj
- //
// For classes used as name spaces.
// - AllStatic
//
// For classes in Metaspace (class data)
// - MetaspaceObj
--- 35,60 ----
public:
enum AllocFailEnum { EXIT_OOM, RETURN_NULL };
};
typedef AllocFailStrategy::AllocFailEnum AllocFailType;
! // For convenience and documentation of intended use, classes in the virtual machine
! // may be subclassed by one of the following allocation classes. These provide default
! // operator new and delete functions. If not subclassed with the following,
! // the global operator new may not be used and will give a fatal error at runtime.
! // Note: std::malloc and std::free should never called directly.
!
//
// For objects allocated in the resource area (see resourceArea.hpp).
// - ResourceObj
//
! // For objects allocated in the C-heap (managed by: free & malloc and tracked with NMT)
// - CHeapObj
//
// For objects allocated on the stack.
// - StackObj
//
// For classes used as name spaces.
// - AllStatic
//
// For classes in Metaspace (class data)
// - MetaspaceObj
*** 82,100 ****
// FREE_C_HEAP_ARRAY(type, old)
// FREE_C_HEAP_OBJ(objname, type, memflags)
// char* AllocateHeap(size_t size, const char* name);
// void FreeHeap(void* p);
//
- // C-heap allocation can be traced using +PrintHeapAllocation.
- // malloc and free should therefore never called directly.
-
- // Base class for objects allocated in the C-heap.
// In non product mode we introduce a super class for all allocation classes
// that supports printing.
// We avoid the superclass in product mode since some C++ compilers add
! // a word overhead for empty super classes.
#ifdef PRODUCT
#define ALLOCATION_SUPER_CLASS_SPEC
#else
#define ALLOCATION_SUPER_CLASS_SPEC : public AllocatedObj
--- 83,97 ----
// FREE_C_HEAP_ARRAY(type, old)
// FREE_C_HEAP_OBJ(objname, type, memflags)
// char* AllocateHeap(size_t size, const char* name);
// void FreeHeap(void* p);
//
// In non product mode we introduce a super class for all allocation classes
// that supports printing.
// We avoid the superclass in product mode since some C++ compilers add
! // a word overhead for empty super classes, also this has a vptr for print functions.
#ifdef PRODUCT
#define ALLOCATION_SUPER_CLASS_SPEC
#else
#define ALLOCATION_SUPER_CLASS_SPEC : public AllocatedObj
*** 186,220 ****
#endif
void operator delete(void* p);
void operator delete [](void* p);
};
- // Base class for objects used as value objects.
- // Calling new or delete will result in fatal error.
- //
- // Portability note: Certain compilers (e.g. gcc) will
- // always make classes bigger if it has a superclass, even
- // if the superclass does not have any virtual methods or
- // instance fields. The HotSpot implementation relies on this
- // not to happen. So never make a ValueObj class a direct subclass
- // like this:
- //
- // class A {
- // ...
- // }
- //
- // be defined as a an empty string "".
- //
- class _ValueObj {
- private:
- void* operator new(size_t size) throw();
- void operator delete(void* p);
- void* operator new [](size_t size) throw();
- void operator delete [](void* p);
- };
-
-
// Base class for objects stored in Metaspace.
// Calling delete will result in fatal error.
//
// Do not inherit from something with a vptr because this class does
// not introduce one. This class is used to allocate both shared read-only
--- 183,192 ----
< prev index next >