Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EAMergingTest.java @ 12622:f40b8d0d9dcb
PEA: more tests, common base class for tests
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Mon, 28 Oct 2013 15:25:27 +0100 |
parents | |
children | 0774f3303c2e |
rev | line source |
---|---|
12622
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
1 /* |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
4 * |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
8 * |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
14 * |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
18 * |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
21 * questions. |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
22 */ |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
23 package com.oracle.graal.compiler.test.ea; |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
24 |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
25 import static org.junit.Assert.*; |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
26 |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
27 import org.junit.*; |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
28 |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
29 import com.oracle.graal.nodes.*; |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
30 |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
31 public class EAMergingTest extends EATestBase { |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
32 |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
33 @Test |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
34 public void testSimpleMerge() { |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
35 testEscapeAnalysis("simpleMergeSnippet", null, false); |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
36 assertTrue(returnNode.result() instanceof PhiNode); |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
37 PhiNode phi = (PhiNode) returnNode.result(); |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
38 assertTrue(phi.valueAt(0) instanceof LocalNode); |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
39 assertTrue(phi.valueAt(1) instanceof LocalNode); |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
40 } |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
41 |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
42 public static int simpleMergeSnippet(boolean b, int u, int v) { |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
43 TestClassInt obj; |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
44 if (b) { |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
45 obj = new TestClassInt(u, 0); |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
46 notInlineable(); |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
47 } else { |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
48 obj = new TestClassInt(v, 0); |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
49 notInlineable(); |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
50 } |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
51 return obj.x; |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
52 } |
f40b8d0d9dcb
PEA: more tests, common base class for tests
Lukas Stadler <lukas.stadler@jku.at>
parents:
diff
changeset
|
53 } |