Mercurial > hg > graal-jvmci-8
annotate src/share/vm/utilities/chunkedList.cpp @ 24164:f98ea2d742a2
fixed missing exception propagation (JDK-8185790)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 08 Aug 2017 10:06:50 +0200 |
parents | b12a2a9b05ca |
children |
rev | line source |
---|---|
20619
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
1 /* |
b12a2a9b05ca
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. |
b12a2a9b05ca
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. |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
4 * |
b12a2a9b05ca
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 |
b12a2a9b05ca
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 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
8 * |
b12a2a9b05ca
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 |
b12a2a9b05ca
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 |
b12a2a9b05ca
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 |
b12a2a9b05ca
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 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
13 * accompanied this code). |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
14 * |
b12a2a9b05ca
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 |
b12a2a9b05ca
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, |
b12a2a9b05ca
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. |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
18 * |
b12a2a9b05ca
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 |
b12a2a9b05ca
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 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
21 * questions. |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
22 * |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
23 */ |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
24 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
25 #include "precompiled.hpp" |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
26 #include "utilities/chunkedList.hpp" |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
27 #include "utilities/debug.hpp" |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
28 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
29 /////////////// Unit tests /////////////// |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
30 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
31 #ifndef PRODUCT |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
32 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
33 template <typename T> |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
34 class TestChunkedList { |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
35 typedef ChunkedList<T, mtOther> ChunkedListT; |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
36 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
37 public: |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
38 static void testEmpty() { |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
39 ChunkedListT buffer; |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
40 assert(buffer.size() == 0, "assert"); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
41 } |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
42 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
43 static void testFull() { |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
44 ChunkedListT buffer; |
b12a2a9b05ca
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++) { |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
46 buffer.push((T)i); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
47 } |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
48 assert(buffer.size() == ChunkedListT::BufferSize, "assert"); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
49 assert(buffer.is_full(), "assert"); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
50 } |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
51 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
52 static void testSize() { |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
53 ChunkedListT buffer; |
b12a2a9b05ca
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++) { |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
55 assert(buffer.size() == i, "assert"); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
56 buffer.push((T)i); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
57 assert(buffer.size() == i + 1, "assert"); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
58 } |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
59 } |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
60 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
61 static void testClear() { |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
62 ChunkedListT buffer; |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
63 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
64 buffer.clear(); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
65 assert(buffer.size() == 0, "assert"); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
66 |
b12a2a9b05ca
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++) { |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
68 buffer.push((T)i); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
69 } |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
70 buffer.clear(); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
71 assert(buffer.size() == 0, "assert"); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
72 |
b12a2a9b05ca
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++) { |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
74 buffer.push((T)i); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
75 } |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
76 buffer.clear(); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
77 assert(buffer.size() == 0, "assert"); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
78 } |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
79 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
80 static void testAt() { |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
81 ChunkedListT buffer; |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
82 |
b12a2a9b05ca
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++) { |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
84 buffer.push((T)i); |
b12a2a9b05ca
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"); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
86 } |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
87 |
b12a2a9b05ca
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++) { |
b12a2a9b05ca
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"); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
90 } |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
91 } |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
92 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
93 static void test() { |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
94 testEmpty(); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
95 testFull(); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
96 testSize(); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
97 testClear(); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
98 testAt(); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
99 } |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
100 }; |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
101 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
102 class Metadata; |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
103 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
104 void TestChunkedList_test() { |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
105 TestChunkedList<Metadata*>::test(); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
106 TestChunkedList<size_t>::test(); |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
107 } |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
108 |
b12a2a9b05ca
8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents:
diff
changeset
|
109 #endif |