Mercurial > hg > truffle
comparison src/os/linux/vm/os_linux.cpp @ 242:d95b224e9f17
6721093: -XX:AppendRatio=N not supported
Summary: Add mechanism to ignore unsupported flags for a set period of time
Reviewed-by: acorn, never, coleenp
author | kamg |
---|---|
date | Mon, 28 Jul 2008 14:07:44 -0400 |
parents | 1fdb98a17101 |
children | b7f01ad69d30 |
comparison
equal
deleted
inserted
replaced
237:1fdb98a17101 | 242:d95b224e9f17 |
---|---|
91 /* Signal number used to suspend/resume a thread */ | 91 /* Signal number used to suspend/resume a thread */ |
92 | 92 |
93 /* do not use any signal number less than SIGSEGV, see 4355769 */ | 93 /* do not use any signal number less than SIGSEGV, see 4355769 */ |
94 static int SR_signum = SIGUSR2; | 94 static int SR_signum = SIGUSR2; |
95 sigset_t SR_sigset; | 95 sigset_t SR_sigset; |
96 | |
97 /* Used to protect dlsym() calls */ | |
98 static pthread_mutex_t dl_mutex; | |
96 | 99 |
97 //////////////////////////////////////////////////////////////////////////////// | 100 //////////////////////////////////////////////////////////////////////////////// |
98 // utility functions | 101 // utility functions |
99 | 102 |
100 static int SR_initialize(); | 103 static int SR_initialize(); |
1491 | 1494 |
1492 const char* os::dll_file_extension() { return ".so"; } | 1495 const char* os::dll_file_extension() { return ".so"; } |
1493 | 1496 |
1494 const char* os::get_temp_directory() { return "/tmp/"; } | 1497 const char* os::get_temp_directory() { return "/tmp/"; } |
1495 | 1498 |
1499 void os::dll_build_name( | |
1500 char* buffer, size_t buflen, const char* pname, const char* fname) { | |
1501 // copied from libhpi | |
1502 const size_t pnamelen = pname ? strlen(pname) : 0; | |
1503 | |
1504 /* Quietly truncate on buffer overflow. Should be an error. */ | |
1505 if (pnamelen + strlen(fname) + 10 > (size_t) buflen) { | |
1506 *buffer = '\0'; | |
1507 return; | |
1508 } | |
1509 | |
1510 if (pnamelen == 0) { | |
1511 sprintf(buffer, "lib%s.so", fname); | |
1512 } else { | |
1513 sprintf(buffer, "%s/lib%s.so", pname, fname); | |
1514 } | |
1515 } | |
1516 | |
1496 const char* os::get_current_directory(char *buf, int buflen) { | 1517 const char* os::get_current_directory(char *buf, int buflen) { |
1497 return getcwd(buf, buflen); | 1518 return getcwd(buf, buflen); |
1498 } | 1519 } |
1499 | 1520 |
1500 // check if addr is inside libjvm[_g].so | 1521 // check if addr is inside libjvm[_g].so |
1740 } | 1761 } |
1741 | 1762 |
1742 return NULL; | 1763 return NULL; |
1743 } | 1764 } |
1744 | 1765 |
1745 | 1766 /* |
1767 * glibc-2.0 libdl is not MT safe. If you are building with any glibc, | |
1768 * chances are you might want to run the generated bits against glibc-2.0 | |
1769 * libdl.so, so always use locking for any version of glibc. | |
1770 */ | |
1771 void* os::dll_lookup(void* handle, const char* name) { | |
1772 pthread_mutex_lock(&dl_mutex); | |
1773 void* res = dlsym(handle, name); | |
1774 pthread_mutex_unlock(&dl_mutex); | |
1775 return res; | |
1776 } | |
1746 | 1777 |
1747 | 1778 |
1748 bool _print_ascii_file(const char* filename, outputStream* st) { | 1779 bool _print_ascii_file(const char* filename, outputStream* st) { |
1749 int fd = open(filename, O_RDONLY); | 1780 int fd = open(filename, O_RDONLY); |
1750 if (fd == -1) { | 1781 if (fd == -1) { |
3579 // main_thread points to the aboriginal thread | 3610 // main_thread points to the aboriginal thread |
3580 Linux::_main_thread = pthread_self(); | 3611 Linux::_main_thread = pthread_self(); |
3581 | 3612 |
3582 Linux::clock_init(); | 3613 Linux::clock_init(); |
3583 initial_time_count = os::elapsed_counter(); | 3614 initial_time_count = os::elapsed_counter(); |
3615 pthread_mutex_init(&dl_mutex, NULL); | |
3584 } | 3616 } |
3585 | 3617 |
3586 // To install functions for atexit system call | 3618 // To install functions for atexit system call |
3587 extern "C" { | 3619 extern "C" { |
3588 static void perfMemory_exit_helper() { | 3620 static void perfMemory_exit_helper() { |