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
50 // Release parts of an already-reserved memory region [addr, addr + len) to
51 // get a new region that has "compound alignment." Return the start of the
52 // resulting region, or NULL on failure.
53 //
54 // The region is logically divided into a prefix and a suffix. The prefix
55 // starts at the result address, which is aligned to prefix_align. The suffix
56 // starts at result address + prefix_size, which is aligned to suffix_align.
57 // The total size of the result region is size prefix_size + suffix_size.
58 char* align_reserved_region(char* addr, const size_t len,
59 const size_t prefix_size,
60 const size_t prefix_align,
61 const size_t suffix_size,
62 const size_t suffix_align);
63
64 // Reserve memory, call align_reserved_region() to alignment it and return the
65 // result.
66 char* reserve_and_align(const size_t reserve_size,
67 const size_t prefix_size,
68 const size_t prefix_align,
69 const size_t suffix_size,
|
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
39 // The base and size prior to any alignment done by this class; used only on
40 // systems that cannot release part of a region.
41 char* _raw_base;
42 size_t _raw_size;
43
44 size_t _alignment;
45 bool _special;
46 bool _executable;
47
48 // ReservedSpace
49 ReservedSpace(char* base, size_t size, size_t alignment, bool special,
50 bool executable);
51
52 bool failed_to_reserve_as_requested(char* base, char* requested_address,
53 const size_t size, bool special);
54 void initialize(size_t size, size_t alignment, bool large,
55 char* requested_address,
56 const size_t noaccess_prefix,
57 bool executable);
58
59 inline void set_raw_base_and_size(char * const raw_base, size_t raw_size);
60
61 // Release virtual address space. If alignment was done, use the saved
62 // address and size when releasing.
63 void release_memory(char * default_addr, size_t default_size);
64
65 // Release parts of an already-reserved memory region [addr, addr + len) to
66 // get a new region that has "compound alignment." Return the start of the
67 // resulting region, or NULL on failure.
68 //
69 // The region is logically divided into a prefix and a suffix. The prefix
70 // starts at the result address, which is aligned to prefix_align. The suffix
71 // starts at result address + prefix_size, which is aligned to suffix_align.
72 // The total size of the result region is size prefix_size + suffix_size.
73 char* align_reserved_region(char* addr, const size_t len,
74 const size_t prefix_size,
75 const size_t prefix_align,
76 const size_t suffix_size,
77 const size_t suffix_align);
78
79 // Reserve memory, call align_reserved_region() to alignment it and return the
80 // result.
81 char* reserve_and_align(const size_t reserve_size,
82 const size_t prefix_size,
83 const size_t prefix_align,
84 const size_t suffix_size,
|