118 // Same as pd_commit_memory() that either succeeds or calls 119 // vm_exit_out_of_memory() with the specified mesg. 120 static void pd_commit_memory_or_exit(char* addr, size_t bytes, 121 bool executable, const char* mesg); 122 static void pd_commit_memory_or_exit(char* addr, size_t size, 123 size_t alignment_hint, 124 bool executable, const char* mesg); 125 static bool pd_uncommit_memory(char* addr, size_t bytes); 126 static bool pd_release_memory(char* addr, size_t bytes); 127 128 static char* pd_map_memory(int fd, const char* file_name, size_t file_offset, 129 char *addr, size_t bytes, bool read_only = false, 130 bool allow_exec = false); 131 static char* pd_remap_memory(int fd, const char* file_name, size_t file_offset, 132 char *addr, size_t bytes, bool read_only, 133 bool allow_exec); 134 static bool pd_unmap_memory(char *addr, size_t bytes); 135 static void pd_free_memory(char *addr, size_t bytes, size_t alignment_hint); 136 static void pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint); 137 138 static size_t page_size_for_region(size_t region_size, size_t min_pages, bool must_be_aligned); 139 140 // Get summary strings for system information in buffer provided 141 static void get_summary_cpu_info(char* buf, size_t buflen); 142 static void get_summary_os_info(char* buf, size_t buflen); 143 144 static void initialize_initial_active_processor_count(); 145 146 LINUX_ONLY(static void pd_init_container_support();) 147 148 public: 149 static void init(void); // Called before command line parsing 150 151 static void init_container_support() { // Called during command line parsing. 152 LINUX_ONLY(pd_init_container_support();) 153 } 154 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 250 // first you generate a distribution of processes to processors, 251 // then you bind processes according to that distribution. 252 // Compute a distribution for number of processes to processors. 253 // Stores the processor id's into the distribution array argument. 254 // Returns true if it worked, false if it didn't. 255 static bool distribute_processes(uint length, uint* distribution); 256 // Binds the current process to a processor. 257 // Returns true if it worked, false if it didn't. 258 static bool bind_to_processor(uint processor_id); 259 260 // Give a name to the current thread. 261 static void set_native_thread_name(const char *name); 262 263 // Interface for stack banging (predetect possible stack overflow for 264 // exception processing) There are guard pages, and above that shadow 265 // pages for stack overflow checking. 266 static bool uses_stack_guard_pages(); 267 static bool must_commit_stack_guard_pages(); 268 static void map_stack_shadow_pages(address sp); 269 static bool stack_shadow_pages_available(Thread *thread, const methodHandle& method, address sp); 270 271 // OS interface to Virtual Memory 272 273 // Return the default page size. 274 static int vm_page_size(); 275 276 // Returns the page size to use for a region of memory. 277 // region_size / min_pages will always be greater than or equal to the 278 // returned value. The returned value will divide region_size. 279 static size_t page_size_for_region_aligned(size_t region_size, size_t min_pages); 280 281 // Returns the page size to use for a region of memory. 282 // region_size / min_pages will always be greater than or equal to the 283 // returned value. The returned value might not divide region_size. 284 static size_t page_size_for_region_unaligned(size_t region_size, size_t min_pages); 285 286 // Return the largest page size that can be used 287 static size_t max_page_size() { 288 // The _page_sizes array is sorted in descending order. 289 return _page_sizes[0]; | 118 // Same as pd_commit_memory() that either succeeds or calls 119 // vm_exit_out_of_memory() with the specified mesg. 120 static void pd_commit_memory_or_exit(char* addr, size_t bytes, 121 bool executable, const char* mesg); 122 static void pd_commit_memory_or_exit(char* addr, size_t size, 123 size_t alignment_hint, 124 bool executable, const char* mesg); 125 static bool pd_uncommit_memory(char* addr, size_t bytes); 126 static bool pd_release_memory(char* addr, size_t bytes); 127 128 static char* pd_map_memory(int fd, const char* file_name, size_t file_offset, 129 char *addr, size_t bytes, bool read_only = false, 130 bool allow_exec = false); 131 static char* pd_remap_memory(int fd, const char* file_name, size_t file_offset, 132 char *addr, size_t bytes, bool read_only, 133 bool allow_exec); 134 static bool pd_unmap_memory(char *addr, size_t bytes); 135 static void pd_free_memory(char *addr, size_t bytes, size_t alignment_hint); 136 static void pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint); 137 138 static size_t pd_committed_stack_size(address bottom, size_t size); 139 140 static size_t page_size_for_region(size_t region_size, size_t min_pages, bool must_be_aligned); 141 142 // Get summary strings for system information in buffer provided 143 static void get_summary_cpu_info(char* buf, size_t buflen); 144 static void get_summary_os_info(char* buf, size_t buflen); 145 146 static void initialize_initial_active_processor_count(); 147 148 LINUX_ONLY(static void pd_init_container_support();) 149 150 public: 151 static void init(void); // Called before command line parsing 152 153 static void init_container_support() { // Called during command line parsing. 154 LINUX_ONLY(pd_init_container_support();) 155 } 156 157 static void init_before_ergo(void); // Called after command line parsing 158 // before VM ergonomics processing. 159 static jint init_2(void); // Called after command line parsing 252 // first you generate a distribution of processes to processors, 253 // then you bind processes according to that distribution. 254 // Compute a distribution for number of processes to processors. 255 // Stores the processor id's into the distribution array argument. 256 // Returns true if it worked, false if it didn't. 257 static bool distribute_processes(uint length, uint* distribution); 258 // Binds the current process to a processor. 259 // Returns true if it worked, false if it didn't. 260 static bool bind_to_processor(uint processor_id); 261 262 // Give a name to the current thread. 263 static void set_native_thread_name(const char *name); 264 265 // Interface for stack banging (predetect possible stack overflow for 266 // exception processing) There are guard pages, and above that shadow 267 // pages for stack overflow checking. 268 static bool uses_stack_guard_pages(); 269 static bool must_commit_stack_guard_pages(); 270 static void map_stack_shadow_pages(address sp); 271 static bool stack_shadow_pages_available(Thread *thread, const methodHandle& method, address sp); 272 273 // Return size of stack that is actually committed. For Java thread, the bottom should be above 274 // guard pages (stack grows downward) 275 static size_t committed_stack_size(address bottom, size_t size); 276 277 // OS interface to Virtual Memory 278 279 // Return the default page size. 280 static int vm_page_size(); 281 282 // Returns the page size to use for a region of memory. 283 // region_size / min_pages will always be greater than or equal to the 284 // returned value. The returned value will divide region_size. 285 static size_t page_size_for_region_aligned(size_t region_size, size_t min_pages); 286 287 // Returns the page size to use for a region of memory. 288 // region_size / min_pages will always be greater than or equal to the 289 // returned value. The returned value might not divide region_size. 290 static size_t page_size_for_region_unaligned(size_t region_size, size_t min_pages); 291 292 // Return the largest page size that can be used 293 static size_t max_page_size() { 294 // The _page_sizes array is sorted in descending order. 295 return _page_sizes[0]; |