137 bool executable, const char* mesg);
138 static bool pd_uncommit_memory(char* addr, size_t bytes);
139 static bool pd_release_memory(char* addr, size_t bytes);
140
141 static char* pd_map_memory(int fd, const char* file_name, size_t file_offset,
142 char *addr, size_t bytes, bool read_only = false,
143 bool allow_exec = false);
144 static char* pd_remap_memory(int fd, const char* file_name, size_t file_offset,
145 char *addr, size_t bytes, bool read_only,
146 bool allow_exec);
147 static bool pd_unmap_memory(char *addr, size_t bytes);
148 static void pd_free_memory(char *addr, size_t bytes, size_t alignment_hint);
149 static void pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint);
150
151 static size_t page_size_for_region(size_t region_size, size_t min_pages, bool must_be_aligned);
152
153 // Get summary strings for system information in buffer provided
154 static void get_summary_cpu_info(char* buf, size_t buflen);
155 static void get_summary_os_info(char* buf, size_t buflen);
156
157 public:
158 static void init(void); // Called before command line parsing
159 static void init_before_ergo(void); // Called after command line parsing
160 // before VM ergonomics processing.
161 static jint init_2(void); // Called after command line parsing
162 // and VM ergonomics processing
163 static void init_globals(void) { // Called from init_globals() in init.cpp
164 init_globals_ext();
165 }
166
167 // File names are case-insensitive on windows only
168 // Override me as needed
169 static int file_name_strcmp(const char* s1, const char* s2);
170
171 // unset environment variable
172 static bool unsetenv(const char* name);
173
174 static bool have_special_privileges();
175
176 static jlong javaTimeMillis();
294 static void trace_page_sizes(const char* str,
295 const size_t region_min_size,
296 const size_t region_max_size,
297 const size_t page_size,
298 const char* base,
299 const size_t size);
300 static void trace_page_sizes_for_requested_size(const char* str,
301 const size_t requested_size,
302 const size_t page_size,
303 const size_t alignment,
304 const char* base,
305 const size_t size);
306
307 static int vm_allocation_granularity();
308 static char* reserve_memory(size_t bytes, char* addr = 0,
309 size_t alignment_hint = 0);
310 static char* reserve_memory(size_t bytes, char* addr,
311 size_t alignment_hint, MEMFLAGS flags);
312 static char* reserve_memory_aligned(size_t size, size_t alignment);
313 static char* attempt_reserve_memory_at(size_t bytes, char* addr);
314 static void split_reserved_memory(char *base, size_t size,
315 size_t split, bool realloc);
316 static bool commit_memory(char* addr, size_t bytes, bool executable);
317 static bool commit_memory(char* addr, size_t size, size_t alignment_hint,
318 bool executable);
319 // Same as commit_memory() that either succeeds or calls
320 // vm_exit_out_of_memory() with the specified mesg.
321 static void commit_memory_or_exit(char* addr, size_t bytes,
322 bool executable, const char* mesg);
323 static void commit_memory_or_exit(char* addr, size_t size,
324 size_t alignment_hint,
325 bool executable, const char* mesg);
326 static bool uncommit_memory(char* addr, size_t bytes);
327 static bool release_memory(char* addr, size_t bytes);
328
329 // Touch memory pages that cover the memory range from start to end (exclusive)
330 // to make the OS back the memory range with actual memory.
331 // Current implementation may not touch the last page if unaligned addresses
332 // are passed.
333 static void pretouch_memory(void* start, void* end);
|
137 bool executable, const char* mesg);
138 static bool pd_uncommit_memory(char* addr, size_t bytes);
139 static bool pd_release_memory(char* addr, size_t bytes);
140
141 static char* pd_map_memory(int fd, const char* file_name, size_t file_offset,
142 char *addr, size_t bytes, bool read_only = false,
143 bool allow_exec = false);
144 static char* pd_remap_memory(int fd, const char* file_name, size_t file_offset,
145 char *addr, size_t bytes, bool read_only,
146 bool allow_exec);
147 static bool pd_unmap_memory(char *addr, size_t bytes);
148 static void pd_free_memory(char *addr, size_t bytes, size_t alignment_hint);
149 static void pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint);
150
151 static size_t page_size_for_region(size_t region_size, size_t min_pages, bool must_be_aligned);
152
153 // Get summary strings for system information in buffer provided
154 static void get_summary_cpu_info(char* buf, size_t buflen);
155 static void get_summary_os_info(char* buf, size_t buflen);
156
157 static int create_tmpfile(const char* dir, size_t size, bool exec);
158 public:
159 static void init(void); // Called before command line parsing
160 static void init_before_ergo(void); // Called after command line parsing
161 // before VM ergonomics processing.
162 static jint init_2(void); // Called after command line parsing
163 // and VM ergonomics processing
164 static void init_globals(void) { // Called from init_globals() in init.cpp
165 init_globals_ext();
166 }
167
168 // File names are case-insensitive on windows only
169 // Override me as needed
170 static int file_name_strcmp(const char* s1, const char* s2);
171
172 // unset environment variable
173 static bool unsetenv(const char* name);
174
175 static bool have_special_privileges();
176
177 static jlong javaTimeMillis();
295 static void trace_page_sizes(const char* str,
296 const size_t region_min_size,
297 const size_t region_max_size,
298 const size_t page_size,
299 const char* base,
300 const size_t size);
301 static void trace_page_sizes_for_requested_size(const char* str,
302 const size_t requested_size,
303 const size_t page_size,
304 const size_t alignment,
305 const char* base,
306 const size_t size);
307
308 static int vm_allocation_granularity();
309 static char* reserve_memory(size_t bytes, char* addr = 0,
310 size_t alignment_hint = 0);
311 static char* reserve_memory(size_t bytes, char* addr,
312 size_t alignment_hint, MEMFLAGS flags);
313 static char* reserve_memory_aligned(size_t size, size_t alignment);
314 static char* attempt_reserve_memory_at(size_t bytes, char* addr);
315
316 // Map the given address range to a temporary file created at the specified directory.
317 // The address range must already be reserved for guaranteed success. If it not reserved, their could be an error while mapping leading to JVM shutdown
318 static bool map_memory_to_file(char* base, size_t size, const char* backing_filename);
319 static void split_reserved_memory(char *base, size_t size,
320 size_t split, bool realloc);
321 static bool commit_memory(char* addr, size_t bytes, bool executable);
322 static bool commit_memory(char* addr, size_t size, size_t alignment_hint,
323 bool executable);
324 // Same as commit_memory() that either succeeds or calls
325 // vm_exit_out_of_memory() with the specified mesg.
326 static void commit_memory_or_exit(char* addr, size_t bytes,
327 bool executable, const char* mesg);
328 static void commit_memory_or_exit(char* addr, size_t size,
329 size_t alignment_hint,
330 bool executable, const char* mesg);
331 static bool uncommit_memory(char* addr, size_t bytes);
332 static bool release_memory(char* addr, size_t bytes);
333
334 // Touch memory pages that cover the memory range from start to end (exclusive)
335 // to make the OS back the memory range with actual memory.
336 // Current implementation may not touch the last page if unaligned addresses
337 // are passed.
338 static void pretouch_memory(void* start, void* end);
|