comparison src/share/vm/runtime/os.hpp @ 12355:cefad50507d8

Merge with hs25-b53
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 11 Oct 2013 10:38:03 +0200
parents 6b0fd0964b87 da051ce490eb
children d8041d695d19
comparison
equal deleted inserted replaced
12058:ccb4f2af2319 12355:cefad50507d8
44 #ifdef TARGET_OS_FAMILY_bsd 44 #ifdef TARGET_OS_FAMILY_bsd
45 # include "jvm_bsd.h" 45 # include "jvm_bsd.h"
46 # include <setjmp.h> 46 # include <setjmp.h>
47 #endif 47 #endif
48 48
49 class AgentLibrary;
50
49 // os defines the interface to operating system; this includes traditional 51 // os defines the interface to operating system; this includes traditional
50 // OS services (time, I/O) as well as other functionality with system- 52 // OS services (time, I/O) as well as other functionality with system-
51 // dependent code. 53 // dependent code.
52 54
53 typedef void (*dll_func)(...); 55 typedef void (*dll_func)(...);
87 89
88 // Typedef for structured exception handling support 90 // Typedef for structured exception handling support
89 typedef void (*java_call_t)(JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread); 91 typedef void (*java_call_t)(JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread);
90 92
91 class os: AllStatic { 93 class os: AllStatic {
94 friend class VMStructs;
95
92 public: 96 public:
93 enum { page_sizes_max = 9 }; // Size of _page_sizes array (8 plus a sentinel) 97 enum { page_sizes_max = 9 }; // Size of _page_sizes array (8 plus a sentinel)
94 98
95 private: 99 private:
96 static OSThread* _starting_thread; 100 static OSThread* _starting_thread;
135 static void pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint); 139 static void pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint);
136 140
137 141
138 public: 142 public:
139 static void init(void); // Called before command line parsing 143 static void init(void); // Called before command line parsing
144 static void init_before_ergo(void); // Called after command line parsing
145 // before VM ergonomics processing.
140 static jint init_2(void); // Called after command line parsing 146 static jint init_2(void); // Called after command line parsing
147 // and VM ergonomics processing
141 static void init_globals(void) { // Called from init_globals() in init.cpp 148 static void init_globals(void) { // Called from init_globals() in init.cpp
142 init_globals_ext(); 149 init_globals_ext();
143 } 150 }
144 static void init_3(void); // Called at the end of vm init 151 static void init_3(void); // Called at the end of vm init
145 152
250 // particular, a single page can be used when region_min_size == 257 // particular, a single page can be used when region_min_size ==
251 // region_max_size == a supported page size. 258 // region_max_size == a supported page size.
252 static size_t page_size_for_region(size_t region_min_size, 259 static size_t page_size_for_region(size_t region_min_size,
253 size_t region_max_size, 260 size_t region_max_size,
254 uint min_pages); 261 uint min_pages);
262 // Return the largest page size that can be used
263 static size_t max_page_size() {
264 // The _page_sizes array is sorted in descending order.
265 return _page_sizes[0];
266 }
255 267
256 // Methods for tracing page sizes returned by the above method; enabled by 268 // Methods for tracing page sizes returned by the above method; enabled by
257 // TracePageSizes. The region_{min,max}_size parameters should be the values 269 // TracePageSizes. The region_{min,max}_size parameters should be the values
258 // passed to page_size_for_region() and page_size should be the result of that 270 // passed to page_size_for_region() and page_size should be the result of that
259 // call. The (optional) base and size parameters should come from the 271 // call. The (optional) base and size parameters should come from the
326 static bool get_page_info(char *start, page_info* info); 338 static bool get_page_info(char *start, page_info* info);
327 static char* scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found); 339 static char* scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found);
328 340
329 static char* non_memory_address_word(); 341 static char* non_memory_address_word();
330 // reserve, commit and pin the entire memory region 342 // reserve, commit and pin the entire memory region
331 static char* reserve_memory_special(size_t size, char* addr = NULL, 343 static char* reserve_memory_special(size_t size, size_t alignment,
332 bool executable = false); 344 char* addr, bool executable);
333 static bool release_memory_special(char* addr, size_t bytes); 345 static bool release_memory_special(char* addr, size_t bytes);
334 static void large_page_init(); 346 static void large_page_init();
335 static size_t large_page_size(); 347 static size_t large_page_size();
336 static bool can_commit_large_page_memory(); 348 static bool can_commit_large_page_memory();
337 static bool can_execute_large_page_memory(); 349 static bool can_execute_large_page_memory();
535 static void* dll_lookup(void* handle, const char* name); 547 static void* dll_lookup(void* handle, const char* name);
536 548
537 // Unload library 549 // Unload library
538 static void dll_unload(void *lib); 550 static void dll_unload(void *lib);
539 551
552 // Return the handle of this process
553 static void* get_default_process_handle();
554
555 // Check for static linked agent library
556 static bool find_builtin_agent(AgentLibrary *agent_lib, const char *syms[],
557 size_t syms_len);
558
559 // Find agent entry point
560 static void *find_agent_function(AgentLibrary *agent_lib, bool check_lib,
561 const char *syms[], size_t syms_len);
562
540 // Print out system information; they are called by fatal error handler. 563 // Print out system information; they are called by fatal error handler.
541 // Output format may be different on different platforms. 564 // Output format may be different on different platforms.
542 static void print_os_info(outputStream* st); 565 static void print_os_info(outputStream* st);
543 static void print_os_info_brief(outputStream* st); 566 static void print_os_info_brief(outputStream* st);
544 static void print_cpu_info(outputStream* st); 567 static void print_cpu_info(outputStream* st);
723 static int loadavg(double loadavg[], int nelem); 746 static int loadavg(double loadavg[], int nelem);
724 747
725 // Hook for os specific jvm options that we don't want to abort on seeing 748 // Hook for os specific jvm options that we don't want to abort on seeing
726 static bool obsolete_option(const JavaVMOption *option); 749 static bool obsolete_option(const JavaVMOption *option);
727 750
728 // Read file line by line. If line is longer than bsize,
729 // rest of line is skipped. Returns number of bytes read or -1 on EOF
730 static int get_line_chars(int fd, char *buf, const size_t bsize);
731
732 // Extensions 751 // Extensions
733 #include "runtime/os_ext.hpp" 752 #include "runtime/os_ext.hpp"
734 753
735 public: 754 public:
736 class CrashProtectionCallback : public StackObj { 755 class CrashProtectionCallback : public StackObj {
784 #ifdef TARGET_OS_ARCH_bsd_zero 803 #ifdef TARGET_OS_ARCH_bsd_zero
785 # include "os_bsd_zero.hpp" 804 # include "os_bsd_zero.hpp"
786 #endif 805 #endif
787 806
788 public: 807 public:
808 #ifndef PLATFORM_PRINT_NATIVE_STACK
809 // No platform-specific code for printing the native stack.
810 static bool platform_print_native_stack(outputStream* st, void* context,
811 char *buf, int buf_size) {
812 return false;
813 }
814 #endif
815
789 // debugging support (mostly used by debug.cpp but also fatal error handler) 816 // debugging support (mostly used by debug.cpp but also fatal error handler)
790 static bool find(address pc, outputStream* st = tty); // OS specific function to make sense out of an address 817 static bool find(address pc, outputStream* st = tty); // OS specific function to make sense out of an address
791 818
792 static bool dont_yield(); // when true, JVM_Yield() is nop 819 static bool dont_yield(); // when true, JVM_Yield() is nop
793 static void print_statistics(); 820 static void print_statistics();
803 // Used at creation if requested by the diagnostic flag PauseAtStartup. 830 // Used at creation if requested by the diagnostic flag PauseAtStartup.
804 // Causes the VM to wait until an external stimulus has been applied 831 // Causes the VM to wait until an external stimulus has been applied
805 // (for Unix, that stimulus is a signal, for Windows, an external 832 // (for Unix, that stimulus is a signal, for Windows, an external
806 // ResumeThread call) 833 // ResumeThread call)
807 static void pause(); 834 static void pause();
835
836 // Builds a platform dependent Agent_OnLoad_<libname> function name
837 // which is used to find statically linked in agents.
838 static char* build_agent_function_name(const char *sym, const char *cname,
839 bool is_absolute_path);
808 840
809 class SuspendedThreadTaskContext { 841 class SuspendedThreadTaskContext {
810 public: 842 public:
811 SuspendedThreadTaskContext(Thread* thread, void *ucontext) : _thread(thread), _ucontext(ucontext) {} 843 SuspendedThreadTaskContext(Thread* thread, void *ucontext) : _thread(thread), _ucontext(ucontext) {}
812 Thread* thread() const { return _thread; } 844 Thread* thread() const { return _thread; }