hotspot/src/share/vm/memory/allocation.inline.hpp
changeset 17026 72b2233861f1
parent 16682 4e30a46f6b76
child 17031 9a576749065b
--- a/hotspot/src/share/vm/memory/allocation.inline.hpp	Thu Apr 18 14:03:37 2013 -0400
+++ b/hotspot/src/share/vm/memory/allocation.inline.hpp	Fri Apr 19 11:08:52 2013 -0700
@@ -82,30 +82,39 @@
 
 template <MEMFLAGS F> void* CHeapObj<F>::operator new(size_t size,
       address caller_pc){
+    void* p = (void*)AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC));
 #ifdef ASSERT
-    void* p = (void*)AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC));
     if (PrintMallocFree) trace_heap_malloc(size, "CHeapObj-new", p);
+#endif
     return p;
-#else
-    return (void *) AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC));
-#endif
   }
 
 template <MEMFLAGS F> void* CHeapObj<F>::operator new (size_t size,
   const std::nothrow_t&  nothrow_constant, address caller_pc) {
-#ifdef ASSERT
   void* p = (void*)AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC),
       AllocFailStrategy::RETURN_NULL);
+#ifdef ASSERT
     if (PrintMallocFree) trace_heap_malloc(size, "CHeapObj-new", p);
+#endif
     return p;
-#else
-  return (void *) AllocateHeap(size, F, (caller_pc != 0 ? caller_pc : CALLER_PC),
-      AllocFailStrategy::RETURN_NULL);
-#endif
+}
+
+template <MEMFLAGS F> void* CHeapObj<F>::operator new [](size_t size,
+      address caller_pc){
+    return CHeapObj<F>::operator new(size, caller_pc);
+}
+
+template <MEMFLAGS F> void* CHeapObj<F>::operator new [](size_t size,
+  const std::nothrow_t&  nothrow_constant, address caller_pc) {
+    return CHeapObj<F>::operator new(size, nothrow_constant, caller_pc);
 }
 
 template <MEMFLAGS F> void CHeapObj<F>::operator delete(void* p){
-   FreeHeap(p, F);
+    FreeHeap(p, F);
+}
+
+template <MEMFLAGS F> void CHeapObj<F>::operator delete [](void* p){
+    FreeHeap(p, F);
 }
 
 template <class E, MEMFLAGS F>