comparison src/os/bsd/vm/os_bsd.cpp @ 9062:8be1318fbe77

Merge
author dcubed
date Fri, 05 Apr 2013 10:38:08 -0700
parents 754c24457b20 cc32ccaaf47f
children 89e4d67fdd2a f32b6c267d2e e12c9b3740db
comparison
equal deleted inserted replaced
9055:dcdeb150988c 9062:8be1318fbe77
150 150
151 //////////////////////////////////////////////////////////////////////////////// 151 ////////////////////////////////////////////////////////////////////////////////
152 // utility functions 152 // utility functions
153 153
154 static int SR_initialize(); 154 static int SR_initialize();
155 static int SR_finalize();
156 155
157 julong os::available_memory() { 156 julong os::available_memory() {
158 return Bsd::available_memory(); 157 return Bsd::available_memory();
159 } 158 }
160 159
1198 snprintf(buffer, buflen, JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, fname); 1197 snprintf(buffer, buflen, JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, fname);
1199 retval = true; 1198 retval = true;
1200 } else if (strchr(pname, *os::path_separator()) != NULL) { 1199 } else if (strchr(pname, *os::path_separator()) != NULL) {
1201 int n; 1200 int n;
1202 char** pelements = split_path(pname, &n); 1201 char** pelements = split_path(pname, &n);
1202 if (pelements == NULL) {
1203 return false;
1204 }
1203 for (int i = 0 ; i < n ; i++) { 1205 for (int i = 0 ; i < n ; i++) {
1204 // Really shouldn't be NULL, but check can't hurt 1206 // Really shouldn't be NULL, but check can't hurt
1205 if (pelements[i] == NULL || strlen(pelements[i]) == 0) { 1207 if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
1206 continue; // skip the empty path values 1208 continue; // skip the empty path values
1207 } 1209 }
2764 // Save signal flag 2766 // Save signal flag
2765 os::Bsd::set_our_sigflags(SR_signum, act.sa_flags); 2767 os::Bsd::set_our_sigflags(SR_signum, act.sa_flags);
2766 return 0; 2768 return 0;
2767 } 2769 }
2768 2770
2769 static int SR_finalize() {
2770 return 0;
2771 }
2772
2773 2771
2774 // returns true on success and false on error - really an error is fatal 2772 // returns true on success and false on error - really an error is fatal
2775 // but this seems the normal response to library errors 2773 // but this seems the normal response to library errors
2776 static bool do_suspend(OSThread* osthread) { 2774 static bool do_suspend(OSThread* osthread) {
2777 // mark as suspended and send signal 2775 // mark as suspended and send signal
3576 } 3574 }
3577 3575
3578 //////////////////////////////////////////////////////////////////////////////// 3576 ////////////////////////////////////////////////////////////////////////////////
3579 // debug support 3577 // debug support
3580 3578
3581 static address same_page(address x, address y) {
3582 int page_bits = -os::vm_page_size();
3583 if ((intptr_t(x) & page_bits) == (intptr_t(y) & page_bits))
3584 return x;
3585 else if (x > y)
3586 return (address)(intptr_t(y) | ~page_bits) + 1;
3587 else
3588 return (address)(intptr_t(y) & page_bits);
3589 }
3590
3591 bool os::find(address addr, outputStream* st) { 3579 bool os::find(address addr, outputStream* st) {
3592 Dl_info dlinfo; 3580 Dl_info dlinfo;
3593 memset(&dlinfo, 0, sizeof(dlinfo)); 3581 memset(&dlinfo, 0, sizeof(dlinfo));
3594 if (dladdr(addr, &dlinfo)) { 3582 if (dladdr(addr, &dlinfo)) {
3595 st->print(PTR_FORMAT ": ", addr); 3583 st->print(PTR_FORMAT ": ", addr);
3609 } 3597 }
3610 st->cr(); 3598 st->cr();
3611 3599
3612 if (Verbose) { 3600 if (Verbose) {
3613 // decode some bytes around the PC 3601 // decode some bytes around the PC
3614 address begin = same_page(addr-40, addr); 3602 address begin = clamp_address_in_page(addr-40, addr, os::vm_page_size());
3615 address end = same_page(addr+40, addr); 3603 address end = clamp_address_in_page(addr+40, addr, os::vm_page_size());
3616 address lowest = (address) dlinfo.dli_sname; 3604 address lowest = (address) dlinfo.dli_sname;
3617 if (!lowest) lowest = (address) dlinfo.dli_fbase; 3605 if (!lowest) lowest = (address) dlinfo.dli_fbase;
3618 if (begin < lowest) begin = lowest; 3606 if (begin < lowest) begin = lowest;
3619 Dl_info dlinfo2; 3607 Dl_info dlinfo2;
3620 if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr 3608 if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr