equal
deleted
inserted
replaced
27 #include <memory/metaspace/settings.hpp> |
27 #include <memory/metaspace/settings.hpp> |
28 #include "precompiled.hpp" |
28 #include "precompiled.hpp" |
29 |
29 |
30 #include "memory/metaspace/commitMask.hpp" |
30 #include "memory/metaspace/commitMask.hpp" |
31 #include "memory/metaspace/metaspaceCommon.hpp" |
31 #include "memory/metaspace/metaspaceCommon.hpp" |
|
32 #include "memory/metaspace/settings.hpp" |
32 #include "runtime/stubRoutines.hpp" |
33 #include "runtime/stubRoutines.hpp" |
33 |
34 |
34 #include "utilities/align.hpp" |
35 #include "utilities/align.hpp" |
35 #include "utilities/debug.hpp" |
36 #include "utilities/debug.hpp" |
36 |
37 |
59 // For each 0 bit, check if the associated granule is not accessible. Slow mode only. |
60 // For each 0 bit, check if the associated granule is not accessible. Slow mode only. |
60 |
61 |
61 assert_is_aligned(_base, _words_per_bit * BytesPerWord); |
62 assert_is_aligned(_base, _words_per_bit * BytesPerWord); |
62 assert_is_aligned(_word_size, _words_per_bit); |
63 assert_is_aligned(_word_size, _words_per_bit); |
63 |
64 |
64 if (slow) { |
|
65 assert(CanUseSafeFetch32, "We need SafeFetch for this test."); |
|
66 } |
|
67 |
|
68 if (do_touch_test) { |
65 if (do_touch_test) { |
69 for (idx_t i = 0; i < size(); i ++) { |
66 for (idx_t i = 0; i < size(); i ++) { |
70 const MetaWord* const p = _base + (i * _words_per_bit); |
67 const MetaWord* const p = _base + (i * _words_per_bit); |
71 if (at(i)) { |
68 if (at(i)) { |
72 // Should be accessible. Just touch it. |
69 // Should be accessible. Just touch it. |
75 // Should not be accessible. |
72 // Should not be accessible. |
76 if (slow) { |
73 if (slow) { |
77 // Note: results may differ between platforms. On Linux, this should be true since |
74 // Note: results may differ between platforms. On Linux, this should be true since |
78 // we uncommit memory by setting protection to PROT_NONE. We may have to look if |
75 // we uncommit memory by setting protection to PROT_NONE. We may have to look if |
79 // this works as expected on other platforms. |
76 // this works as expected on other platforms. |
80 if (CanUseSafeFetch32() && TEST_UNCOMMITTED_REGION) { |
77 if (TEST_UNCOMMITTED_REGION && CanUseSafeFetch32()) { |
81 assert(os::is_readable_pointer(p) == false, |
78 assert(os::is_readable_pointer(p) == false, |
82 "index %u, pointer " PTR_FORMAT ", should not be accessible.", |
79 "index %u, pointer " PTR_FORMAT ", should not be accessible.", |
83 (unsigned)i, p2i(p)); |
80 (unsigned)i, p2i(p)); |
84 } |
81 } |
85 } |
82 } |