comparison src/share/vm/runtime/os.hpp @ 20804:7848fc12602b

Merge with jdk8u40-b25
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Tue, 07 Apr 2015 14:58:49 +0200
parents 52b4284cb496 c12e6bac4ad0
children be896a1983c0
comparison
equal deleted inserted replaced
20184:84105dcdb05b 20804:7848fc12602b
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;
106 friend class MallocTracker;
102 #ifdef GRAAL 107 #ifdef GRAAL
103 friend class Arguments; // need access to format_boot_path 108 friend class Arguments; // need access to format_boot_path
104 #endif 109 #endif
105 110
106 public: 111 public:
162 167
163 // File names are case-insensitive on windows only 168 // File names are case-insensitive on windows only
164 // Override me as needed 169 // Override me as needed
165 static int file_name_strcmp(const char* s1, const char* s2); 170 static int file_name_strcmp(const char* s1, const char* s2);
166 171
172 // get/unset environment variable
167 static bool getenv(const char* name, char* buffer, int len); 173 static bool getenv(const char* name, char* buffer, int len);
174 static bool unsetenv(const char* name);
175
168 static bool have_special_privileges(); 176 static bool have_special_privileges();
169 177
170 static jlong javaTimeMillis(); 178 static jlong javaTimeMillis();
171 static jlong javaTimeNanos(); 179 static jlong javaTimeNanos();
172 static void javaTimeNanos_info(jvmtiTimerInfo *info_ptr); 180 static void javaTimeNanos_info(jvmtiTimerInfo *info_ptr);
208 // Returns buffer, or NULL if it failed. 216 // Returns buffer, or NULL if it failed.
209 static char* iso8601_time(char* buffer, size_t buffer_length); 217 static char* iso8601_time(char* buffer, size_t buffer_length);
210 218
211 // Interface for detecting multiprocessor system 219 // Interface for detecting multiprocessor system
212 static inline bool is_MP() { 220 static inline bool is_MP() {
213 assert(_processor_count > 0, "invalid processor count"); 221 // During bootstrap if _processor_count is not yet initialized
214 return _processor_count > 1 || AssumeMP; 222 // we claim to be MP as that is safest. If any platform has a
223 // stub generator that might be triggered in this phase and for
224 // which being declared MP when in fact not, is a problem - then
225 // the bootstrap routine for the stub generator needs to check
226 // the processor count directly and leave the bootstrap routine
227 // in place until called after initialization has ocurred.
228 return (_processor_count != 1) || AssumeMP;
215 } 229 }
216 static julong available_memory(); 230 static julong available_memory();
217 static julong physical_memory(); 231 static julong physical_memory();
218 static bool has_allocatable_memory_limit(julong* limit); 232 static bool has_allocatable_memory_limit(julong* limit);
219 static bool is_server_class_machine(); 233 static bool is_server_class_machine();
655 static int allocate_thread_local_storage(); 669 static int allocate_thread_local_storage();
656 static void thread_local_storage_at_put(int index, void* value); 670 static void thread_local_storage_at_put(int index, void* value);
657 static void* thread_local_storage_at(int index); 671 static void* thread_local_storage_at(int index);
658 static void free_thread_local_storage(int index); 672 static void free_thread_local_storage(int index);
659 673
660 // Stack walk 674 // Retrieve native stack frames.
661 static address get_caller_pc(int n = 0); 675 // Parameter:
676 // stack: an array to storage stack pointers.
677 // frames: size of above array.
678 // toSkip: number of stack frames to skip at the beginning.
679 // Return: number of stack frames captured.
680 static int get_native_stack(address* stack, int size, int toSkip = 0);
662 681
663 // General allocation (must be MT-safe) 682 // General allocation (must be MT-safe)
664 static void* malloc (size_t size, MEMFLAGS flags, address caller_pc = 0); 683 static void* malloc (size_t size, MEMFLAGS flags, const NativeCallStack& stack);
665 static void* realloc (void *memblock, size_t size, MEMFLAGS flags, address caller_pc = 0); 684 static void* malloc (size_t size, MEMFLAGS flags);
685 static void* realloc (void *memblock, size_t size, MEMFLAGS flag, const NativeCallStack& stack);
686 static void* realloc (void *memblock, size_t size, MEMFLAGS flag);
687
666 static void free (void *memblock, MEMFLAGS flags = mtNone); 688 static void free (void *memblock, MEMFLAGS flags = mtNone);
667 static bool check_heap(bool force = false); // verify C heap integrity 689 static bool check_heap(bool force = false); // verify C heap integrity
668 static char* strdup(const char *, MEMFLAGS flags = mtInternal); // Like strdup 690 static char* strdup(const char *, MEMFLAGS flags = mtInternal); // Like strdup
669 691
670 #ifndef PRODUCT 692 #ifndef PRODUCT