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