< prev index next >

src/hotspot/os/linux/os_linux.cpp

Print this page
rev 58072 : [mq]: v2


 700   // will alloca() a little more space than necessary, which is OK. Don't use
 701   // os::current_stack_pointer(), as its result can be slightly below current
 702   // stack pointer, causing us to not alloca enough to reach "bottom".
 703   sp = (address)&sp;
 704 
 705   if (sp > bottom) {
 706     size = sp - bottom;
 707     p = (volatile char *)alloca(size);
 708     assert(p != NULL && p <= (volatile char *)bottom, "alloca problem?");
 709     p[0] = '\0';
 710   }
 711 }
 712 
 713 void os::Linux::expand_stack_to(address bottom) {
 714   _expand_stack_to(bottom);
 715 }
 716 
 717 bool os::Linux::manually_expand_stack(JavaThread * t, address addr) {
 718   assert(t!=NULL, "just checking");
 719   assert(t->osthread()->expanding_stack(), "expand should be set");
 720   assert(t->stack_base() != NULL, "stack_base was not initialized");
 721 
 722   if (t->is_in_usable_stack(addr)) {
 723     sigset_t mask_all, old_sigset;
 724     sigfillset(&mask_all);
 725     pthread_sigmask(SIG_SETMASK, &mask_all, &old_sigset);
 726     _expand_stack_to(addr);
 727     pthread_sigmask(SIG_SETMASK, &old_sigset, NULL);
 728     return true;
 729   }
 730   return false;
 731 }
 732 
 733 //////////////////////////////////////////////////////////////////////////////
 734 // create new thread
 735 
 736 // Thread start routine for all newly created threads
 737 static void *thread_native_entry(Thread *thread) {
 738 
 739   thread->record_stack_base_and_size();
 740 




 700   // will alloca() a little more space than necessary, which is OK. Don't use
 701   // os::current_stack_pointer(), as its result can be slightly below current
 702   // stack pointer, causing us to not alloca enough to reach "bottom".
 703   sp = (address)&sp;
 704 
 705   if (sp > bottom) {
 706     size = sp - bottom;
 707     p = (volatile char *)alloca(size);
 708     assert(p != NULL && p <= (volatile char *)bottom, "alloca problem?");
 709     p[0] = '\0';
 710   }
 711 }
 712 
 713 void os::Linux::expand_stack_to(address bottom) {
 714   _expand_stack_to(bottom);
 715 }
 716 
 717 bool os::Linux::manually_expand_stack(JavaThread * t, address addr) {
 718   assert(t!=NULL, "just checking");
 719   assert(t->osthread()->expanding_stack(), "expand should be set");

 720 
 721   if (t->is_in_usable_stack(addr)) {
 722     sigset_t mask_all, old_sigset;
 723     sigfillset(&mask_all);
 724     pthread_sigmask(SIG_SETMASK, &mask_all, &old_sigset);
 725     _expand_stack_to(addr);
 726     pthread_sigmask(SIG_SETMASK, &old_sigset, NULL);
 727     return true;
 728   }
 729   return false;
 730 }
 731 
 732 //////////////////////////////////////////////////////////////////////////////
 733 // create new thread
 734 
 735 // Thread start routine for all newly created threads
 736 static void *thread_native_entry(Thread *thread) {
 737 
 738   thread->record_stack_base_and_size();
 739 


< prev index next >