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