76 MaxPriority = 10, // Highest priority, used for WatcherThread |
76 MaxPriority = 10, // Highest priority, used for WatcherThread |
77 // ensures that VMThread doesn't starve profiler |
77 // ensures that VMThread doesn't starve profiler |
78 CriticalPriority = 11 // Critical thread priority |
78 CriticalPriority = 11 // Critical thread priority |
79 }; |
79 }; |
80 |
80 |
|
81 // Executable parameter flag for os::commit_memory() and |
|
82 // os::commit_memory_or_exit(). |
|
83 const bool ExecMem = true; |
|
84 |
81 // Typedef for structured exception handling support |
85 // Typedef for structured exception handling support |
82 typedef void (*java_call_t)(JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread); |
86 typedef void (*java_call_t)(JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread); |
83 |
87 |
84 class os: AllStatic { |
88 class os: AllStatic { |
85 public: |
89 public: |
102 static char* pd_reserve_memory(size_t bytes, char* addr = 0, |
106 static char* pd_reserve_memory(size_t bytes, char* addr = 0, |
103 size_t alignment_hint = 0); |
107 size_t alignment_hint = 0); |
104 static char* pd_attempt_reserve_memory_at(size_t bytes, char* addr); |
108 static char* pd_attempt_reserve_memory_at(size_t bytes, char* addr); |
105 static void pd_split_reserved_memory(char *base, size_t size, |
109 static void pd_split_reserved_memory(char *base, size_t size, |
106 size_t split, bool realloc); |
110 size_t split, bool realloc); |
107 static bool pd_commit_memory(char* addr, size_t bytes, bool executable = false); |
111 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, |
112 static bool pd_commit_memory(char* addr, size_t size, size_t alignment_hint, |
109 bool executable = false); |
113 bool executable); |
|
114 // Same as pd_commit_memory() that either succeeds or calls |
|
115 // vm_exit_out_of_memory() with the specified mesg. |
|
116 static void pd_commit_memory_or_exit(char* addr, size_t bytes, |
|
117 bool executable, const char* mesg); |
|
118 static void pd_commit_memory_or_exit(char* addr, size_t size, |
|
119 size_t alignment_hint, |
|
120 bool executable, const char* mesg); |
110 static bool pd_uncommit_memory(char* addr, size_t bytes); |
121 static bool pd_uncommit_memory(char* addr, size_t bytes); |
111 static bool pd_release_memory(char* addr, size_t bytes); |
122 static bool pd_release_memory(char* addr, size_t bytes); |
112 |
123 |
113 static char* pd_map_memory(int fd, const char* file_name, size_t file_offset, |
124 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, |
125 char *addr, size_t bytes, bool read_only = false, |
259 size_t alignment_hint, MEMFLAGS flags); |
270 size_t alignment_hint, MEMFLAGS flags); |
260 static char* reserve_memory_aligned(size_t size, size_t alignment); |
271 static char* reserve_memory_aligned(size_t size, size_t alignment); |
261 static char* attempt_reserve_memory_at(size_t bytes, char* addr); |
272 static char* attempt_reserve_memory_at(size_t bytes, char* addr); |
262 static void split_reserved_memory(char *base, size_t size, |
273 static void split_reserved_memory(char *base, size_t size, |
263 size_t split, bool realloc); |
274 size_t split, bool realloc); |
264 static bool commit_memory(char* addr, size_t bytes, bool executable = false); |
275 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, |
276 static bool commit_memory(char* addr, size_t size, size_t alignment_hint, |
266 bool executable = false); |
277 bool executable); |
|
278 // Same as commit_memory() that either succeeds or calls |
|
279 // vm_exit_out_of_memory() with the specified mesg. |
|
280 static void commit_memory_or_exit(char* addr, size_t bytes, |
|
281 bool executable, const char* mesg); |
|
282 static void commit_memory_or_exit(char* addr, size_t size, |
|
283 size_t alignment_hint, |
|
284 bool executable, const char* mesg); |
267 static bool uncommit_memory(char* addr, size_t bytes); |
285 static bool uncommit_memory(char* addr, size_t bytes); |
268 static bool release_memory(char* addr, size_t bytes); |
286 static bool release_memory(char* addr, size_t bytes); |
269 |
287 |
270 enum ProtType { MEM_PROT_NONE, MEM_PROT_READ, MEM_PROT_RW, MEM_PROT_RWX }; |
288 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, |
289 static bool protect_memory(char* addr, size_t bytes, ProtType prot, |