< prev index next >

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

Print this page
rev 7993 : imported patch per-comments

@@ -47,12 +47,12 @@
  private:
   // Reserved area addresses.
   char* _low_boundary;
   char* _high_boundary;
 
-  // The preferred commit/uncommit granularity in bytes.
-  size_t _commit_size;
+  // The preferred page size used for commit/uncommit in bytes.
+  size_t _page_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

@@ -66,44 +66,59 @@
   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
+  // Commit the given memory range by using _page_size pages as much as possible
+  // and the remainder with small sized pages. The start address must be _page_size
   // aligned.
-  void commit_internal(char* start, char* end);
+  void commit_internal(size_t start_page, size_t end_page);
+  // Commit num_pages full pages of _page_size size starting from start. All argument
+  // checking has been performed.
+  void commit_full_pages(size_t start_page, size_t end_page);
+  // Commit the tail area.
+  void commit_tail();
+
   // Uncommit the given memory range.
-  void uncommit_internal(char* start, char* end);
+  void uncommit_internal(size_t start_page, size_t end_page);
+
+  // Pretouch the given memory range.
+  void pretouch_internal(size_t start_page, size_t end_page);
 
   // 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 address of the end of the page given the page index ranging
-  // from 0..size_in_pages-2. For the last page, return _high_boundary.
-  char*  page_end(uintptr_t index);
+  char*  page_start(size_t index);
+
+  // Is the given page index the last page?
+  bool is_last_page(size_t index) { return index == (_committed.size() - 1); }
+  // Is the given page index the first after last page?
+  bool is_after_last_page(size_t index);
+  // Is the last page only partially covered by this space?
+  bool is_last_page_partial() { return !is_ptr_aligned(_high_boundary, _page_size); }
+  // Returns the end address of the given page bounded by the reserved space.
+  char* bounded_end_addr(size_t end_page);
 
   // Returns true if the entire area is backed by committed memory.
-  bool is_area_committed(uintptr_t start, size_t size_in_pages) const;
+  bool is_area_committed(size_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;
+  bool is_area_uncommitted(size_t start, size_t size_in_pages) const;
 
+  void initialize_with_page_size(ReservedSpace rs, size_t used_size, size_t page_size);
  public:
 
   // Commit the given area of pages starting at start being size_in_pages large.
   // Returns true if the given area is zero filled upon completion.
-  bool commit(uintptr_t start, size_t size_in_pages);
+  bool commit(size_t start, size_t size_in_pages);
 
   // Uncommit the given area of pages starting at start being size_in_pages large.
-  void uncommit(uintptr_t start, size_t size_in_pages);
+  void uncommit(size_t start, size_t size_in_pages);
 
-  // Initialization
-  G1PageBasedVirtualSpace();
-  // 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);
+  // Initialize the given reserved space with the given base address and the size
+  // actually used.
+  // Prefer to commit in page_size chunks.
+  G1PageBasedVirtualSpace(ReservedSpace rs, size_t used_size, size_t page_size);
 
   // Destruction
   ~G1PageBasedVirtualSpace();
 
   // Amount of reserved memory.
< prev index next >