author | manc |
Mon, 14 Oct 2019 18:48:10 -0700 | |
changeset 58652 | 9b67dd88a931 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
1 |
/* |
41312 | 2 |
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
27247
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 |
#include "precompiled.hpp" |
41312 | 25 |
#include "unittest.hpp" |
27247
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 |
|
41312 | 28 |
class Metadata; |
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
29 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
30 |
template <typename T> |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
31 |
class TestChunkedList { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
32 |
typedef ChunkedList<T, mtOther> ChunkedListT; |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
33 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
34 |
public: |
41312 | 35 |
|
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
36 |
static void testEmpty() { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
37 |
ChunkedListT buffer; |
41312 | 38 |
ASSERT_EQ((size_t) 0, buffer.size()); |
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
39 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
40 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
41 |
static void testFull() { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
42 |
ChunkedListT buffer; |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
43 |
for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) { |
41312 | 44 |
buffer.push((T) i); |
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
45 |
} |
41312 | 46 |
ASSERT_EQ((size_t) ChunkedListT::BufferSize, buffer.size()); |
47 |
ASSERT_TRUE(buffer.is_full()); |
|
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
48 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
49 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
50 |
static void testSize() { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
51 |
ChunkedListT buffer; |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
52 |
for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) { |
41312 | 53 |
ASSERT_EQ((size_t) i, buffer.size()); |
54 |
buffer.push((T) i); |
|
55 |
ASSERT_EQ((size_t) (i + 1), buffer.size()); |
|
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
56 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
57 |
} |
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 |
static void testClear() { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
60 |
ChunkedListT buffer; |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
61 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
62 |
buffer.clear(); |
41312 | 63 |
ASSERT_EQ((size_t) 0, buffer.size()); |
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
64 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
65 |
for (uintptr_t i = 0; i < ChunkedListT::BufferSize / 2; i++) { |
41312 | 66 |
buffer.push((T) i); |
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
67 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
68 |
buffer.clear(); |
41312 | 69 |
ASSERT_EQ((size_t) 0, buffer.size()); |
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
70 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
71 |
for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) { |
41312 | 72 |
buffer.push((T) i); |
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
73 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
74 |
buffer.clear(); |
41312 | 75 |
ASSERT_EQ((size_t) 0, buffer.size()); |
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
76 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
77 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
78 |
static void testAt() { |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
79 |
ChunkedListT buffer; |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
80 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
81 |
for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) { |
41312 | 82 |
buffer.push((T) i); |
83 |
ASSERT_EQ((T) i, buffer.at(i)); |
|
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
84 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
85 |
|
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
86 |
for (uintptr_t i = 0; i < ChunkedListT::BufferSize; i++) { |
41312 | 87 |
ASSERT_EQ((T) i, buffer.at(i)); |
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
88 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
89 |
} |
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 |
|
41312 | 92 |
TEST(ChunkedList, metadata_empty) { |
93 |
TestChunkedList<Metadata*>::testEmpty(); |
|
94 |
} |
|
95 |
||
96 |
TEST(ChunkedList, metadata_full) { |
|
97 |
TestChunkedList<Metadata*>::testFull(); |
|
98 |
} |
|
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
99 |
|
41312 | 100 |
TEST(ChunkedList, metadata_size) { |
101 |
TestChunkedList<Metadata*>::testSize(); |
|
102 |
} |
|
103 |
||
104 |
TEST(ChunkedList, metadata_clear) { |
|
105 |
TestChunkedList<Metadata*>::testSize(); |
|
106 |
} |
|
107 |
||
108 |
TEST(ChunkedList, metadata_at) { |
|
109 |
TestChunkedList<Metadata*>::testAt(); |
|
27247
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
110 |
} |
99db666dbe8e
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
111 |
|
41312 | 112 |
TEST(ChunkedList, size_t_empty) { |
113 |
TestChunkedList<size_t>::testEmpty(); |
|
114 |
} |
|
115 |
||
116 |
TEST(ChunkedList, size_t_full) { |
|
117 |
TestChunkedList<size_t>::testFull(); |
|
118 |
} |
|
119 |
||
120 |
TEST(ChunkedList, size_t_size) { |
|
121 |
TestChunkedList<size_t>::testSize(); |
|
122 |
} |
|
123 |
||
124 |
TEST(ChunkedList, size_t_clear) { |
|
125 |
TestChunkedList<size_t>::testSize(); |
|
126 |
} |
|
127 |
||
128 |
TEST(ChunkedList, size_t_at) { |
|
129 |
TestChunkedList<size_t>::testAt(); |
|
130 |
} |