63 // For classes in Metaspace (class data)
64 // - MetaspaceObj
65 //
66 // The printable subclasses are used for debugging and define virtual
67 // member functions for printing. Classes that avoid allocating the
68 // vtbl entries in the objects should therefore not be the printable
69 // subclasses.
70 //
71 // The following macros and function should be used to allocate memory
72 // directly in the resource area or in the C-heap, The _OBJ variants
73 // of the NEW/FREE_C_HEAP macros are used for alloc/dealloc simple
74 // objects which are not inherited from CHeapObj, note constructor and
75 // destructor are not called. The preferable way to allocate objects
76 // is using the new operator.
77 //
78 // WARNING: The array variant must only be used for a homogenous array
79 // where all objects are of the exact type specified. If subtypes are
80 // stored in the array then must pay attention to calling destructors
81 // at needed.
82 //
83 // NEW_RESOURCE_ARRAY(type, size)
84 // NEW_RESOURCE_OBJ(type)
85 // NEW_C_HEAP_ARRAY(type, size)
86 // NEW_C_HEAP_OBJ(type, memflags)
87 // FREE_C_HEAP_ARRAY(type, old)
88 // FREE_C_HEAP_OBJ(objname, type, memflags)
89 // char* AllocateHeap(size_t size, const char* name);
90 // void FreeHeap(void* p);
91 //
92
93 // In non product mode we introduce a super class for all allocation classes
94 // that supports printing.
95 // We avoid the superclass in product mode to save space.
96
97 #ifdef PRODUCT
98 #define ALLOCATION_SUPER_CLASS_SPEC
99 #else
100 #define ALLOCATION_SUPER_CLASS_SPEC : public AllocatedObj
101 class AllocatedObj {
102 public:
103 // Printing support
104 void print() const;
105 void print_value() const;
106
107 virtual void print_on(outputStream* st) const;
108 virtual void print_value_on(outputStream* st) const;
109 };
110 #endif
111
112 #define MEMORY_TYPES_DO(f) \
|
63 // For classes in Metaspace (class data)
64 // - MetaspaceObj
65 //
66 // The printable subclasses are used for debugging and define virtual
67 // member functions for printing. Classes that avoid allocating the
68 // vtbl entries in the objects should therefore not be the printable
69 // subclasses.
70 //
71 // The following macros and function should be used to allocate memory
72 // directly in the resource area or in the C-heap, The _OBJ variants
73 // of the NEW/FREE_C_HEAP macros are used for alloc/dealloc simple
74 // objects which are not inherited from CHeapObj, note constructor and
75 // destructor are not called. The preferable way to allocate objects
76 // is using the new operator.
77 //
78 // WARNING: The array variant must only be used for a homogenous array
79 // where all objects are of the exact type specified. If subtypes are
80 // stored in the array then must pay attention to calling destructors
81 // at needed.
82 //
83 // In non product mode we introduce a super class for all allocation classes
84 // that supports printing.
85 // We avoid the superclass in product mode to save space.
86
87 #ifdef PRODUCT
88 #define ALLOCATION_SUPER_CLASS_SPEC
89 #else
90 #define ALLOCATION_SUPER_CLASS_SPEC : public AllocatedObj
91 class AllocatedObj {
92 public:
93 // Printing support
94 void print() const;
95 void print_value() const;
96
97 virtual void print_on(outputStream* st) const;
98 virtual void print_value_on(outputStream* st) const;
99 };
100 #endif
101
102 #define MEMORY_TYPES_DO(f) \
|