Mercurial > hg > truffle
comparison src/share/vm/runtime/os.hpp @ 6275:957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 21 Aug 2012 10:39:19 +0200 |
parents | 897b7d18bebc 65906dc96aa1 |
children | e522a00b91aa |
comparison
equal
deleted
inserted
replaced
5891:fd8832ae511d | 6275:957c266d8bc5 |
---|---|
97 static void init_page_sizes(size_t default_page_size) { | 97 static void init_page_sizes(size_t default_page_size) { |
98 _page_sizes[0] = default_page_size; | 98 _page_sizes[0] = default_page_size; |
99 _page_sizes[1] = 0; // sentinel | 99 _page_sizes[1] = 0; // sentinel |
100 } | 100 } |
101 | 101 |
102 static char* pd_reserve_memory(size_t bytes, char* addr = 0, | |
103 size_t alignment_hint = 0); | |
104 static char* pd_attempt_reserve_memory_at(size_t bytes, char* addr); | |
105 static void pd_split_reserved_memory(char *base, size_t size, | |
106 size_t split, bool realloc); | |
107 static bool pd_commit_memory(char* addr, size_t bytes, bool executable = false); | |
108 static bool pd_commit_memory(char* addr, size_t size, size_t alignment_hint, | |
109 bool executable = false); | |
110 static bool pd_uncommit_memory(char* addr, size_t bytes); | |
111 static bool pd_release_memory(char* addr, size_t bytes); | |
112 | |
113 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, | |
115 bool allow_exec = false); | |
116 static char* pd_remap_memory(int fd, const char* file_name, size_t file_offset, | |
117 char *addr, size_t bytes, bool read_only, | |
118 bool allow_exec); | |
119 static bool pd_unmap_memory(char *addr, size_t bytes); | |
120 static void pd_free_memory(char *addr, size_t bytes, size_t alignment_hint); | |
121 static void pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint); | |
122 | |
123 | |
102 public: | 124 public: |
103 static void init(void); // Called before command line parsing | 125 static void init(void); // Called before command line parsing |
104 static jint init_2(void); // Called after command line parsing | 126 static jint init_2(void); // Called after command line parsing |
105 static void init_globals(void) { // Called from init_globals() in init.cpp | 127 static void init_globals(void) { // Called from init_globals() in init.cpp |
106 init_globals_ext(); | 128 init_globals_ext(); |
234 static char* reserve_memory(size_t bytes, char* addr = 0, | 256 static char* reserve_memory(size_t bytes, char* addr = 0, |
235 size_t alignment_hint = 0); | 257 size_t alignment_hint = 0); |
236 static char* attempt_reserve_memory_at(size_t bytes, char* addr); | 258 static char* attempt_reserve_memory_at(size_t bytes, char* addr); |
237 static void split_reserved_memory(char *base, size_t size, | 259 static void split_reserved_memory(char *base, size_t size, |
238 size_t split, bool realloc); | 260 size_t split, bool realloc); |
239 static bool commit_memory(char* addr, size_t bytes, | 261 static bool commit_memory(char* addr, size_t bytes, bool executable = false); |
240 bool executable = false); | |
241 static bool commit_memory(char* addr, size_t size, size_t alignment_hint, | 262 static bool commit_memory(char* addr, size_t size, size_t alignment_hint, |
242 bool executable = false); | 263 bool executable = false); |
243 static bool uncommit_memory(char* addr, size_t bytes); | 264 static bool uncommit_memory(char* addr, size_t bytes); |
244 static bool release_memory(char* addr, size_t bytes); | 265 static bool release_memory(char* addr, size_t bytes); |
245 | 266 |
248 bool is_committed = true); | 269 bool is_committed = true); |
249 | 270 |
250 static bool guard_memory(char* addr, size_t bytes); | 271 static bool guard_memory(char* addr, size_t bytes); |
251 static bool unguard_memory(char* addr, size_t bytes); | 272 static bool unguard_memory(char* addr, size_t bytes); |
252 static bool create_stack_guard_pages(char* addr, size_t bytes); | 273 static bool create_stack_guard_pages(char* addr, size_t bytes); |
274 static bool pd_create_stack_guard_pages(char* addr, size_t bytes); | |
253 static bool remove_stack_guard_pages(char* addr, size_t bytes); | 275 static bool remove_stack_guard_pages(char* addr, size_t bytes); |
254 | 276 |
255 static char* map_memory(int fd, const char* file_name, size_t file_offset, | 277 static char* map_memory(int fd, const char* file_name, size_t file_offset, |
256 char *addr, size_t bytes, bool read_only = false, | 278 char *addr, size_t bytes, bool read_only = false, |
257 bool allow_exec = false); | 279 bool allow_exec = false); |
402 | 424 |
403 static address current_stack_pointer(); | 425 static address current_stack_pointer(); |
404 static address current_stack_base(); | 426 static address current_stack_base(); |
405 static size_t current_stack_size(); | 427 static size_t current_stack_size(); |
406 | 428 |
429 static void verify_stack_alignment() PRODUCT_RETURN; | |
430 | |
407 static int message_box(const char* title, const char* message); | 431 static int message_box(const char* title, const char* message); |
408 static char* do_you_want_to_debug(const char* message); | 432 static char* do_you_want_to_debug(const char* message); |
409 | 433 |
410 // run cmd in a separate process and return its exit code; or -1 on failures | 434 // run cmd in a separate process and return its exit code; or -1 on failures |
411 static int fork_and_exec(char *cmd); | 435 static int fork_and_exec(char *cmd); |
488 static void dll_unload(void *lib); | 512 static void dll_unload(void *lib); |
489 | 513 |
490 // Print out system information; they are called by fatal error handler. | 514 // Print out system information; they are called by fatal error handler. |
491 // Output format may be different on different platforms. | 515 // Output format may be different on different platforms. |
492 static void print_os_info(outputStream* st); | 516 static void print_os_info(outputStream* st); |
517 static void print_os_info_brief(outputStream* st); | |
493 static void print_cpu_info(outputStream* st); | 518 static void print_cpu_info(outputStream* st); |
494 static void pd_print_cpu_info(outputStream* st); | 519 static void pd_print_cpu_info(outputStream* st); |
495 static void print_memory_info(outputStream* st); | 520 static void print_memory_info(outputStream* st); |
496 static void print_dll_info(outputStream* st); | 521 static void print_dll_info(outputStream* st); |
497 static void print_environment_variables(outputStream* st, const char** env_list, char* buffer, int len); | 522 static void print_environment_variables(outputStream* st, const char** env_list, char* buffer, int len); |
568 static int allocate_thread_local_storage(); | 593 static int allocate_thread_local_storage(); |
569 static void thread_local_storage_at_put(int index, void* value); | 594 static void thread_local_storage_at_put(int index, void* value); |
570 static void* thread_local_storage_at(int index); | 595 static void* thread_local_storage_at(int index); |
571 static void free_thread_local_storage(int index); | 596 static void free_thread_local_storage(int index); |
572 | 597 |
598 // Stack walk | |
599 static address get_caller_pc(int n = 0); | |
600 | |
573 // General allocation (must be MT-safe) | 601 // General allocation (must be MT-safe) |
574 static void* malloc (size_t size); | 602 static void* malloc (size_t size, MEMFLAGS flags, address caller_pc = 0); |
575 static void* realloc (void *memblock, size_t size); | 603 static void* realloc (void *memblock, size_t size, MEMFLAGS flags, address caller_pc = 0); |
576 static void free (void *memblock); | 604 static void free (void *memblock, MEMFLAGS flags = mtNone); |
577 static bool check_heap(bool force = false); // verify C heap integrity | 605 static bool check_heap(bool force = false); // verify C heap integrity |
578 static char* strdup(const char *); // Like strdup | 606 static char* strdup(const char *, MEMFLAGS flags = mtInternal); // Like strdup |
579 | 607 |
580 #ifndef PRODUCT | 608 #ifndef PRODUCT |
581 static julong num_mallocs; // # of calls to malloc/realloc | 609 static julong num_mallocs; // # of calls to malloc/realloc |
582 static julong alloc_bytes; // # of bytes allocated | 610 static julong alloc_bytes; // # of bytes allocated |
583 static julong num_frees; // # of calls to free | 611 static julong num_frees; // # of calls to free |
635 static void os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, nmethod* nm, JavaCallArguments* args, Thread* thread); | 663 static void os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, nmethod* nm, JavaCallArguments* args, Thread* thread); |
636 | 664 |
637 // On Windows this will create an actual minidump, on Linux/Solaris it will simply check core dump limits | 665 // On Windows this will create an actual minidump, on Linux/Solaris it will simply check core dump limits |
638 static void check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize); | 666 static void check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize); |
639 | 667 |
668 // Get the default path to the core file | |
669 // Returns the length of the string | |
670 static int get_core_path(char* buffer, size_t bufferSize); | |
671 | |
640 // JVMTI & JVM monitoring and management support | 672 // JVMTI & JVM monitoring and management support |
641 // The thread_cpu_time() and current_thread_cpu_time() are only | 673 // The thread_cpu_time() and current_thread_cpu_time() are only |
642 // supported if is_thread_cpu_time_supported() returns true. | 674 // supported if is_thread_cpu_time_supported() returns true. |
643 // They are not supported on Solaris T1. | 675 // They are not supported on Solaris T1. |
644 | 676 |
681 public: | 713 public: |
682 | 714 |
683 // Platform dependent stuff | 715 // Platform dependent stuff |
684 #ifdef TARGET_OS_FAMILY_linux | 716 #ifdef TARGET_OS_FAMILY_linux |
685 # include "os_linux.hpp" | 717 # include "os_linux.hpp" |
718 # include "os_posix.hpp" | |
686 #endif | 719 #endif |
687 #ifdef TARGET_OS_FAMILY_solaris | 720 #ifdef TARGET_OS_FAMILY_solaris |
688 # include "os_solaris.hpp" | 721 # include "os_solaris.hpp" |
722 # include "os_posix.hpp" | |
689 #endif | 723 #endif |
690 #ifdef TARGET_OS_FAMILY_windows | 724 #ifdef TARGET_OS_FAMILY_windows |
691 # include "os_windows.hpp" | 725 # include "os_windows.hpp" |
692 #endif | 726 #endif |
693 #ifdef TARGET_OS_FAMILY_bsd | 727 #ifdef TARGET_OS_FAMILY_bsd |
728 # include "os_posix.hpp" | |
694 # include "os_bsd.hpp" | 729 # include "os_bsd.hpp" |
695 #endif | 730 #endif |
696 #ifdef TARGET_OS_ARCH_linux_x86 | 731 #ifdef TARGET_OS_ARCH_linux_x86 |
697 # include "os_linux_x86.hpp" | 732 # include "os_linux_x86.hpp" |
698 #endif | 733 #endif |