author | jlahoda |
Mon, 13 Feb 2017 09:37:26 +0100 | |
changeset 43772 | 4e5350b7be75 |
parent 41705 | 332239c052cc |
permissions | -rw-r--r-- |
23506
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
1 |
/* |
41705
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
2 |
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
4 |
* |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
7 |
* published by the Free Software Foundation. |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
8 |
* |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
13 |
* accompanied this code). |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
14 |
* |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
18 |
* |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
21 |
* questions. |
332239c052cc
8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents:
40631
diff
changeset
|
22 |
*/ |
23506
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
23 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
24 |
/* |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
25 |
* @test TestObjectTenuringFlags |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
26 |
* @key gc |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
27 |
* @bug 6521376 |
39414
4adf52148100
8160088: update hotspot tests depending on GC to use @requires vm.gc.X
dfazunen
parents:
36851
diff
changeset
|
28 |
* @requires vm.gc.Parallel |
23506
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
29 |
* @summary Tests argument processing for NeverTenure, AlwaysTenure, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
30 |
* and MaxTenuringThreshold |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39414
diff
changeset
|
31 |
* @library /test/lib |
36851 | 32 |
* @modules java.base/jdk.internal.misc |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
23506
diff
changeset
|
33 |
* java.management |
23506
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
34 |
* @run main/othervm TestObjectTenuringFlags |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
35 |
*/ |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
36 |
|
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39414
diff
changeset
|
37 |
import jdk.test.lib.process.OutputAnalyzer; |
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
39414
diff
changeset
|
38 |
import jdk.test.lib.process.ProcessTools; |
23506
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
39 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
40 |
import java.util.*; |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
41 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
42 |
public class TestObjectTenuringFlags { |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
43 |
public static void main(String args[]) throws Exception { |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
44 |
// default case |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
45 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
46 |
new String[]{}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
47 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
48 |
new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 7, 15)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
49 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
50 |
// valid cases |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
51 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
52 |
new String[]{"-XX:+NeverTenure"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
53 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
54 |
new ExpectedTenuringFlags(false /* alwaysTenure */, true /* neverTenure */, 7, 16)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
55 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
56 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
57 |
new String[]{"-XX:+AlwaysTenure"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
58 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
59 |
new ExpectedTenuringFlags(true /* alwaysTenure */, false /* neverTenure */, 0, 0)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
60 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
61 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
62 |
new String[]{"-XX:MaxTenuringThreshold=0"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
63 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
64 |
new ExpectedTenuringFlags(true /* alwaysTenure */, false /* neverTenure */, 0, 0)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
65 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
66 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
67 |
new String[]{"-XX:MaxTenuringThreshold=5"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
68 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
69 |
new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 5, 5)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
70 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
71 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
72 |
new String[]{"-XX:MaxTenuringThreshold=10"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
73 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
74 |
new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 7, 10)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
75 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
76 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
77 |
new String[]{"-XX:MaxTenuringThreshold=15"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
78 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
79 |
new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 7, 15)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
80 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
81 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
82 |
new String[]{"-XX:MaxTenuringThreshold=16"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
83 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
84 |
new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 7, 16)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
85 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
86 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
87 |
new String[]{"-XX:InitialTenuringThreshold=0"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
88 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
89 |
new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 0, 15)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
90 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
91 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
92 |
new String[]{"-XX:InitialTenuringThreshold=5"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
93 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
94 |
new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 5, 15)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
95 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
96 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
97 |
new String[]{"-XX:InitialTenuringThreshold=10"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
98 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
99 |
new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 10, 15)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
100 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
101 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
102 |
new String[]{"-XX:InitialTenuringThreshold=15"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
103 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
104 |
new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 15, 15)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
105 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
106 |
// "Last option wins" cases |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
107 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
108 |
new String[]{"-XX:+AlwaysTenure", "-XX:+NeverTenure"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
109 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
110 |
new ExpectedTenuringFlags(false /* alwaysTenure */, true /* neverTenure */, 7, 16)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
111 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
112 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
113 |
new String[]{"-XX:+NeverTenure", "-XX:+AlwaysTenure"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
114 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
115 |
new ExpectedTenuringFlags(true /* alwaysTenure */, false /* neverTenure */, 0, 0)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
116 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
117 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
118 |
new String[]{"-XX:MaxTenuringThreshold=16", "-XX:+AlwaysTenure"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
119 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
120 |
new ExpectedTenuringFlags(true /* alwaysTenure */, false /* neverTenure */, 0, 0)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
121 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
122 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
123 |
new String[]{"-XX:+AlwaysTenure", "-XX:MaxTenuringThreshold=16"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
124 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
125 |
new ExpectedTenuringFlags(false /* alwaysTenure */, false /* neverTenure */, 7, 16)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
126 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
127 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
128 |
new String[]{"-XX:MaxTenuringThreshold=0", "-XX:+NeverTenure"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
129 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
130 |
new ExpectedTenuringFlags(false /* alwaysTenure */, true /* neverTenure */, 7, 16)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
131 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
132 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
133 |
new String[]{"-XX:+NeverTenure", "-XX:MaxTenuringThreshold=0"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
134 |
false /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
135 |
new ExpectedTenuringFlags(true /* alwaysTenure */, false /* neverTenure */, 0, 0)); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
136 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
137 |
// Illegal cases |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
138 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
139 |
new String[]{"-XX:MaxTenuringThreshold=17"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
140 |
true /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
141 |
new ExpectedTenuringFlags()); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
142 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
143 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
144 |
new String[]{"-XX:InitialTenuringThreshold=16"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
145 |
true /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
146 |
new ExpectedTenuringFlags()); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
147 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
148 |
runTenuringFlagsConsistencyTest( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
149 |
new String[]{"-XX:InitialTenuringThreshold=17"}, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
150 |
true /* shouldFail */, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
151 |
new ExpectedTenuringFlags()); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
152 |
} |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
153 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
154 |
private static void runTenuringFlagsConsistencyTest(String[] tenuringFlags, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
155 |
boolean shouldFail, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
156 |
ExpectedTenuringFlags expectedFlags) throws Exception { |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
157 |
List<String> vmOpts = new ArrayList<>(); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
158 |
if (tenuringFlags.length > 0) { |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
159 |
Collections.addAll(vmOpts, tenuringFlags); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
160 |
} |
33144
c56850e328fc
8134995: [REDO] GC: implement ranges (optionally constraints) for those flags that have them missing
sangheki
parents:
32613
diff
changeset
|
161 |
Collections.addAll(vmOpts, "-XX:+UseParallelGC", "-XX:+PrintFlagsFinal", "-version"); |
23506
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
162 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
163 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()])); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
164 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
165 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
166 |
if (shouldFail) { |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
167 |
output.shouldHaveExitValue(1); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
168 |
} else { |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
169 |
output.shouldHaveExitValue(0); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
170 |
String stdout = output.getStdout(); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
171 |
checkTenuringFlagsConsistency(stdout, expectedFlags); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
172 |
} |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
173 |
} |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
174 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
175 |
private static void checkTenuringFlagsConsistency(String output, ExpectedTenuringFlags expectedFlags) { |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
176 |
if (expectedFlags.alwaysTenure != FlagsValue.getFlagBoolValue("AlwaysTenure", output)) { |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
177 |
throw new RuntimeException( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
178 |
"Actual flag AlwaysTenure " + FlagsValue.getFlagBoolValue("AlwaysTenure", output) + |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
179 |
" is not equal to expected flag AlwaysTenure " + expectedFlags.alwaysTenure); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
180 |
} |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
181 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
182 |
if (expectedFlags.neverTenure != FlagsValue.getFlagBoolValue("NeverTenure", output)) { |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
183 |
throw new RuntimeException( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
184 |
"Actual flag NeverTenure " + FlagsValue.getFlagBoolValue("NeverTenure", output) + |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
185 |
" is not equal to expected flag NeverTenure " + expectedFlags.neverTenure); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
186 |
} |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
187 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
188 |
if (expectedFlags.initialTenuringThreshold != FlagsValue.getFlagLongValue("InitialTenuringThreshold", output)) { |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
189 |
throw new RuntimeException( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
190 |
"Actual flag InitialTenuringThreshold " + FlagsValue.getFlagLongValue("InitialTenuringThreshold", output) + |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
191 |
" is not equal to expected flag InitialTenuringThreshold " + expectedFlags.initialTenuringThreshold); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
192 |
} |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
193 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
194 |
if (expectedFlags.maxTenuringThreshold != FlagsValue.getFlagLongValue("MaxTenuringThreshold", output)) { |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
195 |
throw new RuntimeException( |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
196 |
"Actual flag MaxTenuringThreshold " + FlagsValue.getFlagLongValue("MaxTenuringThreshold", output) + |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
197 |
" is not equal to expected flag MaxTenuringThreshold " + expectedFlags.maxTenuringThreshold); |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
198 |
} |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
199 |
} |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
200 |
} |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
201 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
202 |
class ExpectedTenuringFlags { |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
203 |
public boolean alwaysTenure; |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
204 |
public boolean neverTenure; |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
205 |
public long initialTenuringThreshold; |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
206 |
public long maxTenuringThreshold; |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
207 |
|
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
208 |
public ExpectedTenuringFlags(boolean alwaysTenure, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
209 |
boolean neverTenure, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
210 |
long initialTenuringThreshold, |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
211 |
long maxTenuringThreshold) { |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
212 |
this.alwaysTenure = alwaysTenure; |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
213 |
this.neverTenure = neverTenure; |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
214 |
this.initialTenuringThreshold = initialTenuringThreshold; |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
215 |
this.maxTenuringThreshold = maxTenuringThreshold; |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
216 |
} |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
217 |
public ExpectedTenuringFlags() {} |
9b98355e9060
6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency
tamao
parents:
diff
changeset
|
218 |
} |