64 class Thread; |
64 class Thread; |
65 class JavaThread; |
65 class JavaThread; |
66 class Event; |
66 class Event; |
67 class DLL; |
67 class DLL; |
68 class FileHandle; |
68 class FileHandle; |
|
69 class NativeCallStack; |
|
70 |
69 template<class E> class GrowableArray; |
71 template<class E> class GrowableArray; |
70 |
72 |
71 // %%%%% Moved ThreadState, START_FN, OSThread to new osThread.hpp. -- Rose |
73 // %%%%% Moved ThreadState, START_FN, OSThread to new osThread.hpp. -- Rose |
72 |
74 |
73 // Platform-independent error return values from OS functions |
75 // Platform-independent error return values from OS functions |
95 const bool ExecMem = true; |
97 const bool ExecMem = true; |
96 |
98 |
97 // Typedef for structured exception handling support |
99 // Typedef for structured exception handling support |
98 typedef void (*java_call_t)(JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread); |
100 typedef void (*java_call_t)(JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread); |
99 |
101 |
|
102 class MallocTracker; |
|
103 |
100 class os: AllStatic { |
104 class os: AllStatic { |
101 friend class VMStructs; |
105 friend class VMStructs; |
102 |
106 friend class MallocTracker; |
103 public: |
107 public: |
104 enum { page_sizes_max = 9 }; // Size of _page_sizes array (8 plus a sentinel) |
108 enum { page_sizes_max = 9 }; // Size of _page_sizes array (8 plus a sentinel) |
105 |
109 |
106 private: |
110 private: |
107 static OSThread* _starting_thread; |
111 static OSThread* _starting_thread; |
159 |
163 |
160 // File names are case-insensitive on windows only |
164 // File names are case-insensitive on windows only |
161 // Override me as needed |
165 // Override me as needed |
162 static int file_name_strcmp(const char* s1, const char* s2); |
166 static int file_name_strcmp(const char* s1, const char* s2); |
163 |
167 |
|
168 // get/unset environment variable |
164 static bool getenv(const char* name, char* buffer, int len); |
169 static bool getenv(const char* name, char* buffer, int len); |
|
170 static bool unsetenv(const char* name); |
|
171 |
165 static bool have_special_privileges(); |
172 static bool have_special_privileges(); |
166 |
173 |
167 static jlong javaTimeMillis(); |
174 static jlong javaTimeMillis(); |
168 static jlong javaTimeNanos(); |
175 static jlong javaTimeNanos(); |
169 static void javaTimeNanos_info(jvmtiTimerInfo *info_ptr); |
176 static void javaTimeNanos_info(jvmtiTimerInfo *info_ptr); |
205 // Returns buffer, or NULL if it failed. |
212 // Returns buffer, or NULL if it failed. |
206 static char* iso8601_time(char* buffer, size_t buffer_length); |
213 static char* iso8601_time(char* buffer, size_t buffer_length); |
207 |
214 |
208 // Interface for detecting multiprocessor system |
215 // Interface for detecting multiprocessor system |
209 static inline bool is_MP() { |
216 static inline bool is_MP() { |
|
217 #if !INCLUDE_NMT |
210 assert(_processor_count > 0, "invalid processor count"); |
218 assert(_processor_count > 0, "invalid processor count"); |
211 return _processor_count > 1 || AssumeMP; |
219 return _processor_count > 1 || AssumeMP; |
|
220 #else |
|
221 // NMT needs atomic operations before this initialization. |
|
222 return true; |
|
223 #endif |
212 } |
224 } |
213 static julong available_memory(); |
225 static julong available_memory(); |
214 static julong physical_memory(); |
226 static julong physical_memory(); |
215 static bool has_allocatable_memory_limit(julong* limit); |
227 static bool has_allocatable_memory_limit(julong* limit); |
216 static bool is_server_class_machine(); |
228 static bool is_server_class_machine(); |
649 static int allocate_thread_local_storage(); |
661 static int allocate_thread_local_storage(); |
650 static void thread_local_storage_at_put(int index, void* value); |
662 static void thread_local_storage_at_put(int index, void* value); |
651 static void* thread_local_storage_at(int index); |
663 static void* thread_local_storage_at(int index); |
652 static void free_thread_local_storage(int index); |
664 static void free_thread_local_storage(int index); |
653 |
665 |
654 // Stack walk |
666 // Retrieve native stack frames. |
655 static address get_caller_pc(int n = 0); |
667 // Parameter: |
|
668 // stack: an array to storage stack pointers. |
|
669 // frames: size of above array. |
|
670 // toSkip: number of stack frames to skip at the beginning. |
|
671 // Return: number of stack frames captured. |
|
672 static int get_native_stack(address* stack, int size, int toSkip = 0); |
656 |
673 |
657 // General allocation (must be MT-safe) |
674 // General allocation (must be MT-safe) |
658 static void* malloc (size_t size, MEMFLAGS flags, address caller_pc = 0); |
675 static void* malloc (size_t size, MEMFLAGS flags, const NativeCallStack& stack); |
659 static void* realloc (void *memblock, size_t size, MEMFLAGS flags, address caller_pc = 0); |
676 static void* malloc (size_t size, MEMFLAGS flags); |
|
677 static void* realloc (void *memblock, size_t size, MEMFLAGS flag, const NativeCallStack& stack); |
|
678 static void* realloc (void *memblock, size_t size, MEMFLAGS flag); |
|
679 |
660 static void free (void *memblock, MEMFLAGS flags = mtNone); |
680 static void free (void *memblock, MEMFLAGS flags = mtNone); |
661 static bool check_heap(bool force = false); // verify C heap integrity |
681 static bool check_heap(bool force = false); // verify C heap integrity |
662 static char* strdup(const char *, MEMFLAGS flags = mtInternal); // Like strdup |
682 static char* strdup(const char *, MEMFLAGS flags = mtInternal); // Like strdup |
663 |
683 |
664 #ifndef PRODUCT |
684 #ifndef PRODUCT |