8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_G1_G1PAGEBASEDVIRTUALSPACE_HPP
26 #define SHARE_VM_GC_G1_G1PAGEBASEDVIRTUALSPACE_HPP
27
28 #include "memory/allocation.hpp"
29 #include "memory/memRegion.hpp"
30 #include "memory/virtualspace.hpp"
31 #include "utilities/align.hpp"
32 #include "utilities/bitMap.hpp"
33
34 class WorkGang;
35
36 // Virtual space management helper for a virtual space with an OS page allocation
37 // granularity.
38 // (De-)Allocation requests are always OS page aligned by passing a page index
39 // and multiples of pages.
40 // For systems that only commits of memory in a given size (always greater than
41 // page size) the base address is required to be aligned to that page size.
42 // The actual size requested need not be aligned to that page size, but the size
43 // of the reservation passed may be rounded up to this page size. Any fragment
44 // (less than the page size) of the actual size at the tail of the request will
45 // be committed using OS small pages.
46 // The implementation gives an error when trying to commit or uncommit pages that
47 // have already been committed or uncommitted.
48 class G1PageBasedVirtualSpace VALUE_OBJ_CLASS_SPEC {
49 friend class VMStructs;
50 private:
51 // Reserved area addresses.
52 char* _low_boundary;
53 char* _high_boundary;
54
55 // The size of the tail in bytes of the handled space that needs to be committed
56 // using small pages.
57 size_t _tail_size;
58
59 // The preferred page size used for commit/uncommit in bytes.
60 size_t _page_size;
61
62 // Bitmap used for verification of commit/uncommit operations.
63 CHeapBitMap _committed;
64
65 // Bitmap used to keep track of which pages are dirty or not for _special
66 // spaces. This is needed because for those spaces the underlying memory
67 // will only be zero filled the first time it is committed. Calls to commit
68 // will use this bitmap and return whether or not the memory is zero filled.
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_G1_G1PAGEBASEDVIRTUALSPACE_HPP
26 #define SHARE_VM_GC_G1_G1PAGEBASEDVIRTUALSPACE_HPP
27
28 #include "memory/memRegion.hpp"
29 #include "memory/virtualspace.hpp"
30 #include "utilities/align.hpp"
31 #include "utilities/bitMap.hpp"
32
33 class WorkGang;
34
35 // Virtual space management helper for a virtual space with an OS page allocation
36 // granularity.
37 // (De-)Allocation requests are always OS page aligned by passing a page index
38 // and multiples of pages.
39 // For systems that only commits of memory in a given size (always greater than
40 // page size) the base address is required to be aligned to that page size.
41 // The actual size requested need not be aligned to that page size, but the size
42 // of the reservation passed may be rounded up to this page size. Any fragment
43 // (less than the page size) of the actual size at the tail of the request will
44 // be committed using OS small pages.
45 // The implementation gives an error when trying to commit or uncommit pages that
46 // have already been committed or uncommitted.
47 class G1PageBasedVirtualSpace {
48 friend class VMStructs;
49 private:
50 // Reserved area addresses.
51 char* _low_boundary;
52 char* _high_boundary;
53
54 // The size of the tail in bytes of the handled space that needs to be committed
55 // using small pages.
56 size_t _tail_size;
57
58 // The preferred page size used for commit/uncommit in bytes.
59 size_t _page_size;
60
61 // Bitmap used for verification of commit/uncommit operations.
62 CHeapBitMap _committed;
63
64 // Bitmap used to keep track of which pages are dirty or not for _special
65 // spaces. This is needed because for those spaces the underlying memory
66 // will only be zero filled the first time it is committed. Calls to commit
67 // will use this bitmap and return whether or not the memory is zero filled.
|