mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 01:54:47 +02:00
8234930: Use MAP_JIT when allocating pages for code cache on macOS
Reviewed-by: stuefe, iklam, burban
This commit is contained in:
parent
da2415fed5
commit
2273f9555a
11 changed files with 85 additions and 59 deletions
|
@ -3272,7 +3272,7 @@ struct bitmask* os::Linux::_numa_nodes_ptr;
|
|||
struct bitmask* os::Linux::_numa_interleave_bitmask;
|
||||
struct bitmask* os::Linux::_numa_membind_bitmask;
|
||||
|
||||
bool os::pd_uncommit_memory(char* addr, size_t size) {
|
||||
bool os::pd_uncommit_memory(char* addr, size_t size, bool exec) {
|
||||
uintptr_t res = (uintptr_t) ::mmap(addr, size, PROT_NONE,
|
||||
MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0);
|
||||
return res != (uintptr_t) MAP_FAILED;
|
||||
|
@ -3516,7 +3516,7 @@ static int anon_munmap(char * addr, size_t size) {
|
|||
return ::munmap(addr, size) == 0;
|
||||
}
|
||||
|
||||
char* os::pd_reserve_memory(size_t bytes) {
|
||||
char* os::pd_reserve_memory(size_t bytes, bool exec) {
|
||||
return anon_mmap(NULL, bytes);
|
||||
}
|
||||
|
||||
|
@ -4197,7 +4197,7 @@ bool os::can_execute_large_page_memory() {
|
|||
|
||||
char* os::pd_attempt_map_memory_to_file_at(char* requested_addr, size_t bytes, int file_desc) {
|
||||
assert(file_desc >= 0, "file_desc is not valid");
|
||||
char* result = pd_attempt_reserve_memory_at(requested_addr, bytes);
|
||||
char* result = pd_attempt_reserve_memory_at(requested_addr, bytes, !ExecMem);
|
||||
if (result != NULL) {
|
||||
if (replace_existing_mapping_with_file_mapping(result, bytes, file_desc) == NULL) {
|
||||
vm_exit_during_initialization(err_msg("Error in mapping Java heap at the given filesystem directory"));
|
||||
|
@ -4209,7 +4209,7 @@ char* os::pd_attempt_map_memory_to_file_at(char* requested_addr, size_t bytes, i
|
|||
// Reserve memory at an arbitrary address, only if that area is
|
||||
// available (and not reserved for something else).
|
||||
|
||||
char* os::pd_attempt_reserve_memory_at(char* requested_addr, size_t bytes) {
|
||||
char* os::pd_attempt_reserve_memory_at(char* requested_addr, size_t bytes, bool exec) {
|
||||
// Assert only that the size is a multiple of the page size, since
|
||||
// that's all that mmap requires, and since that's all we really know
|
||||
// about at this low abstraction level. If we need higher alignment,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue