equal
deleted
inserted
replaced
22 * questions. |
22 * questions. |
23 */ |
23 */ |
24 |
24 |
25 |
25 |
26 #include "precompiled.hpp" |
26 #include "precompiled.hpp" |
27 #include "metaspace/metaspaceTestsCommon.hpp" |
27 #include "runtime/os.hpp" |
|
28 |
|
29 #include "metaspaceTestsCommon.hpp" |
28 |
30 |
29 static int get_random(int limit) { return os::random() % limit; } |
31 static int get_random(int limit) { return os::random() % limit; } |
30 |
32 |
31 class CommitMaskTest { |
33 class CommitMaskTest { |
32 const MetaWord* const _base; |
34 const MetaWord* const _base; |
41 } |
43 } |
42 |
44 |
43 // Return a random sub range within [_base.._base + word_size), |
45 // Return a random sub range within [_base.._base + word_size), |
44 // aligned to granule size |
46 // aligned to granule size |
45 const MetaWord* calc_random_subrange(size_t* p_word_size) { |
47 const MetaWord* calc_random_subrange(size_t* p_word_size) { |
46 size_t l1 = get_random(_word_size); |
48 size_t l1 = get_random((int)_word_size); |
47 size_t l2 = get_random(_word_size); |
49 size_t l2 = get_random((int)_word_size); |
48 if (l1 > l2) { |
50 if (l1 > l2) { |
49 size_t l = l1; |
51 size_t l = l1; |
50 l1 = l2; |
52 l1 = l2; |
51 l2 = l; |
53 l2 = l; |
52 } |
54 } |