Merge

Thu, 22 Jan 2015 09:48:22 -0800

author
asaha
date
Thu, 22 Jan 2015 09:48:22 -0800
changeset 7903
6b8e200bdda1
parent 7902
ad0cbda3bfa0
parent 7513
0e67683b7001
child 7904
1afaee6e59ea

Merge

.hgtags file | annotate | diff | comparison | revisions
make/hotspot_version file | annotate | diff | comparison | revisions
     1.1 --- a/.hgtags	Thu Jan 22 09:36:34 2015 -0800
     1.2 +++ b/.hgtags	Thu Jan 22 09:48:22 2015 -0800
     1.3 @@ -586,6 +586,8 @@
     1.4  c3933f52eeb33f70ee562464edddfe9f01d944fd jdk8u40-b20
     1.5  d2e9a6bec4f2eec8506eed16f7324992a85d8480 hs25.40-b24
     1.6  25ec4a67433744bbe3406e5069e7fd1876ebbf2f jdk8u40-b21
     1.7 +0f0cb4eeab2d871274f4ffdcd6017d2fdfa89238 hs25.40-b25
     1.8 +0ee548a1cda08c884eccd563e2d5fdb6ee769b5a jdk8u40-b22
     1.9  b95f13f05f553309cd74d6ccf8fcedb259c6716c jdk8u45-b00
    1.10  41c3c456e326185053f0654be838f4b0bfb38078 jdk8u45-b01
    1.11  626fd8c2eec63e2a2dff3839bfe12c0431bf00a4 jdk8u45-b02
     2.1 --- a/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp	Thu Jan 22 09:36:34 2015 -0800
     2.2 +++ b/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp	Thu Jan 22 09:48:22 2015 -0800
     2.3 @@ -45,7 +45,8 @@
     2.4  #include "utilities/bitMap.inline.hpp"
     2.5  
     2.6  G1PageBasedVirtualSpace::G1PageBasedVirtualSpace() : _low_boundary(NULL),
     2.7 -  _high_boundary(NULL), _committed(), _page_size(0), _special(false), _executable(false) {
     2.8 +  _high_boundary(NULL), _committed(), _page_size(0), _special(false),
     2.9 +  _dirty(), _executable(false) {
    2.10  }
    2.11  
    2.12  bool G1PageBasedVirtualSpace::initialize_with_granularity(ReservedSpace rs, size_t page_size) {
    2.13 @@ -66,6 +67,9 @@
    2.14    assert(_committed.size() == 0, "virtual space initialized more than once");
    2.15    uintx size_in_bits = rs.size() / page_size;
    2.16    _committed.resize(size_in_bits, /* in_resource_area */ false);
    2.17 +  if (_special) {
    2.18 +    _dirty.resize(size_in_bits, /* in_resource_area */ false);
    2.19 +  }
    2.20  
    2.21    return true;
    2.22  }
    2.23 @@ -84,6 +88,7 @@
    2.24    _executable             = false;
    2.25    _page_size              = 0;
    2.26    _committed.resize(0, false);
    2.27 +  _dirty.resize(0, false);
    2.28  }
    2.29  
    2.30  size_t G1PageBasedVirtualSpace::committed_size() const {
    2.31 @@ -120,31 +125,40 @@
    2.32    return num * _page_size;
    2.33  }
    2.34  
    2.35 -MemRegion G1PageBasedVirtualSpace::commit(uintptr_t start, size_t size_in_pages) {
    2.36 +bool G1PageBasedVirtualSpace::commit(uintptr_t start, size_t size_in_pages) {
    2.37    // We need to make sure to commit all pages covered by the given area.
    2.38    guarantee(is_area_uncommitted(start, size_in_pages), "Specified area is not uncommitted");
    2.39  
    2.40 -  if (!_special) {
    2.41 +  bool zero_filled = true;
    2.42 +  uintptr_t end = start + size_in_pages;
    2.43 +
    2.44 +  if (_special) {
    2.45 +    // Check for dirty pages and update zero_filled if any found.
    2.46 +    if (_dirty.get_next_one_offset(start,end) < end) {
    2.47 +      zero_filled = false;
    2.48 +      _dirty.clear_range(start, end);
    2.49 +    }
    2.50 +  } else {
    2.51      os::commit_memory_or_exit(page_start(start), byte_size_for_pages(size_in_pages), _executable,
    2.52                                err_msg("Failed to commit pages from "SIZE_FORMAT" of length "SIZE_FORMAT, start, size_in_pages));
    2.53    }
    2.54 -  _committed.set_range(start, start + size_in_pages);
    2.55 +  _committed.set_range(start, end);
    2.56  
    2.57 -  MemRegion result((HeapWord*)page_start(start), byte_size_for_pages(size_in_pages) / HeapWordSize);
    2.58 -  return result;
    2.59 +  return zero_filled;
    2.60  }
    2.61  
    2.62 -MemRegion G1PageBasedVirtualSpace::uncommit(uintptr_t start, size_t size_in_pages) {
    2.63 +void G1PageBasedVirtualSpace::uncommit(uintptr_t start, size_t size_in_pages) {
    2.64    guarantee(is_area_committed(start, size_in_pages), "checking");
    2.65  
    2.66 -  if (!_special) {
    2.67 +  if (_special) {
    2.68 +    // Mark that memory is dirty. If committed again the memory might
    2.69 +    // need to be cleared explicitly.
    2.70 +    _dirty.set_range(start, start + size_in_pages);
    2.71 +  } else {
    2.72      os::uncommit_memory(page_start(start), byte_size_for_pages(size_in_pages));
    2.73    }
    2.74  
    2.75    _committed.clear_range(start, start + size_in_pages);
    2.76 -
    2.77 -  MemRegion result((HeapWord*)page_start(start), byte_size_for_pages(size_in_pages) / HeapWordSize);
    2.78 -  return result;
    2.79  }
    2.80  
    2.81  bool G1PageBasedVirtualSpace::contains(const void* p) const {
    2.82 @@ -154,7 +168,7 @@
    2.83  #ifndef PRODUCT
    2.84  void G1PageBasedVirtualSpace::print_on(outputStream* out) {
    2.85    out->print   ("Virtual space:");
    2.86 -  if (special()) out->print(" (pinned in memory)");
    2.87 +  if (_special) out->print(" (pinned in memory)");
    2.88    out->cr();
    2.89    out->print_cr(" - committed: " SIZE_FORMAT, committed_size());
    2.90    out->print_cr(" - reserved:  " SIZE_FORMAT, reserved_size());
     3.1 --- a/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.hpp	Thu Jan 22 09:36:34 2015 -0800
     3.2 +++ b/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.hpp	Thu Jan 22 09:48:22 2015 -0800
     3.3 @@ -49,6 +49,12 @@
     3.4    // Bitmap used for verification of commit/uncommit operations.
     3.5    BitMap _committed;
     3.6  
     3.7 +  // Bitmap used to keep track of which pages are dirty or not for _special
     3.8 +  // spaces. This is needed because for those spaces the underlying memory
     3.9 +  // will only be zero filled the first time it is committed. Calls to commit
    3.10 +  // will use this bitmap and return whether or not the memory is zero filled.
    3.11 +  BitMap _dirty;
    3.12 +
    3.13    // Indicates that the entire space has been committed and pinned in memory,
    3.14    // os::commit_memory() or os::uncommit_memory() have no function.
    3.15    bool _special;
    3.16 @@ -71,12 +77,11 @@
    3.17   public:
    3.18  
    3.19    // Commit the given area of pages starting at start being size_in_pages large.
    3.20 -  MemRegion commit(uintptr_t start, size_t size_in_pages);
    3.21 +  // Returns true if the given area is zero filled upon completion.
    3.22 +  bool commit(uintptr_t start, size_t size_in_pages);
    3.23  
    3.24    // Uncommit the given area of pages starting at start being size_in_pages large.
    3.25 -  MemRegion uncommit(uintptr_t start, size_t size_in_pages);
    3.26 -
    3.27 -  bool special() const { return _special; }
    3.28 +  void uncommit(uintptr_t start, size_t size_in_pages);
    3.29  
    3.30    // Initialization
    3.31    G1PageBasedVirtualSpace();
     4.1 --- a/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp	Thu Jan 22 09:36:34 2015 -0800
     4.2 +++ b/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp	Thu Jan 22 09:48:22 2015 -0800
     4.3 @@ -67,9 +67,9 @@
     4.4    }
     4.5  
     4.6    virtual void commit_regions(uintptr_t start_idx, size_t num_regions) {
     4.7 -    _storage.commit(start_idx * _pages_per_region, num_regions * _pages_per_region);
     4.8 +    bool zero_filled = _storage.commit(start_idx * _pages_per_region, num_regions * _pages_per_region);
     4.9      _commit_map.set_range(start_idx, start_idx + num_regions);
    4.10 -    fire_on_commit(start_idx, num_regions, true);
    4.11 +    fire_on_commit(start_idx, num_regions, zero_filled);
    4.12    }
    4.13  
    4.14    virtual void uncommit_regions(uintptr_t start_idx, size_t num_regions) {
    4.15 @@ -117,8 +117,7 @@
    4.16        uint old_refcount = _refcounts.get_by_index(idx);
    4.17        bool zero_filled = false;
    4.18        if (old_refcount == 0) {
    4.19 -        _storage.commit(idx, 1);
    4.20 -        zero_filled = true;
    4.21 +        zero_filled = _storage.commit(idx, 1);
    4.22        }
    4.23        _refcounts.set_by_index(idx, old_refcount + 1);
    4.24        _commit_map.set_bit(i);

mercurial