--- a/src/hotspot/share/memory/allocation.hpp Thu Oct 17 20:27:44 2019 +0100
+++ b/src/hotspot/share/memory/allocation.hpp Thu Oct 17 20:53:35 2019 +0100
@@ -25,12 +25,12 @@
#ifndef SHARE_MEMORY_ALLOCATION_HPP
#define SHARE_MEMORY_ALLOCATION_HPP
-#include "runtime/globals.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/macros.hpp"
#include <new>
+class outputStream;
class Thread;
class AllocFailStrategy {
@@ -80,16 +80,21 @@
// stored in the array then must pay attention to calling destructors
// at needed.
//
-// NEW_RESOURCE_ARRAY(type, size)
-// NEW_RESOURCE_OBJ(type)
-// NEW_C_HEAP_ARRAY(type, size)
-// NEW_C_HEAP_OBJ(type, memflags)
-// 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);
+// NEW_RESOURCE_ARRAY*
+// REALLOC_RESOURCE_ARRAY*
+// FREE_RESOURCE_ARRAY*
+// NEW_RESOURCE_OBJ*
+// NEW_C_HEAP_ARRAY*
+// REALLOC_C_HEAP_ARRAY*
+// FREE_C_HEAP_ARRAY*
+// NEW_C_HEAP_OBJ*
+// FREE_C_HEAP_OBJ
//
-
+// char* AllocateHeap(size_t size, MEMFLAGS flags, const NativeCallStack& stack, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
+// char* AllocateHeap(size_t size, MEMFLAGS flags, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
+// char* ReallocateHeap(char *old, size_t size, MEMFLAGS flag, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
+// 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 to save space.
@@ -179,6 +184,7 @@
MEMFLAGS flag,
AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM);
+// handles NULL pointers
void FreeHeap(void* p);
template <MEMFLAGS F> class CHeapObj ALLOCATION_SUPER_CLASS_SPEC {
@@ -230,9 +236,6 @@
private:
void* operator new(size_t size) throw();
void* operator new [](size_t size) throw();
-#ifdef __IBMCPP__
- public:
-#endif
void operator delete(void* p);
void operator delete [](void* p);
};
@@ -507,23 +510,6 @@
#define FREE_C_HEAP_OBJ(objname)\
FreeHeap((char*)objname);
-// for statistics
-#ifndef PRODUCT
-class AllocStats : StackObj {
- julong start_mallocs, start_frees;
- julong start_malloc_bytes, start_mfree_bytes, start_res_bytes;
- public:
- AllocStats();
-
- julong num_mallocs(); // since creation of receiver
- julong alloc_bytes();
- julong num_frees();
- julong free_bytes();
- julong resource_bytes();
- void print();
-};
-#endif
-
//------------------------------ReallocMark---------------------------------
// Code which uses REALLOC_RESOURCE_ARRAY should check an associated