5780 if ( os::Solaris::T2_libthread() || UseBoundThreads ) {
5781 return true;
5782 } else {
5783 return false;
5784 }
5785 }
5786
5787 // System loadavg support. Returns -1 if load average cannot be obtained.
5788 // Return the load average for our processor set if the primitive exists
5789 // (Solaris 9 and later). Otherwise just return system wide loadavg.
5790 int os::loadavg(double loadavg[], int nelem) {
5791 if (pset_getloadavg_ptr != NULL) {
5792 return (*pset_getloadavg_ptr)(PS_MYID, loadavg, nelem);
5793 } else {
5794 return ::getloadavg(loadavg, nelem);
5795 }
5796 }
5797
5798 //---------------------------------------------------------------------------------
5799
5800 static address same_page(address x, address y) {
5801 intptr_t page_bits = -os::vm_page_size();
5802 if ((intptr_t(x) & page_bits) == (intptr_t(y) & page_bits))
5803 return x;
5804 else if (x > y)
5805 return (address)(intptr_t(y) | ~page_bits) + 1;
5806 else
5807 return (address)(intptr_t(y) & page_bits);
5808 }
5809
5810 bool os::find(address addr, outputStream* st) {
5811 Dl_info dlinfo;
5812 memset(&dlinfo, 0, sizeof(dlinfo));
5813 if (dladdr(addr, &dlinfo)) {
5814 #ifdef _LP64
5815 st->print("0x%016lx: ", addr);
5816 #else
5817 st->print("0x%08x: ", addr);
5818 #endif
5819 if (dlinfo.dli_sname != NULL)
5820 st->print("%s+%#lx", dlinfo.dli_sname, addr-(intptr_t)dlinfo.dli_saddr);
5821 else if (dlinfo.dli_fname)
5822 st->print("<offset %#lx>", addr-(intptr_t)dlinfo.dli_fbase);
5823 else
5824 st->print("<absolute address>");
5825 if (dlinfo.dli_fname) st->print(" in %s", dlinfo.dli_fname);
5826 #ifdef _LP64
5827 if (dlinfo.dli_fbase) st->print(" at 0x%016lx", dlinfo.dli_fbase);
5828 #else
5829 if (dlinfo.dli_fbase) st->print(" at 0x%08x", dlinfo.dli_fbase);
5830 #endif
5831 st->cr();
5832
5833 if (Verbose) {
5834 // decode some bytes around the PC
5835 address begin = same_page(addr-40, addr);
5836 address end = same_page(addr+40, addr);
5837 address lowest = (address) dlinfo.dli_sname;
5838 if (!lowest) lowest = (address) dlinfo.dli_fbase;
5839 if (begin < lowest) begin = lowest;
5840 Dl_info dlinfo2;
5841 if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr
5842 && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin)
5843 end = (address) dlinfo2.dli_saddr;
5844 Disassembler::decode(begin, end, st);
5845 }
5846 return true;
5847 }
5848 return false;
5849 }
5850
5851 // Following function has been added to support HotSparc's libjvm.so running
5852 // under Solaris production JDK 1.2.2 / 1.3.0. These came from
5853 // src/solaris/hpi/native_threads in the EVM codebase.
5854 //
5855 // NOTE: This is no longer needed in the 1.3.1 and 1.4 production release
5856 // libraries and should thus be removed. We will leave it behind for a while
|
5780 if ( os::Solaris::T2_libthread() || UseBoundThreads ) {
5781 return true;
5782 } else {
5783 return false;
5784 }
5785 }
5786
5787 // System loadavg support. Returns -1 if load average cannot be obtained.
5788 // Return the load average for our processor set if the primitive exists
5789 // (Solaris 9 and later). Otherwise just return system wide loadavg.
5790 int os::loadavg(double loadavg[], int nelem) {
5791 if (pset_getloadavg_ptr != NULL) {
5792 return (*pset_getloadavg_ptr)(PS_MYID, loadavg, nelem);
5793 } else {
5794 return ::getloadavg(loadavg, nelem);
5795 }
5796 }
5797
5798 //---------------------------------------------------------------------------------
5799
5800 bool os::find(address addr, outputStream* st) {
5801 Dl_info dlinfo;
5802 memset(&dlinfo, 0, sizeof(dlinfo));
5803 if (dladdr(addr, &dlinfo)) {
5804 #ifdef _LP64
5805 st->print("0x%016lx: ", addr);
5806 #else
5807 st->print("0x%08x: ", addr);
5808 #endif
5809 if (dlinfo.dli_sname != NULL)
5810 st->print("%s+%#lx", dlinfo.dli_sname, addr-(intptr_t)dlinfo.dli_saddr);
5811 else if (dlinfo.dli_fname)
5812 st->print("<offset %#lx>", addr-(intptr_t)dlinfo.dli_fbase);
5813 else
5814 st->print("<absolute address>");
5815 if (dlinfo.dli_fname) st->print(" in %s", dlinfo.dli_fname);
5816 #ifdef _LP64
5817 if (dlinfo.dli_fbase) st->print(" at 0x%016lx", dlinfo.dli_fbase);
5818 #else
5819 if (dlinfo.dli_fbase) st->print(" at 0x%08x", dlinfo.dli_fbase);
5820 #endif
5821 st->cr();
5822
5823 if (Verbose) {
5824 // decode some bytes around the PC
5825 address begin = clamp_address_in_page(addr-40, addr);
5826 address end = clamp_address_in_page(addr+40, addr);
5827 address lowest = (address) dlinfo.dli_sname;
5828 if (!lowest) lowest = (address) dlinfo.dli_fbase;
5829 if (begin < lowest) begin = lowest;
5830 Dl_info dlinfo2;
5831 if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr
5832 && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin)
5833 end = (address) dlinfo2.dli_saddr;
5834 Disassembler::decode(begin, end, st);
5835 }
5836 return true;
5837 }
5838 return false;
5839 }
5840
5841 // Following function has been added to support HotSparc's libjvm.so running
5842 // under Solaris production JDK 1.2.2 / 1.3.0. These came from
5843 // src/solaris/hpi/native_threads in the EVM codebase.
5844 //
5845 // NOTE: This is no longer needed in the 1.3.1 and 1.4 production release
5846 // libraries and should thus be removed. We will leave it behind for a while
|