< prev index next >

src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.hpp

Print this page
rev 7696 : 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:

@@ -32,21 +32,26 @@
 
 // Virtual space management helper for a virtual space with an OS page allocation
 // granularity.
 // (De-)Allocation requests are always OS page aligned by passing a page index
 // and multiples of pages.
+// We only support reservations which base address is aligned to a given commit
+// size. The length of the area managed need not commit size aligned (but OS default
+// page size aligned) because some OSes cannot provide a an os_commit_size aligned
+// reservation without also being size-aligned. Any tail area is committed using OS
+// small pages.
 // The implementation gives an error when trying to commit or uncommit pages that
 // have already been committed or uncommitted.
 class G1PageBasedVirtualSpace VALUE_OBJ_CLASS_SPEC {
   friend class VMStructs;
  private:
   // Reserved area addresses.
   char* _low_boundary;
   char* _high_boundary;
 
-  // The commit/uncommit granularity in bytes.
-  size_t _page_size;
+  // The preferred commit/uncommit granularity in bytes.
+  size_t _commit_size;
 
   // Bitmap used for verification of commit/uncommit operations.
   BitMap _committed;
 
   // Bitmap used to keep track of which pages are dirty or not for _special

@@ -60,16 +65,23 @@
   bool _special;
 
   // Indicates whether the committed space should be executable.
   bool _executable;
 
+  // Commit the given memory range by using _commit_size pages as much as possible
+  // and the remainder with small sized pages. The start address must be _commit_size
+  // aligned.
+  void commit_int(char* start, char* end);
+  // Uncommit the given memory range.
+  void uncommit_int(char* start, char* end);
+
   // Returns the index of the page which contains the given address.
   uintptr_t  addr_to_page_index(char* addr) const;
   // Returns the address of the given page index.
   char*  page_start(uintptr_t index);
-  // Returns the byte size of the given number of pages.
-  size_t byte_size_for_pages(size_t num);
+  // Returns the address of the given page index ranging from 0..size_in_pages-1.
+  char*  page_end(uintptr_t index);
 
   // Returns true if the entire area is backed by committed memory.
   bool is_area_committed(uintptr_t start, size_t size_in_pages) const;
   // Returns true if the entire area is not backed by committed memory.
   bool is_area_uncommitted(uintptr_t start, size_t size_in_pages) const;

@@ -83,11 +95,13 @@
   // Uncommit the given area of pages starting at start being size_in_pages large.
   void uncommit(uintptr_t start, size_t size_in_pages);
 
   // Initialization
   G1PageBasedVirtualSpace();
-  bool initialize_with_granularity(ReservedSpace rs, size_t page_size);
+  // Initialize the given reserved space with the given base address and actual size.
+  // Prefer to commit in commit_size chunks.
+  bool initialize_with_granularity(ReservedSpace rs, size_t actual_size, size_t commit_size);
 
   // Destruction
   ~G1PageBasedVirtualSpace();
 
   // Amount of reserved memory.
< prev index next >