Mercurial > hg > truffle
comparison src/os/bsd/vm/os_bsd.cpp @ 10398:2cb5d5f6d5e5
8015252: Enable HotSpot build with Clang
Reviewed-by: twisti, dholmes, kvn
author | simonis |
---|---|
date | Tue, 04 Jun 2013 22:16:15 -0700 |
parents | 9ce110b1d14a |
children | ef1818846c22 |
comparison
equal
deleted
inserted
replaced
10397:075ea888b039 | 10398:2cb5d5f6d5e5 |
---|---|
624 | 624 |
625 | 625 |
626 ////////////////////////////////////////////////////////////////////////////// | 626 ////////////////////////////////////////////////////////////////////////////// |
627 // create new thread | 627 // create new thread |
628 | 628 |
629 static address highest_vm_reserved_address(); | |
630 | |
631 // check if it's safe to start a new thread | 629 // check if it's safe to start a new thread |
632 static bool _thread_safety_check(Thread* thread) { | 630 static bool _thread_safety_check(Thread* thread) { |
633 return true; | 631 return true; |
634 } | 632 } |
635 | 633 |
2110 | 2108 |
2111 bool os::pd_release_memory(char* addr, size_t size) { | 2109 bool os::pd_release_memory(char* addr, size_t size) { |
2112 return anon_munmap(addr, size); | 2110 return anon_munmap(addr, size); |
2113 } | 2111 } |
2114 | 2112 |
2115 static address highest_vm_reserved_address() { | |
2116 return _highest_vm_reserved_address; | |
2117 } | |
2118 | |
2119 static bool bsd_mprotect(char* addr, size_t size, int prot) { | 2113 static bool bsd_mprotect(char* addr, size_t size, int prot) { |
2120 // Bsd wants the mprotect address argument to be page aligned. | 2114 // Bsd wants the mprotect address argument to be page aligned. |
2121 char* bottom = (char*)align_size_down((intptr_t)addr, os::Bsd::page_size()); | 2115 char* bottom = (char*)align_size_down((intptr_t)addr, os::Bsd::page_size()); |
2122 | 2116 |
2123 // According to SUSv3, mprotect() should only be used with mappings | 2117 // According to SUSv3, mprotect() should only be used with mappings |
2155 return bsd_mprotect(addr, size, PROT_READ|PROT_WRITE); | 2149 return bsd_mprotect(addr, size, PROT_READ|PROT_WRITE); |
2156 } | 2150 } |
2157 | 2151 |
2158 bool os::Bsd::hugetlbfs_sanity_check(bool warn, size_t page_size) { | 2152 bool os::Bsd::hugetlbfs_sanity_check(bool warn, size_t page_size) { |
2159 return false; | 2153 return false; |
2160 } | |
2161 | |
2162 /* | |
2163 * Set the coredump_filter bits to include largepages in core dump (bit 6) | |
2164 * | |
2165 * From the coredump_filter documentation: | |
2166 * | |
2167 * - (bit 0) anonymous private memory | |
2168 * - (bit 1) anonymous shared memory | |
2169 * - (bit 2) file-backed private memory | |
2170 * - (bit 3) file-backed shared memory | |
2171 * - (bit 4) ELF header pages in file-backed private memory areas (it is | |
2172 * effective only if the bit 2 is cleared) | |
2173 * - (bit 5) hugetlb private memory | |
2174 * - (bit 6) hugetlb shared memory | |
2175 */ | |
2176 static void set_coredump_filter(void) { | |
2177 FILE *f; | |
2178 long cdm; | |
2179 | |
2180 if ((f = fopen("/proc/self/coredump_filter", "r+")) == NULL) { | |
2181 return; | |
2182 } | |
2183 | |
2184 if (fscanf(f, "%lx", &cdm) != 1) { | |
2185 fclose(f); | |
2186 return; | |
2187 } | |
2188 | |
2189 rewind(f); | |
2190 | |
2191 if ((cdm & LARGEPAGES_BIT) == 0) { | |
2192 cdm |= LARGEPAGES_BIT; | |
2193 fprintf(f, "%#lx", cdm); | |
2194 } | |
2195 | |
2196 fclose(f); | |
2197 } | 2154 } |
2198 | 2155 |
2199 // Large page support | 2156 // Large page support |
2200 | 2157 |
2201 static size_t _large_page_size = 0; | 2158 static size_t _large_page_size = 0; |