diff src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp @ 20543:e7d0505c8a30

8059758: Footprint regressions with JDK-8038423 Summary: Changes in JDK-8038423 always initialize (zero out) virtual memory used for auxiliary data structures. This causes a footprint regression for G1 in startup benchmarks. This is because they do not touch that memory at all, so the operating system does not actually commit these pages. The fix is to, if the initialization value of the data structures matches the default value of just committed memory (=0), do not do anything. Reviewed-by: jwilhelm, brutisso
author tschatzl
date Fri, 10 Oct 2014 15:51:58 +0200
parents 7b2fc3129653
children ae52ee069062
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp	Fri Oct 10 15:45:45 2014 +0200
+++ b/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp	Fri Oct 10 15:51:58 2014 +0200
@@ -69,7 +69,7 @@
   virtual void commit_regions(uintptr_t start_idx, size_t num_regions) {
     _storage.commit(start_idx * _pages_per_region, num_regions * _pages_per_region);
     _commit_map.set_range(start_idx, start_idx + num_regions);
-    fire_on_commit(start_idx, num_regions);
+    fire_on_commit(start_idx, num_regions, true);
   }
 
   virtual void uncommit_regions(uintptr_t start_idx, size_t num_regions) {
@@ -115,12 +115,14 @@
       assert(!_commit_map.at(i), err_msg("Trying to commit storage at region "INTPTR_FORMAT" that is already committed", i));
       uintptr_t idx = region_idx_to_page_idx(i);
       uint old_refcount = _refcounts.get_by_index(idx);
+      bool zero_filled = false;
       if (old_refcount == 0) {
         _storage.commit(idx, 1);
+        zero_filled = true;
       }
       _refcounts.set_by_index(idx, old_refcount + 1);
       _commit_map.set_bit(i);
-      fire_on_commit(i, 1);
+      fire_on_commit(i, 1, zero_filled);
     }
   }
 
@@ -139,9 +141,9 @@
   }
 };
 
-void G1RegionToSpaceMapper::fire_on_commit(uint start_idx, size_t num_regions) {
+void G1RegionToSpaceMapper::fire_on_commit(uint start_idx, size_t num_regions, bool zero_filled) {
   if (_listener != NULL) {
-    _listener->on_commit(start_idx, num_regions);
+    _listener->on_commit(start_idx, num_regions, zero_filled);
   }
 }