src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp
branchstuefe-new-metaspace-branch
changeset 59138 714474295e0a
parent 58063 bdf136b8ae0e
equal deleted inserted replaced
59135:84464aa83a29 59138:714474295e0a
    38 #include "memory/metaspace/metaspaceCommon.hpp"
    38 #include "memory/metaspace/metaspaceCommon.hpp"
    39 #include "memory/metaspace/rootChunkArea.hpp"
    39 #include "memory/metaspace/rootChunkArea.hpp"
    40 #include "memory/metaspace/runningCounters.hpp"
    40 #include "memory/metaspace/runningCounters.hpp"
    41 #include "memory/metaspace/virtualSpaceNode.hpp"
    41 #include "memory/metaspace/virtualSpaceNode.hpp"
    42 
    42 
       
    43 #include "runtime/globals.hpp"
    43 #include "runtime/mutexLocker.hpp"
    44 #include "runtime/mutexLocker.hpp"
    44 #include "runtime/os.hpp"
    45 #include "runtime/os.hpp"
    45 
    46 
    46 #include "utilities/align.hpp"
    47 #include "utilities/align.hpp"
    47 #include "utilities/debug.hpp"
    48 #include "utilities/debug.hpp"
    59 void check_word_size_is_aligned_to_commit_granule(size_t word_size) {
    60 void check_word_size_is_aligned_to_commit_granule(size_t word_size) {
    60   assert(is_aligned(word_size, Settings::commit_granule_words()),
    61   assert(is_aligned(word_size, Settings::commit_granule_words()),
    61          "Not aligned to commit granule size: " SIZE_FORMAT ".", word_size);
    62          "Not aligned to commit granule size: " SIZE_FORMAT ".", word_size);
    62 }
    63 }
    63 #endif
    64 #endif
       
    65 
    64 
    66 
    65 // Given an address range, ensure it is committed.
    67 // Given an address range, ensure it is committed.
    66 //
    68 //
    67 // The range has to be aligned to granule size.
    69 // The range has to be aligned to granule size.
    68 //
    70 //
   104   }
   106   }
   105 
   107 
   106   // Commit...
   108   // Commit...
   107   if (os::commit_memory((char*)p, word_size * BytesPerWord, false) == false) {
   109   if (os::commit_memory((char*)p, word_size * BytesPerWord, false) == false) {
   108     vm_exit_out_of_memory(word_size * BytesPerWord, OOM_MMAP_ERROR, "Failed to commit metaspace.");
   110     vm_exit_out_of_memory(word_size * BytesPerWord, OOM_MMAP_ERROR, "Failed to commit metaspace.");
       
   111   }
       
   112 
       
   113   if (AlwaysPreTouch) {
       
   114     os::pretouch_memory(p, p + word_size);
   109   }
   115   }
   110 
   116 
   111   log_debug(gc, metaspace)("Increased metaspace by " SIZE_FORMAT " bytes.",
   117   log_debug(gc, metaspace)("Increased metaspace by " SIZE_FORMAT " bytes.",
   112                            commit_increase_words * BytesPerWord);
   118                            commit_increase_words * BytesPerWord);
   113 
   119