|
1 /* |
|
2 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 */ |
|
23 |
|
24 /** |
|
25 * @test |
|
26 * @bug 8031323 |
|
27 * @summary Verify that object's alignment in eden space is not affected by |
|
28 * SurvivorAlignmentInBytes option. |
|
29 * @library /test/lib |
|
30 * @modules java.base/jdk.internal.misc |
|
31 * java.management |
|
32 * @build sun.hotspot.WhiteBox |
|
33 * @run main ClassFileInstaller sun.hotspot.WhiteBox |
|
34 * sun.hotspot.WhiteBox$WhiteBoxPermission |
|
35 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions |
|
36 * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m |
|
37 * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions |
|
38 * -XX:SurvivorAlignmentInBytes=32 -XX:-UseTLAB -XX:-ResizePLAB |
|
39 * -XX:OldSize=128m -XX:MaxHeapSize=192m |
|
40 * -XX:-ExplicitGCInvokesConcurrent |
|
41 * TestAllocationInEden 10m 9 EDEN |
|
42 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions |
|
43 * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m |
|
44 * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions |
|
45 * -XX:SurvivorAlignmentInBytes=32 -XX:-UseTLAB -XX:-ResizePLAB |
|
46 * -XX:OldSize=128m -XX:MaxHeapSize=192m |
|
47 * -XX:-ExplicitGCInvokesConcurrent |
|
48 * TestAllocationInEden 10m 47 EDEN |
|
49 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions |
|
50 * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m |
|
51 * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions |
|
52 * -XX:SurvivorAlignmentInBytes=64 -XX:-UseTLAB -XX:-ResizePLAB |
|
53 * -XX:OldSize=128m -XX:MaxHeapSize=192m |
|
54 * -XX:-ExplicitGCInvokesConcurrent |
|
55 * TestAllocationInEden 10m 9 EDEN |
|
56 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions |
|
57 * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m |
|
58 * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions |
|
59 * -XX:SurvivorAlignmentInBytes=64 -XX:-UseTLAB -XX:-ResizePLAB |
|
60 * -XX:OldSize=128m -XX:MaxHeapSize=192m |
|
61 * -XX:-ExplicitGCInvokesConcurrent |
|
62 * TestAllocationInEden 10m 87 EDEN |
|
63 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions |
|
64 * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m |
|
65 * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions |
|
66 * -XX:SurvivorAlignmentInBytes=128 -XX:-UseTLAB -XX:-ResizePLAB |
|
67 * -XX:OldSize=128m -XX:MaxHeapSize=192m |
|
68 * -XX:-ExplicitGCInvokesConcurrent |
|
69 * TestAllocationInEden 10m 9 EDEN |
|
70 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions |
|
71 * -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m |
|
72 * -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions |
|
73 * -XX:SurvivorAlignmentInBytes=128 -XX:-UseTLAB -XX:-ResizePLAB |
|
74 * -XX:OldSize=128m -XX:MaxHeapSize=192m |
|
75 * -XX:-ExplicitGCInvokesConcurrent |
|
76 * TestAllocationInEden 10m 147 EDEN |
|
77 */ |
|
78 public class TestAllocationInEden { |
|
79 public static void main(String args[]) { |
|
80 SurvivorAlignmentTestMain test |
|
81 = SurvivorAlignmentTestMain.fromArgs(args); |
|
82 System.out.println(test); |
|
83 |
|
84 long expectedMemoryUsage = test.getExpectedMemoryUsage(); |
|
85 test.baselineMemoryAllocation(); |
|
86 System.gc(); |
|
87 |
|
88 test.allocate(); |
|
89 |
|
90 test.verifyMemoryUsage(expectedMemoryUsage); |
|
91 } |
|
92 } |