author | stefank |
Tue, 05 Apr 2016 10:35:39 +0200 | |
changeset 37254 | 8631304f255c |
parent 27247 | 99db666dbe8e |
permissions | -rw-r--r-- |
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
1 |
/* |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
4 |
* |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
8 |
* |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
13 |
* accompanied this code). |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
14 |
* |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
18 |
* |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
21 |
* questions. |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
22 |
* |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
23 |
*/ |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
24 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
25 |
#include "precompiled.hpp" |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
26 |
#include "utilities/chunkedList.hpp" |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
27 |
#include "utilities/debug.hpp" |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
28 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
29 |
/////////////// Unit tests /////////////// |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
30 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
31 |
#ifndef PRODUCT |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
32 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
33 |
template <typename T> |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
34 |
class TestChunkedList { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
35 |
typedef ChunkedList<T, mtOther> ChunkedListT; |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
36 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
37 |
public: |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
38 |
static void testEmpty() { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
39 |
ChunkedListT buffer; |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
40 |
assert(buffer.size() == 0, "assert"); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
41 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
42 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
43 |
static void testFull() { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
44 |
ChunkedListT buffer; |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
45 |
for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
46 |
buffer.push((T)i); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
47 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
48 |
assert(buffer.size() == ChunkedListT::BufferSize, "assert"); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
49 |
assert(buffer.is_full(), "assert"); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
50 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
51 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
52 |
static void testSize() { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
53 |
ChunkedListT buffer; |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
54 |
for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
55 |
assert(buffer.size() == i, "assert"); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
56 |
buffer.push((T)i); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
57 |
assert(buffer.size() == i + 1, "assert"); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
58 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
59 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
60 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
61 |
static void testClear() { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
62 |
ChunkedListT buffer; |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
63 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
64 |
buffer.clear(); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
65 |
assert(buffer.size() == 0, "assert"); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
66 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
67 |
for (uintptr_t i = 0; i < ChunkedListT::BufferSize / 2; i++) { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
68 |
buffer.push((T)i); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
69 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
70 |
buffer.clear(); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
71 |
assert(buffer.size() == 0, "assert"); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
72 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
73 |
for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
74 |
buffer.push((T)i); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
75 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
76 |
buffer.clear(); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
77 |
assert(buffer.size() == 0, "assert"); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
78 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
79 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
80 |
static void testAt() { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
81 |
ChunkedListT buffer; |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
82 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
83 |
for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
84 |
buffer.push((T)i); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
85 |
assert(buffer.at(i) == (T)i, "assert"); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
86 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
87 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
88 |
for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
89 |
assert(buffer.at(i) == (T)i, "assert"); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
90 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
91 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
92 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
93 |
static void test() { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
94 |
testEmpty(); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
95 |
testFull(); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
96 |
testSize(); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
97 |
testClear(); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
98 |
testAt(); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
99 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
100 |
}; |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
101 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
102 |
class Metadata; |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
103 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
104 |
void TestChunkedList_test() { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
105 |
TestChunkedList<Metadata*>::test(); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
106 |
TestChunkedList<size_t>::test(); |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
107 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
108 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
109 |
#endif |