< prev index next >

src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp

Print this page
rev 7746 : 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
Summary: Allow partial use of large pages for auxiliary data structures in G1.
Reviewed-by:

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -29,21 +29,22 @@
 #include "runtime/virtualspace.hpp"
 #include "services/memTracker.hpp"
 #include "utilities/bitMap.inline.hpp"
 
 G1RegionToSpaceMapper::G1RegionToSpaceMapper(ReservedSpace rs,
+                                             size_t actual_size,
                                              size_t commit_granularity,
                                              size_t region_granularity,
                                              MemoryType type) :
   _storage(),
   _commit_granularity(commit_granularity),
   _region_granularity(region_granularity),
   _listener(NULL),
   _commit_map() {
   guarantee(is_power_of_2(commit_granularity), "must be");
   guarantee(is_power_of_2(region_granularity), "must be");
-  _storage.initialize_with_granularity(rs, commit_granularity);
+  _storage.initialize_with_granularity(rs, actual_size, commit_granularity);
 
   MemTracker::record_virtual_memory_type((address)rs.base(), type);
 }
 
 // G1RegionToSpaceMapper implementation where the region granularity is larger than

@@ -53,15 +54,16 @@
  private:
   size_t _pages_per_region;
 
  public:
   G1RegionsLargerThanCommitSizeMapper(ReservedSpace rs,
+                                      size_t actual_size,
                                       size_t os_commit_granularity,
                                       size_t alloc_granularity,
                                       size_t commit_factor,
                                       MemoryType type) :
-     G1RegionToSpaceMapper(rs, os_commit_granularity, alloc_granularity, type),
+    G1RegionToSpaceMapper(rs, actual_size, os_commit_granularity, alloc_granularity, type),
     _pages_per_region(alloc_granularity / (os_commit_granularity * commit_factor)) {
 
     guarantee(alloc_granularity >= os_commit_granularity, "allocation granularity smaller than commit granularity");
     _commit_map.resize(rs.size() * commit_factor / alloc_granularity, /* in_resource_area */ false);
   }

@@ -96,19 +98,20 @@
     return region / _regions_per_page;
   }
 
  public:
   G1RegionsSmallerThanCommitSizeMapper(ReservedSpace rs,
+                                       size_t actual_size,
                                        size_t os_commit_granularity,
                                        size_t alloc_granularity,
                                        size_t commit_factor,
                                        MemoryType type) :
-     G1RegionToSpaceMapper(rs, os_commit_granularity, alloc_granularity, type),
+    G1RegionToSpaceMapper(rs, actual_size, os_commit_granularity, alloc_granularity, type),
     _regions_per_page((os_commit_granularity * commit_factor) / alloc_granularity), _refcounts() {
 
     guarantee((os_commit_granularity * commit_factor) >= alloc_granularity, "allocation granularity smaller than commit granularity");
-    _refcounts.initialize((HeapWord*)rs.base(), (HeapWord*)(rs.base() + rs.size()), os_commit_granularity);
+    _refcounts.initialize((HeapWord*)rs.base(), (HeapWord*)(rs.base() + align_size_up(rs.size(), os_commit_granularity)), os_commit_granularity);
     _commit_map.resize(rs.size() * commit_factor / alloc_granularity, /* in_resource_area */ false);
   }
 
   virtual void commit_regions(uintptr_t start_idx, size_t num_regions) {
     for (uintptr_t i = start_idx; i < start_idx + num_regions; i++) {

@@ -145,16 +148,17 @@
     _listener->on_commit(start_idx, num_regions, zero_filled);
   }
 }
 
 G1RegionToSpaceMapper* G1RegionToSpaceMapper::create_mapper(ReservedSpace rs,
+                                                            size_t actual_size,
                                                             size_t os_commit_granularity,
                                                             size_t region_granularity,
                                                             size_t commit_factor,
                                                             MemoryType type) {
 
   if (region_granularity >= (os_commit_granularity * commit_factor)) {
-    return new G1RegionsLargerThanCommitSizeMapper(rs, os_commit_granularity, region_granularity, commit_factor, type);
+    return new G1RegionsLargerThanCommitSizeMapper(rs, actual_size, os_commit_granularity, region_granularity, commit_factor, type);
   } else {
-    return new G1RegionsSmallerThanCommitSizeMapper(rs, os_commit_granularity, region_granularity, commit_factor, type);
+    return new G1RegionsSmallerThanCommitSizeMapper(rs, actual_size, os_commit_granularity, region_granularity, commit_factor, type);
   }
 }
< prev index next >