hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp
changeset 1911 b7cfe7eb809c
parent 1217 5eb97f366a6a
child 2105 347008ce7984
equal deleted inserted replaced
1910:386106352d02 1911:b7cfe7eb809c
    76   _reserved_low_addr = _reserved_high_addr = NULL;
    76   _reserved_low_addr = _reserved_high_addr = NULL;
    77   _committed_low_addr = _committed_high_addr = NULL;
    77   _committed_low_addr = _committed_high_addr = NULL;
    78   _special = false;
    78   _special = false;
    79 }
    79 }
    80 
    80 
    81 bool PSVirtualSpace::expand_by(size_t bytes, bool pre_touch) {
    81 bool PSVirtualSpace::expand_by(size_t bytes) {
    82   assert(is_aligned(bytes), "arg not aligned");
    82   assert(is_aligned(bytes), "arg not aligned");
    83   DEBUG_ONLY(PSVirtualSpaceVerifier this_verifier(this));
    83   DEBUG_ONLY(PSVirtualSpaceVerifier this_verifier(this));
    84 
    84 
    85   if (uncommitted_size() < bytes) {
    85   if (uncommitted_size() < bytes) {
    86     return false;
    86     return false;
    88 
    88 
    89   char* const base_addr = committed_high_addr();
    89   char* const base_addr = committed_high_addr();
    90   bool result = special() || os::commit_memory(base_addr, bytes, alignment());
    90   bool result = special() || os::commit_memory(base_addr, bytes, alignment());
    91   if (result) {
    91   if (result) {
    92     _committed_high_addr += bytes;
    92     _committed_high_addr += bytes;
    93   }
       
    94 
       
    95   if (pre_touch || AlwaysPreTouch) {
       
    96     for (char* curr = base_addr;
       
    97          curr < _committed_high_addr;
       
    98          curr += os::vm_page_size()) {
       
    99       char tmp = *curr;
       
   100       *curr = 0;
       
   101     }
       
   102   }
    93   }
   103 
    94 
   104   return result;
    95   return result;
   105 }
    96 }
   106 
    97 
   253   set_reserved(rs);
   244   set_reserved(rs);
   254   set_committed(reserved_high_addr(), reserved_high_addr());
   245   set_committed(reserved_high_addr(), reserved_high_addr());
   255   DEBUG_ONLY(verify());
   246   DEBUG_ONLY(verify());
   256 }
   247 }
   257 
   248 
   258 bool PSVirtualSpaceHighToLow::expand_by(size_t bytes, bool pre_touch) {
   249 bool PSVirtualSpaceHighToLow::expand_by(size_t bytes) {
   259   assert(is_aligned(bytes), "arg not aligned");
   250   assert(is_aligned(bytes), "arg not aligned");
   260   DEBUG_ONLY(PSVirtualSpaceVerifier this_verifier(this));
   251   DEBUG_ONLY(PSVirtualSpaceVerifier this_verifier(this));
   261 
   252 
   262   if (uncommitted_size() < bytes) {
   253   if (uncommitted_size() < bytes) {
   263     return false;
   254     return false;
   265 
   256 
   266   char* const base_addr = committed_low_addr() - bytes;
   257   char* const base_addr = committed_low_addr() - bytes;
   267   bool result = special() || os::commit_memory(base_addr, bytes, alignment());
   258   bool result = special() || os::commit_memory(base_addr, bytes, alignment());
   268   if (result) {
   259   if (result) {
   269     _committed_low_addr -= bytes;
   260     _committed_low_addr -= bytes;
   270   }
       
   271 
       
   272   if (pre_touch || AlwaysPreTouch) {
       
   273     for (char* curr = base_addr;
       
   274          curr < _committed_high_addr;
       
   275          curr += os::vm_page_size()) {
       
   276       char tmp = *curr;
       
   277       *curr = 0;
       
   278     }
       
   279   }
   261   }
   280 
   262 
   281   return result;
   263   return result;
   282 }
   264 }
   283 
   265