--- old/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp 2015-02-17 09:29:58.042898596 +0100 +++ new/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.cpp 2015-02-17 09:29:57.978896738 +0100 @@ -1,5 +1,5 @@ /* - * 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 @@ -31,6 +31,7 @@ #include "utilities/bitMap.inline.hpp" G1RegionToSpaceMapper::G1RegionToSpaceMapper(ReservedSpace rs, + size_t actual_size, size_t commit_granularity, size_t region_granularity, MemoryType type) : @@ -41,7 +42,7 @@ _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); } @@ -55,11 +56,12 @@ 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"); @@ -98,15 +100,16 @@ 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); } @@ -147,14 +150,15 @@ } 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); } }