265 #ifdef _LP64 266 return true; 267 #else 268 if (bytes < 2 * G) { 269 return true; 270 } 271 272 char* addr = reserve_memory(bytes, NULL); 273 274 if (addr != NULL) { 275 release_memory(addr, bytes); 276 } 277 278 return addr != NULL; 279 #endif // _LP64 280 } 281 282 /////////////////////////////////////////////////////////////////////////////// 283 // thread stack 284 285 size_t os::Bsd::min_stack_allowed = 64 * K; 286 287 size_t os::Bsd::default_stack_size(os::ThreadType thr_type) { 288 #ifdef _LP64 289 size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M); 290 #else 291 size_t s = (thr_type == os::compiler_thread ? 2 * M : 512 * K); 292 #endif // _LP64 293 return s; 294 } 295 296 size_t os::Bsd::default_guard_size(os::ThreadType thr_type) { 297 // Only enable glibc guard pages for non-Java threads 298 // (Java threads have HotSpot guard pages) 299 return (thr_type == java_thread ? 0 : page_size()); 300 } 301 302 static void current_stack_region(address *bottom, size_t *size) { 303 address stack_bottom; 304 address stack_top; 305 size_t stack_bytes; 306 307 #ifdef __APPLE__ 308 pthread_t self = pthread_self(); 309 stack_top = (address) pthread_get_stackaddr_np(self); 310 stack_bytes = pthread_get_stacksize_np(self); 311 stack_bottom = stack_top - stack_bytes; 312 #elif defined(__OpenBSD__) 313 stack_t ss; 314 int rslt = pthread_stackseg_np(pthread_self(), &ss); 315 316 if (rslt != 0) 317 fatal("pthread_stackseg_np failed with err = " INT32_FORMAT, rslt); 318 319 stack_top = (address) ss.ss_sp; 320 stack_bytes = ss.ss_size; 321 stack_bottom = stack_top - stack_bytes; | 265 #ifdef _LP64 266 return true; 267 #else 268 if (bytes < 2 * G) { 269 return true; 270 } 271 272 char* addr = reserve_memory(bytes, NULL); 273 274 if (addr != NULL) { 275 release_memory(addr, bytes); 276 } 277 278 return addr != NULL; 279 #endif // _LP64 280 } 281 282 /////////////////////////////////////////////////////////////////////////////// 283 // thread stack 284 285 size_t os::Posix::_compiler_thread_min_stack_allowed = 64 * K; 286 size_t os::Posix::_java_thread_min_stack_allowed = 64 * K; 287 size_t os::Posix::_vm_internal_thread_min_stack_allowed = 64 * K; 288 289 size_t os::Posix::default_stack_size(os::ThreadType thr_type) { 290 #ifdef _LP64 291 size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M); 292 #else 293 size_t s = (thr_type == os::compiler_thread ? 2 * M : 512 * K); 294 #endif // _LP64 295 return s; 296 } 297 298 static void current_stack_region(address *bottom, size_t *size) { 299 address stack_bottom; 300 address stack_top; 301 size_t stack_bytes; 302 303 #ifdef __APPLE__ 304 pthread_t self = pthread_self(); 305 stack_top = (address) pthread_get_stackaddr_np(self); 306 stack_bytes = pthread_get_stacksize_np(self); 307 stack_bottom = stack_top - stack_bytes; 308 #elif defined(__OpenBSD__) 309 stack_t ss; 310 int rslt = pthread_stackseg_np(pthread_self(), &ss); 311 312 if (rslt != 0) 313 fatal("pthread_stackseg_np failed with err = " INT32_FORMAT, rslt); 314 315 stack_top = (address) ss.ss_sp; 316 stack_bytes = ss.ss_size; 317 stack_bottom = stack_top - stack_bytes; |