author | kzhaldyb |
Tue, 14 Jun 2016 19:15:27 +0300 | |
changeset 39280 | 86907793a181 |
parent 38256 | 685ac27ed264 |
child 39618 | ced8c3f59678 |
permissions | -rw-r--r-- |
38256
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
1 |
/* |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
4 |
* |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
8 |
* |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
13 |
* accompanied this code). |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
14 |
* |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
18 |
* |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
21 |
* questions. |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
22 |
* |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
23 |
*/ |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
24 |
|
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
25 |
The test checks that after different type of GC unreachable objects behave as expected: |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
26 |
|
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
27 |
1. Young GC - weakly referenced non-humongous objects are collected, other objects are not collected. |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
28 |
|
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
29 |
2. Full GC - weakly referenced non-humongous and humongous objects are collected, softly referenced non-humongous and |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
30 |
humongous objects are not collected. |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
31 |
|
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
32 |
3. Full GC with memory pressure - weakly and softly referenced non-humongous and humongous objects are collected. |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
33 |
|
39280
86907793a181
8132713: Add tests which check that Humongous objects behave as expected after finishing ConcMark Cycle
kzhaldyb
parents:
38256
diff
changeset
|
34 |
4. CMC - weakly referenced non-humongous objects are collected, other objects are not collected since weak references |
86907793a181
8132713: Add tests which check that Humongous objects behave as expected after finishing ConcMark Cycle
kzhaldyb
parents:
38256
diff
changeset
|
35 |
from Young Gen is handled as strong during CMC. |
86907793a181
8132713: Add tests which check that Humongous objects behave as expected after finishing ConcMark Cycle
kzhaldyb
parents:
38256
diff
changeset
|
36 |
|
86907793a181
8132713: Add tests which check that Humongous objects behave as expected after finishing ConcMark Cycle
kzhaldyb
parents:
38256
diff
changeset
|
37 |
5. CMC_NO_SURV_ROOTS - weakly referenced non-humongous and humongous objects are collected, softly referenced |
86907793a181
8132713: Add tests which check that Humongous objects behave as expected after finishing ConcMark Cycle
kzhaldyb
parents:
38256
diff
changeset
|
38 |
non-humongous and humongous objects are not collected since we make 2 Young GC to promote all |
86907793a181
8132713: Add tests which check that Humongous objects behave as expected after finishing ConcMark Cycle
kzhaldyb
parents:
38256
diff
changeset
|
39 |
weak references to Old Gen. |
86907793a181
8132713: Add tests which check that Humongous objects behave as expected after finishing ConcMark Cycle
kzhaldyb
parents:
38256
diff
changeset
|
40 |
|
38256
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
41 |
The test gets gc type as a command line argument. |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
42 |
Then the test allocates object graph in heap (currently testing scenarios are pre-generated and stored in |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
43 |
TestcaseData.getPregeneratedTestcases()) with TestObjectGraphAfterGC::allocateObjectGraph. |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
44 |
|
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
45 |
Since we are testing humongous objects we need pretty unusual nodes - arrays of Object. |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
46 |
We need this since only large enough array could be Humongous object (in fact class with huge amount of fields is |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
47 |
humongous too but it's for other tests). |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
48 |
ObjectGraph class generates object graph with Object[] nodes. It also provides a way to collect |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
49 |
information about each node using "visitor" pattern. |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
50 |
|
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
51 |
Using visitors we build Set of ReferenceInfo instances which contains the following information: |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
52 |
reference - external weak/soft reference to graph's node |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
53 |
graphId and nodeId - graph's and node's ids - we need this for error handling |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
54 |
softlyReachable - is node effectively referenced by external soft reference. It could be when external |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
55 |
soft reference or when this node is reachable from node that exteranally referenced by soft reference |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
56 |
effectiveHumongous - if node behaves effectively humongous. It could be when node is humongous |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
57 |
or when this node is reachable from humongous node. |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
58 |
|
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
59 |
When we leave TestObjectGraphAfterGC::allocateObjectGraph we make graph reachable only with references from Set of |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
60 |
ReferenceInfo instances. |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
61 |
|
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
62 |
We run specified gc and check that each instance of ReferenceInfo set behaves as expected. |
685ac27ed264
8132710: Add tests which check that Humongous objects behave as expected after Young GC
kzhaldyb
parents:
diff
changeset
|
63 |
Then we check that gc log file contains expected tokens and doesn't contain tokens that it should not contain. |