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 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
37
38 MutableSpace::MutableSpace(size_t alignment): ImmutableSpace(), _top(NULL), _alignment(alignment) {
39 assert(MutableSpace::alignment() >= 0 &&
40 MutableSpace::alignment() % os::vm_page_size() == 0,
41 "Space should be aligned");
42 _mangler = new MutableSpaceMangler(this);
43 }
44
45 MutableSpace::~MutableSpace() {
46 delete _mangler;
47 }
48
49 void MutableSpace::numa_setup_pages(MemRegion mr, bool clear_space) {
50 if (!mr.is_empty()) {
51 size_t page_size = UseLargePages ? alignment() : os::vm_page_size();
52 HeapWord *start = (HeapWord*)round_to((intptr_t) mr.start(), page_size);
53 HeapWord *end = (HeapWord*)round_down((intptr_t) mr.end(), page_size);
54 if (end > start) {
55 size_t size = pointer_delta(end, start, sizeof(char));
56 if (clear_space) {
57 // Prefer page reallocation to migration.
58 os::free_memory((char*)start, size, page_size);
59 }
60 os::numa_make_global((char*)start, size);
|
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 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
37
38 MutableSpace::MutableSpace(size_t alignment): ImmutableSpace(), _top(NULL), _alignment(alignment) {
39 assert(MutableSpace::alignment() % os::vm_page_size() == 0,
40 "Space should be aligned");
41 _mangler = new MutableSpaceMangler(this);
42 }
43
44 MutableSpace::~MutableSpace() {
45 delete _mangler;
46 }
47
48 void MutableSpace::numa_setup_pages(MemRegion mr, bool clear_space) {
49 if (!mr.is_empty()) {
50 size_t page_size = UseLargePages ? alignment() : os::vm_page_size();
51 HeapWord *start = (HeapWord*)round_to((intptr_t) mr.start(), page_size);
52 HeapWord *end = (HeapWord*)round_down((intptr_t) mr.end(), page_size);
53 if (end > start) {
54 size_t size = pointer_delta(end, start, sizeof(char));
55 if (clear_space) {
56 // Prefer page reallocation to migration.
57 os::free_memory((char*)start, size, page_size);
58 }
59 os::numa_make_global((char*)start, size);
|