296 size_t os::Linux::default_stack_size(os::ThreadType thr_type) {
297 #ifdef _LP64
298 size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
299 #else
300 size_t s = (thr_type == os::compiler_thread ? 2 * M : 512 * K);
301 #endif // _LP64
302 return s;
303 }
304
305 size_t os::Linux::default_guard_size(os::ThreadType thr_type) {
306 // Only enable glibc guard pages for non-Java threads
307 // (Java threads have HotSpot guard pages)
308 return (thr_type == java_thread ? 0 : page_size());
309 }
310
311 static void current_stack_region(address *bottom, size_t *size) {
312 pthread_attr_t attr;
313 int res = pthread_getattr_np(pthread_self(), &attr);
314 if (res != 0) {
315 if (res == ENOMEM) {
316 vm_exit_out_of_memory(0, "pthread_getattr_np");
317 }
318 else {
319 fatal(err_msg("pthread_getattr_np failed with errno = %d", res));
320 }
321 }
322
323 address stack_bottom;
324 size_t stack_bytes;
325 res = pthread_attr_getstack(&attr, (void **) &stack_bottom, &stack_bytes);
326 if (res != 0) {
327 fatal(err_msg("pthread_attr_getstack failed with errno = %d", res));
328 }
329 address stack_top = stack_bottom + stack_bytes;
330
331 // The block of memory returned by pthread_attr_getstack() includes
332 // guard pages where present. We need to trim these off.
333 size_t page_bytes = os::Linux::page_size();
334 assert(((intptr_t) stack_bottom & (page_bytes - 1)) == 0, "unaligned stack");
335
336 size_t guard_bytes;
|
296 size_t os::Linux::default_stack_size(os::ThreadType thr_type) {
297 #ifdef _LP64
298 size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
299 #else
300 size_t s = (thr_type == os::compiler_thread ? 2 * M : 512 * K);
301 #endif // _LP64
302 return s;
303 }
304
305 size_t os::Linux::default_guard_size(os::ThreadType thr_type) {
306 // Only enable glibc guard pages for non-Java threads
307 // (Java threads have HotSpot guard pages)
308 return (thr_type == java_thread ? 0 : page_size());
309 }
310
311 static void current_stack_region(address *bottom, size_t *size) {
312 pthread_attr_t attr;
313 int res = pthread_getattr_np(pthread_self(), &attr);
314 if (res != 0) {
315 if (res == ENOMEM) {
316 vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
317 }
318 else {
319 fatal(err_msg("pthread_getattr_np failed with errno = %d", res));
320 }
321 }
322
323 address stack_bottom;
324 size_t stack_bytes;
325 res = pthread_attr_getstack(&attr, (void **) &stack_bottom, &stack_bytes);
326 if (res != 0) {
327 fatal(err_msg("pthread_attr_getstack failed with errno = %d", res));
328 }
329 address stack_top = stack_bottom + stack_bytes;
330
331 // The block of memory returned by pthread_attr_getstack() includes
332 // guard pages where present. We need to trim these off.
333 size_t page_bytes = os::Linux::page_size();
334 assert(((intptr_t) stack_bottom & (page_bytes - 1)) == 0, "unaligned stack");
335
336 size_t guard_bytes;
|