5859 // NOTE: This is no longer needed in the 1.3.1 and 1.4 production release 5860 // libraries and should thus be removed. We will leave it behind for a while 5861 // until we no longer want to able to run on top of 1.3.0 Solaris production 5862 // JDK. See 4341971. 5863 5864 #define STACK_SLACK 0x800 5865 5866 extern "C" { 5867 intptr_t sysThreadAvailableStackWithSlack() { 5868 stack_t st; 5869 intptr_t retval, stack_top; 5870 retval = thr_stksegment(&st); 5871 assert(retval == 0, "incorrect return value from thr_stksegment"); 5872 assert((address)&st < (address)st.ss_sp, "Invalid stack base returned"); 5873 assert((address)&st > (address)st.ss_sp-st.ss_size, "Invalid stack size returned"); 5874 stack_top=(intptr_t)st.ss_sp-st.ss_size; 5875 return ((intptr_t)&stack_top - stack_top - STACK_SLACK); 5876 } 5877 } 5878 5879 // Just to get the Kernel build to link on solaris for testing. 5880 5881 extern "C" { 5882 class ASGCT_CallTrace; 5883 void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) 5884 KERNEL_RETURN; 5885 } 5886 5887 5888 // ObjectMonitor park-unpark infrastructure ... 5889 // 5890 // We implement Solaris and Linux PlatformEvents with the 5891 // obvious condvar-mutex-flag triple. 5892 // Another alternative that works quite well is pipes: 5893 // Each PlatformEvent consists of a pipe-pair. 5894 // The thread associated with the PlatformEvent 5895 // calls park(), which reads from the input end of the pipe. 5896 // Unpark() writes into the other end of the pipe. 5897 // The write-side of the pipe must be set NDELAY. 5898 // Unfortunately pipes consume a large # of handles. 5899 // Native solaris lwp_park() and lwp_unpark() work nicely, too. 5900 // Using pipes for the 1st few threads might be workable, however. 5901 // 5902 // park() is permitted to return spuriously. 5903 // Callers of park() should wrap the call to park() in 5904 // an appropriate loop. A litmus test for the correct 5905 // usage of park is the following: if park() were modified 5906 // to immediately return 0 your code should still work, 5907 // albeit degenerating to a spin loop. | 5859 // NOTE: This is no longer needed in the 1.3.1 and 1.4 production release 5860 // libraries and should thus be removed. We will leave it behind for a while 5861 // until we no longer want to able to run on top of 1.3.0 Solaris production 5862 // JDK. See 4341971. 5863 5864 #define STACK_SLACK 0x800 5865 5866 extern "C" { 5867 intptr_t sysThreadAvailableStackWithSlack() { 5868 stack_t st; 5869 intptr_t retval, stack_top; 5870 retval = thr_stksegment(&st); 5871 assert(retval == 0, "incorrect return value from thr_stksegment"); 5872 assert((address)&st < (address)st.ss_sp, "Invalid stack base returned"); 5873 assert((address)&st > (address)st.ss_sp-st.ss_size, "Invalid stack size returned"); 5874 stack_top=(intptr_t)st.ss_sp-st.ss_size; 5875 return ((intptr_t)&stack_top - stack_top - STACK_SLACK); 5876 } 5877 } 5878 5879 // ObjectMonitor park-unpark infrastructure ... 5880 // 5881 // We implement Solaris and Linux PlatformEvents with the 5882 // obvious condvar-mutex-flag triple. 5883 // Another alternative that works quite well is pipes: 5884 // Each PlatformEvent consists of a pipe-pair. 5885 // The thread associated with the PlatformEvent 5886 // calls park(), which reads from the input end of the pipe. 5887 // Unpark() writes into the other end of the pipe. 5888 // The write-side of the pipe must be set NDELAY. 5889 // Unfortunately pipes consume a large # of handles. 5890 // Native solaris lwp_park() and lwp_unpark() work nicely, too. 5891 // Using pipes for the 1st few threads might be workable, however. 5892 // 5893 // park() is permitted to return spuriously. 5894 // Callers of park() should wrap the call to park() in 5895 // an appropriate loop. A litmus test for the correct 5896 // usage of park is the following: if park() were modified 5897 // to immediately return 0 your code should still work, 5898 // albeit degenerating to a spin loop. |