1 /*
2 * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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 // VirtualSpace for the parallel scavenge collector.
26 //
27 // VirtualSpace is data structure for committing a previously reserved address
28 // range in smaller chunks.
29
30 class PSVirtualSpace : public CHeapObj {
31 friend class VMStructs;
32 protected:
33 // The space is committed/uncommited in chunks of size _alignment. The
34 // ReservedSpace passed to initialize() must be aligned to this value.
35 const size_t _alignment;
36
37 // Reserved area
38 char* _reserved_low_addr;
39 char* _reserved_high_addr;
40
41 // Committed area
42 char* _committed_low_addr;
43 char* _committed_high_addr;
44
156 }
157
158 inline size_t PSVirtualSpace::uncommitted_size() const {
159 return reserved_size() - committed_size();
160 }
161
162 inline void PSVirtualSpace::set_reserved(char* low_addr, char* high_addr, bool special) {
163 _reserved_low_addr = low_addr;
164 _reserved_high_addr = high_addr;
165 _special = special;
166 }
167
168 inline void PSVirtualSpace::set_reserved(ReservedSpace rs) {
169 set_reserved(rs.base(), rs.base() + rs.size(), rs.special());
170 }
171
172 inline void PSVirtualSpace::set_committed(char* low_addr, char* high_addr) {
173 _committed_low_addr = low_addr;
174 _committed_high_addr = high_addr;
175 }
|
1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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_PARALLELSCAVENGE_PSVIRTUALSPACE_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSVIRTUALSPACE_HPP
27
28 #include "runtime/virtualspace.hpp"
29
30 // VirtualSpace for the parallel scavenge collector.
31 //
32 // VirtualSpace is data structure for committing a previously reserved address
33 // range in smaller chunks.
34
35 class PSVirtualSpace : public CHeapObj {
36 friend class VMStructs;
37 protected:
38 // The space is committed/uncommited in chunks of size _alignment. The
39 // ReservedSpace passed to initialize() must be aligned to this value.
40 const size_t _alignment;
41
42 // Reserved area
43 char* _reserved_low_addr;
44 char* _reserved_high_addr;
45
46 // Committed area
47 char* _committed_low_addr;
48 char* _committed_high_addr;
49
161 }
162
163 inline size_t PSVirtualSpace::uncommitted_size() const {
164 return reserved_size() - committed_size();
165 }
166
167 inline void PSVirtualSpace::set_reserved(char* low_addr, char* high_addr, bool special) {
168 _reserved_low_addr = low_addr;
169 _reserved_high_addr = high_addr;
170 _special = special;
171 }
172
173 inline void PSVirtualSpace::set_reserved(ReservedSpace rs) {
174 set_reserved(rs.base(), rs.base() + rs.size(), rs.special());
175 }
176
177 inline void PSVirtualSpace::set_committed(char* low_addr, char* high_addr) {
178 _committed_low_addr = low_addr;
179 _committed_high_addr = high_addr;
180 }
181
182 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSVIRTUALSPACE_HPP
|