src/share/vm/runtime/os.hpp

changeset 7074
833b0f92429a
parent 6782
f73af4455d7d
child 7273
c12e6bac4ad0
     1.1 --- a/src/share/vm/runtime/os.hpp	Wed Aug 27 09:36:55 2014 +0200
     1.2 +++ b/src/share/vm/runtime/os.hpp	Wed Aug 27 08:19:12 2014 -0400
     1.3 @@ -66,6 +66,8 @@
     1.4  class Event;
     1.5  class DLL;
     1.6  class FileHandle;
     1.7 +class NativeCallStack;
     1.8 +
     1.9  template<class E> class GrowableArray;
    1.10  
    1.11  // %%%%% Moved ThreadState, START_FN, OSThread to new osThread.hpp. -- Rose
    1.12 @@ -97,9 +99,11 @@
    1.13  // Typedef for structured exception handling support
    1.14  typedef void (*java_call_t)(JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread);
    1.15  
    1.16 +class MallocTracker;
    1.17 +
    1.18  class os: AllStatic {
    1.19    friend class VMStructs;
    1.20 -
    1.21 +  friend class MallocTracker;
    1.22   public:
    1.23    enum { page_sizes_max = 9 }; // Size of _page_sizes array (8 plus a sentinel)
    1.24  
    1.25 @@ -161,7 +165,10 @@
    1.26    // Override me as needed
    1.27    static int    file_name_strcmp(const char* s1, const char* s2);
    1.28  
    1.29 +  // get/unset environment variable
    1.30    static bool getenv(const char* name, char* buffer, int len);
    1.31 +  static bool unsetenv(const char* name);
    1.32 +
    1.33    static bool have_special_privileges();
    1.34  
    1.35    static jlong  javaTimeMillis();
    1.36 @@ -207,8 +214,13 @@
    1.37  
    1.38    // Interface for detecting multiprocessor system
    1.39    static inline bool is_MP() {
    1.40 +#if !INCLUDE_NMT
    1.41      assert(_processor_count > 0, "invalid processor count");
    1.42      return _processor_count > 1 || AssumeMP;
    1.43 +#else
    1.44 +    // NMT needs atomic operations before this initialization.
    1.45 +    return true;
    1.46 +#endif
    1.47    }
    1.48    static julong available_memory();
    1.49    static julong physical_memory();
    1.50 @@ -651,12 +663,20 @@
    1.51    static void* thread_local_storage_at(int index);
    1.52    static void  free_thread_local_storage(int index);
    1.53  
    1.54 -  // Stack walk
    1.55 -  static address get_caller_pc(int n = 0);
    1.56 +  // Retrieve native stack frames.
    1.57 +  // Parameter:
    1.58 +  //   stack:  an array to storage stack pointers.
    1.59 +  //   frames: size of above array.
    1.60 +  //   toSkip: number of stack frames to skip at the beginning.
    1.61 +  // Return: number of stack frames captured.
    1.62 +  static int get_native_stack(address* stack, int size, int toSkip = 0);
    1.63  
    1.64    // General allocation (must be MT-safe)
    1.65 -  static void* malloc  (size_t size, MEMFLAGS flags, address caller_pc = 0);
    1.66 -  static void* realloc (void *memblock, size_t size, MEMFLAGS flags, address caller_pc = 0);
    1.67 +  static void* malloc  (size_t size, MEMFLAGS flags, const NativeCallStack& stack);
    1.68 +  static void* malloc  (size_t size, MEMFLAGS flags);
    1.69 +  static void* realloc (void *memblock, size_t size, MEMFLAGS flag, const NativeCallStack& stack);
    1.70 +  static void* realloc (void *memblock, size_t size, MEMFLAGS flag);
    1.71 +
    1.72    static void  free    (void *memblock, MEMFLAGS flags = mtNone);
    1.73    static bool  check_heap(bool force = false);      // verify C heap integrity
    1.74    static char* strdup(const char *, MEMFLAGS flags = mtInternal);  // Like strdup

mercurial