src/share/vm/memory/allocation.inline.hpp

changeset 5249
ce9ecec70f99
parent 5103
f9be75d21404
child 5255
a837fa3d3f86
equal deleted inserted replaced
5248:cb92413c6934 5249:ce9ecec70f99
84 } 84 }
85 85
86 86
87 template <MEMFLAGS F> void* CHeapObj<F>::operator new(size_t size, 87 template <MEMFLAGS F> void* CHeapObj<F>::operator new(size_t size,
88 address caller_pc){ 88 address caller_pc){
89 void* p = (void*)AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC));
89 #ifdef ASSERT 90 #ifdef ASSERT
90 void* p = (void*)AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC));
91 if (PrintMallocFree) trace_heap_malloc(size, "CHeapObj-new", p); 91 if (PrintMallocFree) trace_heap_malloc(size, "CHeapObj-new", p);
92 #endif
92 return p; 93 return p;
93 #else
94 return (void *) AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC));
95 #endif
96 } 94 }
97 95
98 template <MEMFLAGS F> void* CHeapObj<F>::operator new (size_t size, 96 template <MEMFLAGS F> void* CHeapObj<F>::operator new (size_t size,
99 const std::nothrow_t& nothrow_constant, address caller_pc) { 97 const std::nothrow_t& nothrow_constant, address caller_pc) {
100 #ifdef ASSERT
101 void* p = (void*)AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC), 98 void* p = (void*)AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC),
102 AllocFailStrategy::RETURN_NULL); 99 AllocFailStrategy::RETURN_NULL);
100 #ifdef ASSERT
103 if (PrintMallocFree) trace_heap_malloc(size, "CHeapObj-new", p); 101 if (PrintMallocFree) trace_heap_malloc(size, "CHeapObj-new", p);
102 #endif
104 return p; 103 return p;
105 #else 104 }
106 return (void *) AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC), 105
107 AllocFailStrategy::RETURN_NULL); 106 template <MEMFLAGS F> void* CHeapObj<F>::operator new [](size_t size,
108 #endif 107 address caller_pc){
108 return CHeapObj<F>::operator new(size, caller_pc);
109 }
110
111 template <MEMFLAGS F> void* CHeapObj<F>::operator new [](size_t size,
112 const std::nothrow_t& nothrow_constant, address caller_pc) {
113 return CHeapObj<F>::operator new(size, nothrow_constant, caller_pc);
109 } 114 }
110 115
111 template <MEMFLAGS F> void CHeapObj<F>::operator delete(void* p){ 116 template <MEMFLAGS F> void CHeapObj<F>::operator delete(void* p){
112 FreeHeap(p, F); 117 FreeHeap(p, F);
118 }
119
120 template <MEMFLAGS F> void CHeapObj<F>::operator delete [](void* p){
121 FreeHeap(p, F);
113 } 122 }
114 123
115 template <class E, MEMFLAGS F> 124 template <class E, MEMFLAGS F>
116 E* ArrayAllocator<E, F>::allocate(size_t length) { 125 E* ArrayAllocator<E, F>::allocate(size_t length) {
117 assert(_addr == NULL, "Already in use"); 126 assert(_addr == NULL, "Already in use");

mercurial