Mercurial > hg > graal-compiler
comparison test/compiler/tiered/CompLevelsTest.java @ 12957:19c5a042b0b3
8026414: [TESTBUG] Tests for Tiered/NonTiered levels
Reviewed-by: twisti, iveresov
author | iignatyev |
---|---|
date | Sat, 19 Oct 2013 21:54:44 +0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
12956:3213ba4d3dff | 12957:19c5a042b0b3 |
---|---|
1 /* | |
2 * Copyright (c) 2013, 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 * Abstract class for testing of used compilation levels correctness. | |
26 * | |
27 * @author igor.ignatyev@oracle.com | |
28 */ | |
29 public abstract class CompLevelsTest extends CompilerWhiteBoxTest { | |
30 protected CompLevelsTest(TestCase testCase) { | |
31 super(testCase); | |
32 // to prevent inlining of #method | |
33 WHITE_BOX.testSetDontInlineMethod(method, true); | |
34 } | |
35 | |
36 /** | |
37 * Checks that level is available. | |
38 * @param compLevel level to check | |
39 */ | |
40 protected void testAvailableLevel(int compLevel, int bci) { | |
41 if (IS_VERBOSE) { | |
42 System.out.printf("testAvailableLevel(level = %d, bci = %d)%n", | |
43 compLevel, bci); | |
44 } | |
45 WHITE_BOX.enqueueMethodForCompilation(method, compLevel, bci); | |
46 checkCompiled(); | |
47 checkLevel(compLevel, getCompLevel()); | |
48 deoptimize(); | |
49 } | |
50 | |
51 /** | |
52 * Checks that level is unavailable. | |
53 * @param compLevel level to check | |
54 */ | |
55 protected void testUnavailableLevel(int compLevel, int bci) { | |
56 if (IS_VERBOSE) { | |
57 System.out.printf("testUnavailableLevel(level = %d, bci = %d)%n", | |
58 compLevel, bci); | |
59 } | |
60 WHITE_BOX.enqueueMethodForCompilation(method, compLevel, bci); | |
61 checkNotCompiled(); | |
62 } | |
63 | |
64 /** | |
65 * Checks validity of compilation level. | |
66 * @param expected expected level | |
67 * @param actual actually level | |
68 */ | |
69 protected void checkLevel(int expected, int actual) { | |
70 if (expected != actual) { | |
71 throw new RuntimeException("expected[" + expected + "] != actual[" | |
72 + actual + "]"); | |
73 } | |
74 } | |
75 } |