comparison src/os/linux/vm/os_linux.cpp @ 9062:8be1318fbe77

Merge
author dcubed
date Fri, 05 Apr 2013 10:38:08 -0700
parents 15c04fe93c18 cc32ccaaf47f
children 89e4d67fdd2a f32b6c267d2e e12c9b3740db
comparison
equal deleted inserted replaced
9055:dcdeb150988c 9062:8be1318fbe77
174 #endif // JAVASE_EMBEDDED 174 #endif // JAVASE_EMBEDDED
175 175
176 // utility functions 176 // utility functions
177 177
178 static int SR_initialize(); 178 static int SR_initialize();
179 static int SR_finalize();
180 179
181 julong os::available_memory() { 180 julong os::available_memory() {
182 return Linux::available_memory(); 181 return Linux::available_memory();
183 } 182 }
184 183
1631 snprintf(buffer, buflen, "lib%s.so", fname); 1630 snprintf(buffer, buflen, "lib%s.so", fname);
1632 retval = true; 1631 retval = true;
1633 } else if (strchr(pname, *os::path_separator()) != NULL) { 1632 } else if (strchr(pname, *os::path_separator()) != NULL) {
1634 int n; 1633 int n;
1635 char** pelements = split_path(pname, &n); 1634 char** pelements = split_path(pname, &n);
1635 if (pelements == NULL) {
1636 return false;
1637 }
1636 for (int i = 0 ; i < n ; i++) { 1638 for (int i = 0 ; i < n ; i++) {
1637 // Really shouldn't be NULL, but check can't hurt 1639 // Really shouldn't be NULL, but check can't hurt
1638 if (pelements[i] == NULL || strlen(pelements[i]) == 0) { 1640 if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
1639 continue; // skip the empty path values 1641 continue; // skip the empty path values
1640 } 1642 }
3653 // Save signal flag 3655 // Save signal flag
3654 os::Linux::set_our_sigflags(SR_signum, act.sa_flags); 3656 os::Linux::set_our_sigflags(SR_signum, act.sa_flags);
3655 return 0; 3657 return 0;
3656 } 3658 }
3657 3659
3658 static int SR_finalize() {
3659 return 0;
3660 }
3661
3662 3660
3663 // returns true on success and false on error - really an error is fatal 3661 // returns true on success and false on error - really an error is fatal
3664 // but this seems the normal response to library errors 3662 // but this seems the normal response to library errors
3665 static bool do_suspend(OSThread* osthread) { 3663 static bool do_suspend(OSThread* osthread) {
3666 // mark as suspended and send signal 3664 // mark as suspended and send signal
4498 } 4496 }
4499 4497
4500 //////////////////////////////////////////////////////////////////////////////// 4498 ////////////////////////////////////////////////////////////////////////////////
4501 // debug support 4499 // debug support
4502 4500
4503 static address same_page(address x, address y) {
4504 int page_bits = -os::vm_page_size();
4505 if ((intptr_t(x) & page_bits) == (intptr_t(y) & page_bits))
4506 return x;
4507 else if (x > y)
4508 return (address)(intptr_t(y) | ~page_bits) + 1;
4509 else
4510 return (address)(intptr_t(y) & page_bits);
4511 }
4512
4513 bool os::find(address addr, outputStream* st) { 4501 bool os::find(address addr, outputStream* st) {
4514 Dl_info dlinfo; 4502 Dl_info dlinfo;
4515 memset(&dlinfo, 0, sizeof(dlinfo)); 4503 memset(&dlinfo, 0, sizeof(dlinfo));
4516 if (dladdr(addr, &dlinfo)) { 4504 if (dladdr(addr, &dlinfo)) {
4517 st->print(PTR_FORMAT ": ", addr); 4505 st->print(PTR_FORMAT ": ", addr);
4531 } 4519 }
4532 st->cr(); 4520 st->cr();
4533 4521
4534 if (Verbose) { 4522 if (Verbose) {
4535 // decode some bytes around the PC 4523 // decode some bytes around the PC
4536 address begin = same_page(addr-40, addr); 4524 address begin = clamp_address_in_page(addr-40, addr, os::vm_page_size());
4537 address end = same_page(addr+40, addr); 4525 address end = clamp_address_in_page(addr+40, addr, os::vm_page_size());
4538 address lowest = (address) dlinfo.dli_sname; 4526 address lowest = (address) dlinfo.dli_sname;
4539 if (!lowest) lowest = (address) dlinfo.dli_fbase; 4527 if (!lowest) lowest = (address) dlinfo.dli_fbase;
4540 if (begin < lowest) begin = lowest; 4528 if (begin < lowest) begin = lowest;
4541 Dl_info dlinfo2; 4529 Dl_info dlinfo2;
4542 if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr 4530 if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr