100 // Returns the byte size of a virtual memory page 101 static int vm_page_size() { return _vm_page_size; } 102 103 // Returns the size in bytes of memory blocks which can be allocated. 104 static int vm_allocation_granularity() { return _vm_allocation_granularity; } 105 106 // Read the headers for the executable that started the current process into 107 // the structure passed in (see winnt.h). 108 static void read_executable_headers(PIMAGE_NT_HEADERS); 109 110 // Default stack size for the current process. 111 static size_t default_stack_size() { return _default_stack_size; } 112 113 #ifndef _WIN64 114 // A wrapper to install a structured exception handler for fast JNI accesors. 115 static address fast_jni_accessor_wrapper(BasicType); 116 #endif 117 118 // filter function to ignore faults on serializations page 119 static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e); 120 }; 121 122 /* 123 * Crash protection for the watcher thread. Wrap the callback 124 * with a __try { call() } 125 * To be able to use this - don't take locks, don't rely on destructors, 126 * don't make OS library calls, don't allocate memory, don't print, 127 * don't call code that could leave the heap / memory in an inconsistent state, 128 * or anything else where we are not in control if we suddenly jump out. 129 */ 130 class WatcherThreadCrashProtection : public StackObj { 131 public: 132 WatcherThreadCrashProtection(); 133 bool call(os::CrashProtectionCallback& cb); 134 }; 135 136 class PlatformEvent : public CHeapObj<mtInternal> { 137 private: 138 double CachePad [4] ; // increase odds that _Event is sole occupant of cache line 139 volatile int _Event ; | 100 // Returns the byte size of a virtual memory page 101 static int vm_page_size() { return _vm_page_size; } 102 103 // Returns the size in bytes of memory blocks which can be allocated. 104 static int vm_allocation_granularity() { return _vm_allocation_granularity; } 105 106 // Read the headers for the executable that started the current process into 107 // the structure passed in (see winnt.h). 108 static void read_executable_headers(PIMAGE_NT_HEADERS); 109 110 // Default stack size for the current process. 111 static size_t default_stack_size() { return _default_stack_size; } 112 113 #ifndef _WIN64 114 // A wrapper to install a structured exception handler for fast JNI accesors. 115 static address fast_jni_accessor_wrapper(BasicType); 116 #endif 117 118 // filter function to ignore faults on serializations page 119 static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e); 120 121 // Fast access to current thread 122 protected: 123 static int _thread_ptr_offset; 124 private: 125 static void initialize_thread_ptr_offset(); 126 public: 127 static inline void set_thread_ptr_offset(int offset) { 128 _thread_ptr_offset = offset; 129 } 130 static inline int get_thread_ptr_offset() { return _thread_ptr_offset; } 131 }; 132 133 /* 134 * Crash protection for the watcher thread. Wrap the callback 135 * with a __try { call() } 136 * To be able to use this - don't take locks, don't rely on destructors, 137 * don't make OS library calls, don't allocate memory, don't print, 138 * don't call code that could leave the heap / memory in an inconsistent state, 139 * or anything else where we are not in control if we suddenly jump out. 140 */ 141 class WatcherThreadCrashProtection : public StackObj { 142 public: 143 WatcherThreadCrashProtection(); 144 bool call(os::CrashProtectionCallback& cb); 145 }; 146 147 class PlatformEvent : public CHeapObj<mtInternal> { 148 private: 149 double CachePad [4] ; // increase odds that _Event is sole occupant of cache line 150 volatile int _Event ; |