2565 flags |= MAP_ALIGN; 2566 addr = (char*) alignment_hint; 2567 } 2568 2569 // Map uncommitted pages PROT_NONE so we fail early if we touch an 2570 // uncommitted page. Otherwise, the read/write might succeed if we 2571 // have enough swap space to back the physical page. 2572 return mmap_chunk(addr, bytes, flags, PROT_NONE); 2573 } 2574 2575 char* os::pd_reserve_memory(size_t bytes, char* requested_addr, 2576 size_t alignment_hint) { 2577 char* addr = Solaris::anon_mmap(requested_addr, bytes, alignment_hint, 2578 (requested_addr != NULL)); 2579 2580 guarantee(requested_addr == NULL || requested_addr == addr, 2581 "OS failed to return requested mmap address."); 2582 return addr; 2583 } 2584 2585 // Reserve memory at an arbitrary address, only if that area is 2586 // available (and not reserved for something else). 2587 2588 char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) { 2589 const int max_tries = 10; 2590 char* base[max_tries]; 2591 size_t size[max_tries]; 2592 2593 // Solaris adds a gap between mmap'ed regions. The size of the gap 2594 // is dependent on the requested size and the MMU. Our initial gap 2595 // value here is just a guess and will be corrected later. 2596 bool had_top_overlap = false; 2597 bool have_adjusted_gap = false; 2598 size_t gap = 0x400000; 2599 2600 // Assert only that the size is a multiple of the page size, since 2601 // that's all that mmap requires, and since that's all we really know 2602 // about at this low abstraction level. If we need higher alignment, 2603 // we can either pass an alignment to this method or verify alignment 2604 // in one of the methods further up the call chain. See bug 5044738. | 2565 flags |= MAP_ALIGN; 2566 addr = (char*) alignment_hint; 2567 } 2568 2569 // Map uncommitted pages PROT_NONE so we fail early if we touch an 2570 // uncommitted page. Otherwise, the read/write might succeed if we 2571 // have enough swap space to back the physical page. 2572 return mmap_chunk(addr, bytes, flags, PROT_NONE); 2573 } 2574 2575 char* os::pd_reserve_memory(size_t bytes, char* requested_addr, 2576 size_t alignment_hint) { 2577 char* addr = Solaris::anon_mmap(requested_addr, bytes, alignment_hint, 2578 (requested_addr != NULL)); 2579 2580 guarantee(requested_addr == NULL || requested_addr == addr, 2581 "OS failed to return requested mmap address."); 2582 return addr; 2583 } 2584 2585 char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr, int file_desc) { 2586 assert(file_desc >= 0, "file_desc is not valid"); 2587 char* result = pd_attempt_reserve_memory_at(bytes, requested_addr); 2588 if (result != NULL) { 2589 if (replace_existing_mapping_with_file_mapping(result, bytes, file_desc) == NULL) { 2590 vm_exit_during_initialization(err_msg("Error in mapping Java heap at the given filesystem directory")); 2591 } 2592 } 2593 return result; 2594 } 2595 2596 // Reserve memory at an arbitrary address, only if that area is 2597 // available (and not reserved for something else). 2598 2599 char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) { 2600 const int max_tries = 10; 2601 char* base[max_tries]; 2602 size_t size[max_tries]; 2603 2604 // Solaris adds a gap between mmap'ed regions. The size of the gap 2605 // is dependent on the requested size and the MMU. Our initial gap 2606 // value here is just a guess and will be corrected later. 2607 bool had_top_overlap = false; 2608 bool have_adjusted_gap = false; 2609 size_t gap = 0x400000; 2610 2611 // Assert only that the size is a multiple of the page size, since 2612 // that's all that mmap requires, and since that's all we really know 2613 // about at this low abstraction level. If we need higher alignment, 2614 // we can either pass an alignment to this method or verify alignment 2615 // in one of the methods further up the call chain. See bug 5044738. |