Mercurial > hg > graal-compiler
annotate test/gc/arguments/TestSurvivorAlignmentInBytesOption.java @ 21512:d1baf7d5230a
GraphDecoder: add debug information to Invoke assertion
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Tue, 05 May 2015 17:56:23 +0200 |
parents | 75d8afb5d37a |
children |
rev | line source |
---|---|
20717
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
1 /* |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
4 * |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
8 * |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
13 * accompanied this code). |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
14 * |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
18 * |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
21 * questions. |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
22 */ |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
23 |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
24 import com.oracle.java.testlibrary.ExitCode; |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
25 import com.oracle.java.testlibrary.cli.CommandLineOptionTest; |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
26 |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
27 /** |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
28 * @test |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
29 * @bug 8031323 |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
30 * @summary Verify SurvivorAlignmentInBytes option processing. |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
31 * @library /testlibrary |
20718
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
32 * @requires vm.opt.SurvivorAlignmentInBytes == null |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
33 * & vm.opt.ObjectAlignmentInBytes == null |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
34 * & vm.opt.UnlockExperimentalVMOptions == null |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
35 * & (vm.opt.IgnoreUnrecognizedVMOptions == null |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
36 * | vm.opt.IgnoreUnrecognizedVMOptions == "false") |
20717
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
37 * @run main TestSurvivorAlignmentInBytesOption |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
38 */ |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
39 public class TestSurvivorAlignmentInBytesOption { |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
40 public static void main(String args[]) throws Throwable { |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
41 String optionName = "SurvivorAlignmentInBytes"; |
20718
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
42 String unlockExperimentalVMOpts = "UnlockExperimentalVMOptions"; |
20717
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
43 String optionIsExperimental |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
44 = CommandLineOptionTest.getExperimentalOptionErrorMessage( |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
45 optionName); |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
46 String valueIsTooSmall= ".*SurvivorAlignmentInBytes=.*must be greater" |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
47 + " than ObjectAlignmentInBytes.*"; |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
48 String mustBePowerOf2 = ".*SurvivorAlignmentInBytes=.*must be " |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
49 + "power of 2.*"; |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
50 |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
51 // Verify that without -XX:+UnlockExperimentalVMOptions usage of |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
52 // SurvivorAlignmentInBytes option will cause JVM startup failure |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
53 // with the warning message saying that that option is experimental. |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
54 CommandLineOptionTest.verifyJVMStartup( |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
55 new String[]{optionIsExperimental}, null, ExitCode.FAIL, false, |
20718
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
56 "-XX:-UnlockExperimentalVMOptions", |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
57 CommandLineOptionTest.prepareBooleanFlag( |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
58 unlockExperimentalVMOpts, false), |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
59 CommandLineOptionTest.prepareNumericFlag(optionName, 64)); |
20717
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
60 |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
61 // Verify that with -XX:+UnlockExperimentalVMOptions passed to JVM |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
62 // usage of SurvivorAlignmentInBytes option won't cause JVM startup |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
63 // failure. |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
64 CommandLineOptionTest.verifyJVMStartup( |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
65 null, new String[]{optionIsExperimental}, ExitCode.OK, false, |
20718
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
66 CommandLineOptionTest.prepareBooleanFlag( |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
67 unlockExperimentalVMOpts, true), |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
68 CommandLineOptionTest.prepareNumericFlag(optionName, 64)); |
20717
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
69 |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
70 // Verify that if specified SurvivorAlignmentInBytes is lower then |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
71 // ObjectAlignmentInBytes, then the JVM startup will fail with |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
72 // appropriate error message. |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
73 CommandLineOptionTest.verifyJVMStartup( |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
74 new String[]{valueIsTooSmall}, null, ExitCode.FAIL, false, |
20718
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
75 CommandLineOptionTest.prepareBooleanFlag( |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
76 unlockExperimentalVMOpts, true), |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
77 CommandLineOptionTest.prepareNumericFlag(optionName, 2)); |
20717
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
78 |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
79 // Verify that if specified SurvivorAlignmentInBytes value is not |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
80 // a power of 2 then the JVM startup will fail with appropriate error |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
81 // message. |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
82 CommandLineOptionTest.verifyJVMStartup( |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
83 new String[]{mustBePowerOf2}, null, ExitCode.FAIL, false, |
20718
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
84 CommandLineOptionTest.prepareBooleanFlag( |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
85 unlockExperimentalVMOpts, true), |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
86 CommandLineOptionTest.prepareNumericFlag(optionName, 127)); |
20717
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
87 |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
88 // Verify that if SurvivorAlignmentInBytes has correct value, then |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
89 // the JVM will be started without errors. |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
90 CommandLineOptionTest.verifyJVMStartup( |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
91 null, new String[]{".*SurvivorAlignmentInBytes.*"}, |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
92 ExitCode.OK, false, |
20718
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
93 CommandLineOptionTest.prepareBooleanFlag( |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
94 unlockExperimentalVMOpts, true), |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
95 CommandLineOptionTest.prepareNumericFlag(optionName, 128)); |
20717
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
96 |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
97 // Verify that we can setup different SurvivorAlignmentInBytes values. |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
98 for (int alignment = 32; alignment <= 128; alignment *= 2) { |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
99 CommandLineOptionTest.verifyOptionValue(optionName, |
20718
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
100 Integer.toString(alignment), |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
101 CommandLineOptionTest.prepareBooleanFlag( |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
102 unlockExperimentalVMOpts, true), |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
103 CommandLineOptionTest.prepareNumericFlag( |
75d8afb5d37a
8066143: [TESTBUG] New tests in gc/survivorAlignment/ fails
fzhinkin
parents:
20717
diff
changeset
|
104 optionName, alignment)); |
20717
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
105 } |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
106 } |
4b7c96fba3d8
8037968: Add tests on alignment of objects copied to survivor space
fzhinkin
parents:
diff
changeset
|
107 } |