Mercurial > hg > truffle
annotate test/gc/arguments/TestDynMaxHeapFreeRatio.java @ 20543:e7d0505c8a30
8059758: Footprint regressions with JDK-8038423
Summary: Changes in JDK-8038423 always initialize (zero out) virtual memory used for auxiliary data structures. This causes a footprint regression for G1 in startup benchmarks. This is because they do not touch that memory at all, so the operating system does not actually commit these pages. The fix is to, if the initialization value of the data structures matches the default value of just committed memory (=0), do not do anything.
Reviewed-by: jwilhelm, brutisso
author | tschatzl |
---|---|
date | Fri, 10 Oct 2014 15:51:58 +0200 |
parents | e2976043eac3 |
children |
rev | line source |
---|---|
17751
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
1 /* |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
4 * |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
8 * |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
13 * accompanied this code). |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
14 * |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
18 * |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
21 * questions. |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
22 */ |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
23 |
20238
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
24 import static com.oracle.java.testlibrary.Asserts.assertEQ; |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
25 import static com.oracle.java.testlibrary.Asserts.assertFalse; |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
26 import static com.oracle.java.testlibrary.Asserts.assertTrue; |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
27 import com.oracle.java.testlibrary.DynamicVMOption; |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
28 |
17751
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
29 /** |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
30 * @test TestDynMaxHeapFreeRatio |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
31 * @bug 8028391 |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
32 * @summary Verify that MaxHeapFreeRatio flag is manageable |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
33 * @library /testlibrary |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
34 * @run main TestDynMaxHeapFreeRatio |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
35 * @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 TestDynMaxHeapFreeRatio |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
36 * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=50 -XX:-UseAdaptiveSizePolicy TestDynMaxHeapFreeRatio |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
37 * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=50 TestDynMaxHeapFreeRatio |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
38 * @run main/othervm -XX:MinHeapFreeRatio=51 -XX:MaxHeapFreeRatio=52 TestDynMaxHeapFreeRatio |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
39 * @run main/othervm -XX:MinHeapFreeRatio=75 -XX:MaxHeapFreeRatio=100 TestDynMaxHeapFreeRatio |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
40 */ |
20238
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
41 public class TestDynMaxHeapFreeRatio { |
17751
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
42 |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
43 public static void main(String args[]) throws Exception { |
20238
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
44 |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
45 // low boundary value |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
46 int minValue = DynamicVMOption.getInt("MinHeapFreeRatio"); |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
47 System.out.println("MinHeapFreeRatio= " + minValue); |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
48 |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
49 String badValues[] = { |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
50 null, |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
51 "", |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
52 "not a number", |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
53 "8.5", "-0.01", |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
54 Integer.toString(Integer.MIN_VALUE), |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
55 Integer.toString(Integer.MAX_VALUE), |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
56 Integer.toString(minValue - 1), |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
57 "-1024", "-1", "101", "1997" |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
58 }; |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
59 |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
60 String goodValues[] = { |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
61 Integer.toString(minValue), |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
62 Integer.toString(minValue + 1), |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
63 Integer.toString((minValue + 100) / 2), |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
64 "99", "100" |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
65 }; |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
66 |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
67 DynamicVMOption option = new DynamicVMOption("MaxHeapFreeRatio"); |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
68 |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
69 assertTrue(option.isWriteable(), "Option " + option.name |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
70 + " is expected to be writable"); |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
71 |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
72 for (String v : badValues) { |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
73 assertFalse(option.isValidValue(v), |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
74 "'" + v + "' is expected to be illegal for flag " + option.name); |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
75 } |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
76 for (String v : goodValues) { |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
77 option.setValue(v); |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
78 String newValue = option.getValue(); |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
79 assertEQ(v, newValue); |
e2976043eac3
8039489: Refactor test framework for dynamic VM options
dfazunen
parents:
17751
diff
changeset
|
80 } |
17751
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
81 } |
3b4e1b5c13a0
8037510: CMM Testing: Min/MaxHeapFreeRatio flags should be manageable through the API
jwilhelm
parents:
diff
changeset
|
82 } |