8046598: Scalable Native memory tracking development

Enhance scalability of native memory tracking

Reviewed-by: coleenp, ctornqvi, gtriantafill
This commit is contained in:
Zhengyu Gu 2014-08-07 12:18:58 -07:00
parent 40b035d141
commit f0cf82f571
72 changed files with 5166 additions and 6109 deletions

View file

@ -65,6 +65,8 @@ class JavaThread;
class Event;
class DLL;
class FileHandle;
class NativeCallStack;
template<class E> class GrowableArray;
// %%%%% Moved ThreadState, START_FN, OSThread to new osThread.hpp. -- Rose
@ -96,9 +98,11 @@ const bool ExecMem = true;
// Typedef for structured exception handling support
typedef void (*java_call_t)(JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread);
class MallocTracker;
class os: AllStatic {
friend class VMStructs;
friend class MallocTracker;
public:
enum { page_sizes_max = 9 }; // Size of _page_sizes array (8 plus a sentinel)
@ -160,7 +164,10 @@ class os: AllStatic {
// Override me as needed
static int file_name_strcmp(const char* s1, const char* s2);
// get/unset environment variable
static bool getenv(const char* name, char* buffer, int len);
static bool unsetenv(const char* name);
static bool have_special_privileges();
static jlong javaTimeMillis();
@ -207,8 +214,13 @@ class os: AllStatic {
// Interface for detecting multiprocessor system
static inline bool is_MP() {
#if !INCLUDE_NMT
assert(_processor_count > 0, "invalid processor count");
return _processor_count > 1 || AssumeMP;
#else
// NMT needs atomic operations before this initialization.
return true;
#endif
}
static julong available_memory();
static julong physical_memory();
@ -635,12 +647,20 @@ class os: AllStatic {
static void* thread_local_storage_at(int index);
static void free_thread_local_storage(int index);
// Stack walk
static address get_caller_pc(int n = 0);
// Retrieve native stack frames.
// Parameter:
// stack: an array to storage stack pointers.
// frames: size of above array.
// toSkip: number of stack frames to skip at the beginning.
// Return: number of stack frames captured.
static int get_native_stack(address* stack, int size, int toSkip = 0);
// General allocation (must be MT-safe)
static void* malloc (size_t size, MEMFLAGS flags, address caller_pc = 0);
static void* realloc (void *memblock, size_t size, MEMFLAGS flags, address caller_pc = 0);
static void* malloc (size_t size, MEMFLAGS flags, const NativeCallStack& stack);
static void* malloc (size_t size, MEMFLAGS flags);
static void* realloc (void *memblock, size_t size, MEMFLAGS flag, const NativeCallStack& stack);
static void* realloc (void *memblock, size_t size, MEMFLAGS flag);
static void free (void *memblock, MEMFLAGS flags = mtNone);
static bool check_heap(bool force = false); // verify C heap integrity
static char* strdup(const char *, MEMFLAGS flags = mtInternal); // Like strdup