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 #include "precompiled.hpp"
26 #include "runtime/atomic.inline.hpp"
27 #include "utilities/macros.hpp"
28 #if INCLUDE_ALL_GCS
29 #include "gc_implementation/shared/mutableSpace.hpp"
30 #include "gc_implementation/shared/spaceDecorator.hpp"
31 #include "oops/oop.inline.hpp"
32 #include "runtime/safepoint.hpp"
33 #include "runtime/thread.hpp"
34 #endif // INCLUDE_ALL_GCS
35
36 MutableSpace::MutableSpace(size_t alignment): ImmutableSpace(), _top(NULL), _alignment(alignment) {
37 assert(MutableSpace::alignment() % os::vm_page_size() == 0,
38 "Space should be aligned");
39 _mangler = new MutableSpaceMangler(this);
40 }
41
42 MutableSpace::~MutableSpace() {
43 delete _mangler;
44 }
45
46 void MutableSpace::numa_setup_pages(MemRegion mr, bool clear_space) {
47 if (!mr.is_empty()) {
48 size_t page_size = UseLargePages ? alignment() : os::vm_page_size();
49 HeapWord *start = (HeapWord*)round_to((intptr_t) mr.start(), page_size);
50 HeapWord *end = (HeapWord*)round_down((intptr_t) mr.end(), page_size);
51 if (end > start) {
52 size_t size = pointer_delta(end, start, sizeof(char));
53 if (clear_space) {
54 // Prefer page reallocation to migration.
|
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 #include "precompiled.hpp"
26 #include "gc/parallel/mutableSpace.hpp"
27 #include "gc/shared/spaceDecorator.hpp"
28 #include "oops/oop.inline.hpp"
29 #include "runtime/atomic.inline.hpp"
30 #include "runtime/safepoint.hpp"
31 #include "runtime/thread.hpp"
32 #include "utilities/macros.hpp"
33
34 MutableSpace::MutableSpace(size_t alignment): ImmutableSpace(), _top(NULL), _alignment(alignment) {
35 assert(MutableSpace::alignment() % os::vm_page_size() == 0,
36 "Space should be aligned");
37 _mangler = new MutableSpaceMangler(this);
38 }
39
40 MutableSpace::~MutableSpace() {
41 delete _mangler;
42 }
43
44 void MutableSpace::numa_setup_pages(MemRegion mr, bool clear_space) {
45 if (!mr.is_empty()) {
46 size_t page_size = UseLargePages ? alignment() : os::vm_page_size();
47 HeapWord *start = (HeapWord*)round_to((intptr_t) mr.start(), page_size);
48 HeapWord *end = (HeapWord*)round_down((intptr_t) mr.end(), page_size);
49 if (end > start) {
50 size_t size = pointer_delta(end, start, sizeof(char));
51 if (clear_space) {
52 // Prefer page reallocation to migration.
|