132 // Same as pd_commit_memory() that either succeeds or calls
133 // vm_exit_out_of_memory() with the specified mesg.
134 static void pd_commit_memory_or_exit(char* addr, size_t bytes,
135 bool executable, const char* mesg);
136 static void pd_commit_memory_or_exit(char* addr, size_t size,
137 size_t alignment_hint,
138 bool executable, const char* mesg);
139 static bool pd_uncommit_memory(char* addr, size_t bytes);
140 static bool pd_release_memory(char* addr, size_t bytes);
141
142 static char* pd_map_memory(int fd, const char* file_name, size_t file_offset,
143 char *addr, size_t bytes, bool read_only = false,
144 bool allow_exec = false);
145 static char* pd_remap_memory(int fd, const char* file_name, size_t file_offset,
146 char *addr, size_t bytes, bool read_only,
147 bool allow_exec);
148 static bool pd_unmap_memory(char *addr, size_t bytes);
149 static void pd_free_memory(char *addr, size_t bytes, size_t alignment_hint);
150 static void pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint);
151
152
153 public:
154 static void init(void); // Called before command line parsing
155 static void init_before_ergo(void); // Called after command line parsing
156 // before VM ergonomics processing.
157 static jint init_2(void); // Called after command line parsing
158 // and VM ergonomics processing
159 static void init_globals(void) { // Called from init_globals() in init.cpp
160 init_globals_ext();
161 }
162
163 // File names are case-insensitive on windows only
164 // Override me as needed
165 static int file_name_strcmp(const char* s1, const char* s2);
166
167 // get/unset environment variable
168 static bool getenv(const char* name, char* buffer, int len);
169 static bool unsetenv(const char* name);
170
171 static bool have_special_privileges();
250 static bool bind_to_processor(uint processor_id);
251
252 // Give a name to the current thread.
253 static void set_native_thread_name(const char *name);
254
255 // Interface for stack banging (predetect possible stack overflow for
256 // exception processing) There are guard pages, and above that shadow
257 // pages for stack overflow checking.
258 static bool uses_stack_guard_pages();
259 static bool allocate_stack_guard_pages();
260 static void bang_stack_shadow_pages();
261 static bool stack_shadow_pages_available(Thread *thread, methodHandle method);
262
263 // OS interface to Virtual Memory
264
265 // Return the default page size.
266 static int vm_page_size();
267
268 // Returns the page size to use for a region of memory.
269 // region_size / min_pages will always be greater than or equal to the
270 // returned value.
271 static size_t page_size_for_region(size_t region_size, size_t min_pages);
272
273 // Return the largest page size that can be used
274 static size_t max_page_size() {
275 // The _page_sizes array is sorted in descending order.
276 return _page_sizes[0];
277 }
278
279 // Methods for tracing page sizes returned by the above method; enabled by
280 // TracePageSizes. The region_{min,max}_size parameters should be the values
281 // passed to page_size_for_region() and page_size should be the result of that
282 // call. The (optional) base and size parameters should come from the
283 // ReservedSpace base() and size() methods.
284 static void trace_page_sizes(const char* str, const size_t* page_sizes,
285 int count) PRODUCT_RETURN;
286 static void trace_page_sizes(const char* str, const size_t region_min_size,
287 const size_t region_max_size,
288 const size_t page_size,
289 const char* base = NULL,
290 const size_t size = 0) PRODUCT_RETURN;
291
|
132 // Same as pd_commit_memory() that either succeeds or calls
133 // vm_exit_out_of_memory() with the specified mesg.
134 static void pd_commit_memory_or_exit(char* addr, size_t bytes,
135 bool executable, const char* mesg);
136 static void pd_commit_memory_or_exit(char* addr, size_t size,
137 size_t alignment_hint,
138 bool executable, const char* mesg);
139 static bool pd_uncommit_memory(char* addr, size_t bytes);
140 static bool pd_release_memory(char* addr, size_t bytes);
141
142 static char* pd_map_memory(int fd, const char* file_name, size_t file_offset,
143 char *addr, size_t bytes, bool read_only = false,
144 bool allow_exec = false);
145 static char* pd_remap_memory(int fd, const char* file_name, size_t file_offset,
146 char *addr, size_t bytes, bool read_only,
147 bool allow_exec);
148 static bool pd_unmap_memory(char *addr, size_t bytes);
149 static void pd_free_memory(char *addr, size_t bytes, size_t alignment_hint);
150 static void pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint);
151
152 static size_t page_size_for_region(size_t region_size, size_t min_pages, bool must_be_aligned);
153
154 public:
155 static void init(void); // Called before command line parsing
156 static void init_before_ergo(void); // Called after command line parsing
157 // before VM ergonomics processing.
158 static jint init_2(void); // Called after command line parsing
159 // and VM ergonomics processing
160 static void init_globals(void) { // Called from init_globals() in init.cpp
161 init_globals_ext();
162 }
163
164 // File names are case-insensitive on windows only
165 // Override me as needed
166 static int file_name_strcmp(const char* s1, const char* s2);
167
168 // get/unset environment variable
169 static bool getenv(const char* name, char* buffer, int len);
170 static bool unsetenv(const char* name);
171
172 static bool have_special_privileges();
251 static bool bind_to_processor(uint processor_id);
252
253 // Give a name to the current thread.
254 static void set_native_thread_name(const char *name);
255
256 // Interface for stack banging (predetect possible stack overflow for
257 // exception processing) There are guard pages, and above that shadow
258 // pages for stack overflow checking.
259 static bool uses_stack_guard_pages();
260 static bool allocate_stack_guard_pages();
261 static void bang_stack_shadow_pages();
262 static bool stack_shadow_pages_available(Thread *thread, methodHandle method);
263
264 // OS interface to Virtual Memory
265
266 // Return the default page size.
267 static int vm_page_size();
268
269 // Returns the page size to use for a region of memory.
270 // region_size / min_pages will always be greater than or equal to the
271 // returned value. The returned value will divide region_size.
272 static size_t page_size_for_region_aligned(size_t region_size, size_t min_pages);
273
274 // Returns the page size to use for a region of memory.
275 // region_size / min_pages will always be greater than or equal to the
276 // returned value. The returned value might not divide region_size.
277 static size_t page_size_for_region_unaligned(size_t region_size, size_t min_pages);
278
279 // Return the largest page size that can be used
280 static size_t max_page_size() {
281 // The _page_sizes array is sorted in descending order.
282 return _page_sizes[0];
283 }
284
285 // Methods for tracing page sizes returned by the above method; enabled by
286 // TracePageSizes. The region_{min,max}_size parameters should be the values
287 // passed to page_size_for_region() and page_size should be the result of that
288 // call. The (optional) base and size parameters should come from the
289 // ReservedSpace base() and size() methods.
290 static void trace_page_sizes(const char* str, const size_t* page_sizes,
291 int count) PRODUCT_RETURN;
292 static void trace_page_sizes(const char* str, const size_t region_min_size,
293 const size_t region_max_size,
294 const size_t page_size,
295 const char* base = NULL,
296 const size_t size = 0) PRODUCT_RETURN;
297
|