src/os/windows/vm/os_windows.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-gc-mmap Sdiff src/os/windows/vm

src/os/windows/vm/os_windows.cpp

Print this page
rev 3899 : [mq]: mickes-originalpatch


2878   cleanup_after_large_page_init();
2879   UseLargePages = success;
2880 }
2881 
2882 // On win32, one cannot release just a part of reserved memory, it's an
2883 // all or nothing deal.  When we split a reservation, we must break the
2884 // reservation into two reservations.
2885 void os::pd_split_reserved_memory(char *base, size_t size, size_t split,
2886                               bool realloc) {
2887   if (size > 0) {
2888     release_memory(base, size);
2889     if (realloc) {
2890       reserve_memory(split, base);
2891     }
2892     if (size != split) {
2893       reserve_memory(size - split, base + split);
2894     }
2895   }
2896 }
2897 






















2898 char* os::pd_reserve_memory(size_t bytes, char* addr, size_t alignment_hint) {
2899   assert((size_t)addr % os::vm_allocation_granularity() == 0,
2900          "reserve alignment");
2901   assert(bytes % os::vm_allocation_granularity() == 0, "reserve block size");
2902   char* res;
2903   // note that if UseLargePages is on, all the areas that require interleaving
2904   // will go thru reserve_memory_special rather than thru here.
2905   bool use_individual = (UseNUMAInterleaving && !UseLargePages);
2906   if (!use_individual) {
2907     res = (char*)VirtualAlloc(addr, bytes, MEM_RESERVE, PAGE_READWRITE);
2908   } else {
2909     elapsedTimer reserveTimer;
2910     if( Verbose && PrintMiscellaneous ) reserveTimer.start();
2911     // in numa interleaving, we have to allocate pages individually
2912     // (well really chunks of NUMAInterleaveGranularity size)
2913     res = allocate_pages_individually(bytes, addr, MEM_RESERVE, PAGE_READWRITE);
2914     if (res == NULL) {
2915       warning("NUMA page allocation failed");
2916     }
2917     if( Verbose && PrintMiscellaneous ) {




2878   cleanup_after_large_page_init();
2879   UseLargePages = success;
2880 }
2881 
2882 // On win32, one cannot release just a part of reserved memory, it's an
2883 // all or nothing deal.  When we split a reservation, we must break the
2884 // reservation into two reservations.
2885 void os::pd_split_reserved_memory(char *base, size_t size, size_t split,
2886                               bool realloc) {
2887   if (size > 0) {
2888     release_memory(base, size);
2889     if (realloc) {
2890       reserve_memory(split, base);
2891     }
2892     if (size != split) {
2893       reserve_memory(size - split, base + split);
2894     }
2895   }
2896 }
2897 
2898 char* os::reserve_memory_aligned(size_t bytes, size_t alignment) {
2899   size_t size = align_size_up(bytes, alignment);
2900   size_t extra_size = size + alignment;
2901   char* aligned_base = NULL;
2902 
2903   do {
2904     char* extra_base = os::reserve_memory(extra_size, NULL, alignment);
2905     if (extra_base == NULL) {
2906       return NULL;
2907     }
2908     // Do manual alignment
2909     aligned_base = (char*) align_size_up((uintptr_t) extra_base, alignment);
2910 
2911     os::release_memory(extra_base, extra_size);
2912 
2913     aligned_base = os::reserve_memory(size, aligned_base);
2914 
2915   } while (aligned_base == NULL);
2916 
2917   return aligned_base;
2918 }
2919 
2920 char* os::pd_reserve_memory(size_t bytes, char* addr, size_t alignment_hint) {
2921   assert((size_t)addr % os::vm_allocation_granularity() == 0,
2922          "reserve alignment");
2923   assert(bytes % os::vm_allocation_granularity() == 0, "reserve block size");
2924   char* res;
2925   // note that if UseLargePages is on, all the areas that require interleaving
2926   // will go thru reserve_memory_special rather than thru here.
2927   bool use_individual = (UseNUMAInterleaving && !UseLargePages);
2928   if (!use_individual) {
2929     res = (char*)VirtualAlloc(addr, bytes, MEM_RESERVE, PAGE_READWRITE);
2930   } else {
2931     elapsedTimer reserveTimer;
2932     if( Verbose && PrintMiscellaneous ) reserveTimer.start();
2933     // in numa interleaving, we have to allocate pages individually
2934     // (well really chunks of NUMAInterleaveGranularity size)
2935     res = allocate_pages_individually(bytes, addr, MEM_RESERVE, PAGE_READWRITE);
2936     if (res == NULL) {
2937       warning("NUMA page allocation failed");
2938     }
2939     if( Verbose && PrintMiscellaneous ) {


src/os/windows/vm/os_windows.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File