1 /*
2 * Copyright (c) 1997, 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 // ReservedSpace is a data structure for reserving a contiguous address range.
26
27 class ReservedSpace VALUE_OBJ_CLASS_SPEC {
28 friend class VMStructs;
29 private:
30 char* _base;
31 size_t _size;
32 size_t _noaccess_prefix;
33 size_t _alignment;
34 bool _special;
35 bool _executable;
36
37 // ReservedSpace
38 ReservedSpace(char* base, size_t size, size_t alignment, bool special,
39 bool executable);
40 void initialize(size_t size, size_t alignment, bool large,
41 char* requested_address,
42 const size_t noaccess_prefix,
43 bool executable);
44
206 // Destruction
207 ~VirtualSpace();
208
209 // Testers (all sizes are byte sizes)
210 size_t committed_size() const;
211 size_t reserved_size() const;
212 size_t uncommitted_size() const;
213 bool contains(const void* p) const;
214
215 // Operations
216 // returns true on success, false otherwise
217 bool expand_by(size_t bytes, bool pre_touch = false);
218 void shrink_by(size_t bytes);
219 void release();
220
221 void check_for_contiguity() PRODUCT_RETURN;
222
223 // Debugging
224 void print() PRODUCT_RETURN;
225 };
|
1 /*
2 * Copyright (c) 1997, 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_RUNTIME_VIRTUALSPACE_HPP
26 #define SHARE_VM_RUNTIME_VIRTUALSPACE_HPP
27
28 #include "memory/allocation.hpp"
29
30 // ReservedSpace is a data structure for reserving a contiguous address range.
31
32 class ReservedSpace VALUE_OBJ_CLASS_SPEC {
33 friend class VMStructs;
34 private:
35 char* _base;
36 size_t _size;
37 size_t _noaccess_prefix;
38 size_t _alignment;
39 bool _special;
40 bool _executable;
41
42 // ReservedSpace
43 ReservedSpace(char* base, size_t size, size_t alignment, bool special,
44 bool executable);
45 void initialize(size_t size, size_t alignment, bool large,
46 char* requested_address,
47 const size_t noaccess_prefix,
48 bool executable);
49
211 // Destruction
212 ~VirtualSpace();
213
214 // Testers (all sizes are byte sizes)
215 size_t committed_size() const;
216 size_t reserved_size() const;
217 size_t uncommitted_size() const;
218 bool contains(const void* p) const;
219
220 // Operations
221 // returns true on success, false otherwise
222 bool expand_by(size_t bytes, bool pre_touch = false);
223 void shrink_by(size_t bytes);
224 void release();
225
226 void check_for_contiguity() PRODUCT_RETURN;
227
228 // Debugging
229 void print() PRODUCT_RETURN;
230 };
231
232 #endif // SHARE_VM_RUNTIME_VIRTUALSPACE_HPP
|