Mercurial > hg > graal-compiler
comparison src/share/vm/runtime/os.hpp @ 11173:6b0fd0964b87
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 31 Jul 2013 11:00:54 +0200 |
parents | 836a62f43af9 af21010d1062 |
children | cefad50507d8 |
comparison
equal
deleted
inserted
replaced
10912:4ea54634f03e | 11173:6b0fd0964b87 |
---|---|
30 #include "runtime/extendedPC.hpp" | 30 #include "runtime/extendedPC.hpp" |
31 #include "runtime/handles.hpp" | 31 #include "runtime/handles.hpp" |
32 #include "utilities/top.hpp" | 32 #include "utilities/top.hpp" |
33 #ifdef TARGET_OS_FAMILY_linux | 33 #ifdef TARGET_OS_FAMILY_linux |
34 # include "jvm_linux.h" | 34 # include "jvm_linux.h" |
35 # include <setjmp.h> | |
35 #endif | 36 #endif |
36 #ifdef TARGET_OS_FAMILY_solaris | 37 #ifdef TARGET_OS_FAMILY_solaris |
37 # include "jvm_solaris.h" | 38 # include "jvm_solaris.h" |
39 # include <setjmp.h> | |
38 #endif | 40 #endif |
39 #ifdef TARGET_OS_FAMILY_windows | 41 #ifdef TARGET_OS_FAMILY_windows |
40 # include "jvm_windows.h" | 42 # include "jvm_windows.h" |
41 #endif | 43 #endif |
42 #ifdef TARGET_OS_FAMILY_bsd | 44 #ifdef TARGET_OS_FAMILY_bsd |
43 # include "jvm_bsd.h" | 45 # include "jvm_bsd.h" |
46 # include <setjmp.h> | |
44 #endif | 47 #endif |
45 | 48 |
46 // os defines the interface to operating system; this includes traditional | 49 // os defines the interface to operating system; this includes traditional |
47 // OS services (time, I/O) as well as other functionality with system- | 50 // OS services (time, I/O) as well as other functionality with system- |
48 // dependent code. | 51 // dependent code. |
76 MaxPriority = 10, // Highest priority, used for WatcherThread | 79 MaxPriority = 10, // Highest priority, used for WatcherThread |
77 // ensures that VMThread doesn't starve profiler | 80 // ensures that VMThread doesn't starve profiler |
78 CriticalPriority = 11 // Critical thread priority | 81 CriticalPriority = 11 // Critical thread priority |
79 }; | 82 }; |
80 | 83 |
84 // Executable parameter flag for os::commit_memory() and | |
85 // os::commit_memory_or_exit(). | |
86 const bool ExecMem = true; | |
87 | |
81 // Typedef for structured exception handling support | 88 // Typedef for structured exception handling support |
82 typedef void (*java_call_t)(JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread); | 89 typedef void (*java_call_t)(JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread); |
83 | 90 |
84 class os: AllStatic { | 91 class os: AllStatic { |
85 public: | 92 public: |
102 static char* pd_reserve_memory(size_t bytes, char* addr = 0, | 109 static char* pd_reserve_memory(size_t bytes, char* addr = 0, |
103 size_t alignment_hint = 0); | 110 size_t alignment_hint = 0); |
104 static char* pd_attempt_reserve_memory_at(size_t bytes, char* addr); | 111 static char* pd_attempt_reserve_memory_at(size_t bytes, char* addr); |
105 static void pd_split_reserved_memory(char *base, size_t size, | 112 static void pd_split_reserved_memory(char *base, size_t size, |
106 size_t split, bool realloc); | 113 size_t split, bool realloc); |
107 static bool pd_commit_memory(char* addr, size_t bytes, bool executable = false); | 114 static bool pd_commit_memory(char* addr, size_t bytes, bool executable); |
108 static bool pd_commit_memory(char* addr, size_t size, size_t alignment_hint, | 115 static bool pd_commit_memory(char* addr, size_t size, size_t alignment_hint, |
109 bool executable = false); | 116 bool executable); |
117 // Same as pd_commit_memory() that either succeeds or calls | |
118 // vm_exit_out_of_memory() with the specified mesg. | |
119 static void pd_commit_memory_or_exit(char* addr, size_t bytes, | |
120 bool executable, const char* mesg); | |
121 static void pd_commit_memory_or_exit(char* addr, size_t size, | |
122 size_t alignment_hint, | |
123 bool executable, const char* mesg); | |
110 static bool pd_uncommit_memory(char* addr, size_t bytes); | 124 static bool pd_uncommit_memory(char* addr, size_t bytes); |
111 static bool pd_release_memory(char* addr, size_t bytes); | 125 static bool pd_release_memory(char* addr, size_t bytes); |
112 | 126 |
113 static char* pd_map_memory(int fd, const char* file_name, size_t file_offset, | 127 static char* pd_map_memory(int fd, const char* file_name, size_t file_offset, |
114 char *addr, size_t bytes, bool read_only = false, | 128 char *addr, size_t bytes, bool read_only = false, |
259 size_t alignment_hint, MEMFLAGS flags); | 273 size_t alignment_hint, MEMFLAGS flags); |
260 static char* reserve_memory_aligned(size_t size, size_t alignment); | 274 static char* reserve_memory_aligned(size_t size, size_t alignment); |
261 static char* attempt_reserve_memory_at(size_t bytes, char* addr); | 275 static char* attempt_reserve_memory_at(size_t bytes, char* addr); |
262 static void split_reserved_memory(char *base, size_t size, | 276 static void split_reserved_memory(char *base, size_t size, |
263 size_t split, bool realloc); | 277 size_t split, bool realloc); |
264 static bool commit_memory(char* addr, size_t bytes, bool executable = false); | 278 static bool commit_memory(char* addr, size_t bytes, bool executable); |
265 static bool commit_memory(char* addr, size_t size, size_t alignment_hint, | 279 static bool commit_memory(char* addr, size_t size, size_t alignment_hint, |
266 bool executable = false); | 280 bool executable); |
281 // Same as commit_memory() that either succeeds or calls | |
282 // vm_exit_out_of_memory() with the specified mesg. | |
283 static void commit_memory_or_exit(char* addr, size_t bytes, | |
284 bool executable, const char* mesg); | |
285 static void commit_memory_or_exit(char* addr, size_t size, | |
286 size_t alignment_hint, | |
287 bool executable, const char* mesg); | |
267 static bool uncommit_memory(char* addr, size_t bytes); | 288 static bool uncommit_memory(char* addr, size_t bytes); |
268 static bool release_memory(char* addr, size_t bytes); | 289 static bool release_memory(char* addr, size_t bytes); |
269 | 290 |
270 enum ProtType { MEM_PROT_NONE, MEM_PROT_READ, MEM_PROT_RW, MEM_PROT_RWX }; | 291 enum ProtType { MEM_PROT_NONE, MEM_PROT_READ, MEM_PROT_RW, MEM_PROT_RWX }; |
271 static bool protect_memory(char* addr, size_t bytes, ProtType prot, | 292 static bool protect_memory(char* addr, size_t bytes, ProtType prot, |
487 static bool dll_build_name(char* buffer, size_t size, | 508 static bool dll_build_name(char* buffer, size_t size, |
488 const char* pathname, const char* fname); | 509 const char* pathname, const char* fname); |
489 | 510 |
490 // Symbol lookup, find nearest function name; basically it implements | 511 // Symbol lookup, find nearest function name; basically it implements |
491 // dladdr() for all platforms. Name of the nearest function is copied | 512 // dladdr() for all platforms. Name of the nearest function is copied |
492 // to buf. Distance from its base address is returned as offset. | 513 // to buf. Distance from its base address is optionally returned as offset. |
493 // If function name is not found, buf[0] is set to '\0' and offset is | 514 // If function name is not found, buf[0] is set to '\0' and offset is |
494 // set to -1. | 515 // set to -1 (if offset is non-NULL). |
495 static bool dll_address_to_function_name(address addr, char* buf, | 516 static bool dll_address_to_function_name(address addr, char* buf, |
496 int buflen, int* offset); | 517 int buflen, int* offset); |
497 | 518 |
498 // Locate DLL/DSO. On success, full path of the library is copied to | 519 // Locate DLL/DSO. On success, full path of the library is copied to |
499 // buf, and offset is set to be the distance between addr and the | 520 // buf, and offset is optionally set to be the distance between addr |
500 // library's base address. On failure, buf[0] is set to '\0' and | 521 // and the library's base address. On failure, buf[0] is set to '\0' |
501 // offset is set to -1. | 522 // and offset is set to -1 (if offset is non-NULL). |
502 static bool dll_address_to_library_name(address addr, char* buf, | 523 static bool dll_address_to_library_name(address addr, char* buf, |
503 int buflen, int* offset); | 524 int buflen, int* offset); |
504 | 525 |
505 // Find out whether the pc is in the static code for jvm.dll/libjvm.so. | 526 // Find out whether the pc is in the static code for jvm.dll/libjvm.so. |
506 static bool address_is_in_vm(address addr); | 527 static bool address_is_in_vm(address addr); |
710 | 731 |
711 // Extensions | 732 // Extensions |
712 #include "runtime/os_ext.hpp" | 733 #include "runtime/os_ext.hpp" |
713 | 734 |
714 public: | 735 public: |
736 class CrashProtectionCallback : public StackObj { | |
737 public: | |
738 virtual void call() = 0; | |
739 }; | |
715 | 740 |
716 // Platform dependent stuff | 741 // Platform dependent stuff |
717 #ifdef TARGET_OS_FAMILY_linux | 742 #ifdef TARGET_OS_FAMILY_linux |
718 # include "os_linux.hpp" | 743 # include "os_linux.hpp" |
719 # include "os_posix.hpp" | 744 # include "os_posix.hpp" |
888 int home_len, | 913 int home_len, |
889 char fileSep, | 914 char fileSep, |
890 char pathSep); | 915 char pathSep); |
891 static bool set_boot_path(char fileSep, char pathSep); | 916 static bool set_boot_path(char fileSep, char pathSep); |
892 static char** split_path(const char* path, int* n); | 917 static char** split_path(const char* path, int* n); |
918 | |
893 }; | 919 }; |
894 | 920 |
895 // Note that "PAUSE" is almost always used with synchronization | 921 // Note that "PAUSE" is almost always used with synchronization |
896 // so arguably we should provide Atomic::SpinPause() instead | 922 // so arguably we should provide Atomic::SpinPause() instead |
897 // of the global SpinPause() with C linkage. | 923 // of the global SpinPause() with C linkage. |
898 // It'd also be eligible for inlining on many platforms. | 924 // It'd also be eligible for inlining on many platforms. |
899 | 925 |
900 extern "C" int SpinPause () ; | 926 extern "C" int SpinPause(); |
901 extern "C" int SafeFetch32 (int * adr, int errValue) ; | |
902 extern "C" intptr_t SafeFetchN (intptr_t * adr, intptr_t errValue) ; | |
903 | 927 |
904 #endif // SHARE_VM_RUNTIME_OS_HPP | 928 #endif // SHARE_VM_RUNTIME_OS_HPP |