--- a/hotspot/src/share/vm/runtime/os.hpp Tue Aug 05 14:18:44 2014 +0000
+++ b/hotspot/src/share/vm/runtime/os.hpp Thu Aug 07 12:18:58 2014 -0700
@@ -65,6 +65,8 @@
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 @@
// 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 @@
// 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 @@
// 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 @@
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