< prev index next >

src/hotspot/os/solaris/os_solaris.cpp

Print this page




2564     flags |= MAP_ALIGN;
2565     addr = (char*) alignment_hint;
2566   }
2567 
2568   // Map uncommitted pages PROT_NONE so we fail early if we touch an
2569   // uncommitted page. Otherwise, the read/write might succeed if we
2570   // have enough swap space to back the physical page.
2571   return mmap_chunk(addr, bytes, flags, PROT_NONE);
2572 }
2573 
2574 char* os::pd_reserve_memory(size_t bytes, char* requested_addr,
2575                             size_t alignment_hint) {
2576   char* addr = Solaris::anon_mmap(requested_addr, bytes, alignment_hint,
2577                                   (requested_addr != NULL));
2578 
2579   guarantee(requested_addr == NULL || requested_addr == addr,
2580             "OS failed to return requested mmap address.");
2581   return addr;
2582 }
2583 











2584 // Reserve memory at an arbitrary address, only if that area is
2585 // available (and not reserved for something else).
2586 
2587 char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) {
2588   const int max_tries = 10;
2589   char* base[max_tries];
2590   size_t size[max_tries];
2591 
2592   // Solaris adds a gap between mmap'ed regions.  The size of the gap
2593   // is dependent on the requested size and the MMU.  Our initial gap
2594   // value here is just a guess and will be corrected later.
2595   bool had_top_overlap = false;
2596   bool have_adjusted_gap = false;
2597   size_t gap = 0x400000;
2598 
2599   // Assert only that the size is a multiple of the page size, since
2600   // that's all that mmap requires, and since that's all we really know
2601   // about at this low abstraction level.  If we need higher alignment,
2602   // we can either pass an alignment to this method or verify alignment
2603   // in one of the methods further up the call chain.  See bug 5044738.




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


< prev index next >