< prev index next >

src/share/vm/runtime/os.hpp

Print this page
rev 7654 : 8066875: VirtualSpace does not use large pages
rev 7655 : 8066875: VirtualSpace does not use large pages (01)


 131   // Same as pd_commit_memory() that either succeeds or calls
 132   // vm_exit_out_of_memory() with the specified mesg.
 133   static void   pd_commit_memory_or_exit(char* addr, size_t bytes,
 134                                          bool executable, const char* mesg);
 135   static void   pd_commit_memory_or_exit(char* addr, size_t size,
 136                                          size_t alignment_hint,
 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 
 152  public:
 153   static void init(void);                      // Called before command line parsing
 154   static void init_before_ergo(void);          // Called after command line parsing
 155                                                // before VM ergonomics processing.
 156   static jint init_2(void);                    // Called after command line parsing
 157                                                // and VM ergonomics processing
 158   static void init_globals(void) {             // Called from init_globals() in init.cpp
 159     init_globals_ext();
 160   }
 161 
 162   // File names are case-insensitive on windows only
 163   // Override me as needed
 164   static int    file_name_strcmp(const char* s1, const char* s2);
 165 
 166   // get/unset environment variable
 167   static bool getenv(const char* name, char* buffer, int len);
 168   static bool unsetenv(const char* name);
 169 
 170   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 




 131   // Same as pd_commit_memory() that either succeeds or calls
 132   // vm_exit_out_of_memory() with the specified mesg.
 133   static void   pd_commit_memory_or_exit(char* addr, size_t bytes,
 134                                          bool executable, const char* mesg);
 135   static void   pd_commit_memory_or_exit(char* addr, size_t size,
 136                                          size_t alignment_hint,
 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  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();


 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 


< prev index next >