5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
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_IMPLEMENTATION_G1_G1PAGEBASEDVIRTUALSPACE_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1PAGEBASEDVIRTUALSPACE_HPP
27
28 #include "memory/allocation.hpp"
29 #include "memory/memRegion.hpp"
30 #include "memory/virtualspace.hpp"
31 #include "utilities/bitMap.hpp"
32
33 // Virtual space management helper for a virtual space with an OS page allocation
34 // granularity.
35 // (De-)Allocation requests are always OS page aligned by passing a page index
36 // and multiples of pages.
37 // For systems that only commits of memory in a given size (always greater than
38 // page size) the base address is required to be aligned to that page size.
39 // The actual size requested need not be aligned to that page size, but the size
40 // of the reservation passed may be rounded up to this page size. Any fragment
41 // (less than the page size) of the actual size at the tail of the request will
42 // be committed using OS small pages.
43 // The implementation gives an error when trying to commit or uncommit pages that
44 // have already been committed or uncommitted.
45 class G1PageBasedVirtualSpace VALUE_OBJ_CLASS_SPEC {
46 friend class VMStructs;
131 size_t committed_size() const;
132 // Memory left to use/expand in this virtual space.
133 size_t uncommitted_size() const;
134
135 bool contains(const void* p) const;
136
137 MemRegion reserved() {
138 MemRegion x((HeapWord*)_low_boundary, reserved_size() / HeapWordSize);
139 return x;
140 }
141
142 void release();
143
144 void check_for_contiguity() PRODUCT_RETURN;
145
146 // Debugging
147 void print_on(outputStream* out) PRODUCT_RETURN;
148 void print();
149 };
150
151 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1PAGEBASEDVIRTUALSPACE_HPP
|
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
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/bitMap.hpp"
32
33 // Virtual space management helper for a virtual space with an OS page allocation
34 // granularity.
35 // (De-)Allocation requests are always OS page aligned by passing a page index
36 // and multiples of pages.
37 // For systems that only commits of memory in a given size (always greater than
38 // page size) the base address is required to be aligned to that page size.
39 // The actual size requested need not be aligned to that page size, but the size
40 // of the reservation passed may be rounded up to this page size. Any fragment
41 // (less than the page size) of the actual size at the tail of the request will
42 // be committed using OS small pages.
43 // The implementation gives an error when trying to commit or uncommit pages that
44 // have already been committed or uncommitted.
45 class G1PageBasedVirtualSpace VALUE_OBJ_CLASS_SPEC {
46 friend class VMStructs;
131 size_t committed_size() const;
132 // Memory left to use/expand in this virtual space.
133 size_t uncommitted_size() const;
134
135 bool contains(const void* p) const;
136
137 MemRegion reserved() {
138 MemRegion x((HeapWord*)_low_boundary, reserved_size() / HeapWordSize);
139 return x;
140 }
141
142 void release();
143
144 void check_for_contiguity() PRODUCT_RETURN;
145
146 // Debugging
147 void print_on(outputStream* out) PRODUCT_RETURN;
148 void print();
149 };
150
151 #endif // SHARE_VM_GC_G1_G1PAGEBASEDVIRTUALSPACE_HPP
|