1 /*
2 * Copyright (c) 2003, 2015, 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 *
58 // then the high_boundary of L and the low_boundary of H must be
59 // moved up consistently. AdjoiningVirtualSpaces provide the
60 // interfaces for moving the this boundary.
61
62 class AdjoiningVirtualSpaces {
63 // space at the high end and the low end, respectively
64 PSVirtualSpace* _high;
65 PSVirtualSpace* _low;
66
67 // The reserved space spanned by the two spaces.
68 ReservedSpace _reserved_space;
69
70 // The minimum byte size for the low space. It will not
71 // be shrunk below this value.
72 size_t _min_low_byte_size;
73 // Same for the high space
74 size_t _min_high_byte_size;
75
76 const size_t _alignment;
77
78 public:
79 // Allocates two virtual spaces that will be located at the
80 // high and low ends. Does no initialization.
81 AdjoiningVirtualSpaces(ReservedSpace rs,
82 size_t min_low_byte_size,
83 size_t min_high_byte_size,
84 size_t alignment);
85
86 // accessors
87 PSVirtualSpace* high() { return _high; }
88 PSVirtualSpace* low() { return _low; }
89 ReservedSpace reserved_space() { return _reserved_space; }
90 size_t min_low_byte_size() { return _min_low_byte_size; }
91 size_t min_high_byte_size() { return _min_high_byte_size; }
92 size_t alignment() const { return _alignment; }
93
94 // move boundary between the two spaces up
95 bool adjust_boundary_up(size_t size_in_bytes);
96 // and down
97 bool adjust_boundary_down(size_t size_in_bytes);
98
99 // Maximum byte size for the high space.
100 size_t high_byte_size_limit() {
101 return _reserved_space.size() - _min_low_byte_size;
102 }
103 // Maximum byte size for the low space.
104 size_t low_byte_size_limit() {
105 return _reserved_space.size() - _min_high_byte_size;
106 }
107
108 // Sets the boundaries for the virtual spaces and commits and
109 // initial size;
110 void initialize(size_t max_low_byte_size,
111 size_t init_low_byte_size,
112 size_t init_high_byte_size);
113 };
114
115 #endif // SHARE_VM_GC_PARALLEL_ADJOININGVIRTUALSPACES_HPP
|
1 /*
2 * Copyright (c) 2003, 2018, 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 *
58 // then the high_boundary of L and the low_boundary of H must be
59 // moved up consistently. AdjoiningVirtualSpaces provide the
60 // interfaces for moving the this boundary.
61
62 class AdjoiningVirtualSpaces {
63 // space at the high end and the low end, respectively
64 PSVirtualSpace* _high;
65 PSVirtualSpace* _low;
66
67 // The reserved space spanned by the two spaces.
68 ReservedSpace _reserved_space;
69
70 // The minimum byte size for the low space. It will not
71 // be shrunk below this value.
72 size_t _min_low_byte_size;
73 // Same for the high space
74 size_t _min_high_byte_size;
75
76 const size_t _alignment;
77
78 int _nvdimm_fd;
79
80 public:
81 // Allocates two virtual spaces that will be located at the
82 // high and low ends. Does no initialization.
83 AdjoiningVirtualSpaces(ReservedSpace rs,
84 size_t min_low_byte_size,
85 size_t min_high_byte_size,
86 size_t alignment);
87
88 // accessors
89 PSVirtualSpace* high() { return _high; }
90 PSVirtualSpace* low() { return _low; }
91 ReservedSpace reserved_space() { return _reserved_space; }
92 size_t min_low_byte_size() { return _min_low_byte_size; }
93 size_t min_high_byte_size() { return _min_high_byte_size; }
94 size_t alignment() const { return _alignment; }
95
96 // move boundary between the two spaces up
97 bool adjust_boundary_up(size_t size_in_bytes);
98 // and down
99 bool adjust_boundary_down(size_t size_in_bytes);
100
101 // Maximum byte size for the high space.
102 size_t high_byte_size_limit() {
103 return _reserved_space.size() - _min_low_byte_size;
104 }
105 // Maximum byte size for the low space.
106 size_t low_byte_size_limit() {
107 return _reserved_space.size() - _min_high_byte_size;
108 }
109
110 // Sets the boundaries for the virtual spaces and commits and
111 // initial size;
112 void initialize(size_t max_low_byte_size,
113 size_t init_low_byte_size,
114 size_t init_high_byte_size);
115 void setup_fd(int fd) {_nvdimm_fd = fd; }
116 int nvdimm_fd() const {return _nvdimm_fd; }
117 };
118
119 #endif // SHARE_VM_GC_PARALLEL_ADJOININGVIRTUALSPACES_HPP
|