Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/CodeFormatTest.java @ 21038:6868faf48f02
Conditional Elimination: tryProofCondition: return true if ShortCircuitOrNode could be proven
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Sat, 18 Apr 2015 19:56:22 +0200 |
parents | 08aa0372dad4 |
children |
rev | line source |
---|---|
11182
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 /* |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 * |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 * |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 * accompanied this code). |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 * |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 * |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
21 * questions. |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
22 */ |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
23 package com.oracle.truffle.api.dsl.test; |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
24 |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
25 import org.junit.*; |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
26 |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
27 import com.oracle.truffle.api.dsl.*; |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
28 import com.oracle.truffle.api.dsl.test.CodeFormatTestFactory.LineWrappingTestFactory; |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
29 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode; |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
30 |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
11182
diff
changeset
|
31 /** |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
11182
diff
changeset
|
32 * Tests the generated code compiles without warnings for unusual large guard names. |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
11182
diff
changeset
|
33 */ |
11182
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
34 public class CodeFormatTest { |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
35 |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
36 @Test |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
37 public void test() { |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
38 Assert.assertEquals(42, TestHelper.createCallTarget(LineWrappingTestFactory.create()).call()); |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
39 } |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
40 |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
41 abstract static class LineWrappingTest extends ValueNode { |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
42 |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
43 public LineWrappingTest() { |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
44 } |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
45 |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
46 protected static boolean guardWithaReeeeeeeeaaaaaaaaaaalllllllllyyyyyyyyLLLLLLLLLLLLLoooooooonnnnnnngggggggName1() { |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
47 return true; |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
48 } |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
49 |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
50 protected static boolean guardWithaReeeeeeeeaaaaaaaaaaalllllllllyyyyyyyyLLLLLLLLLLLLLoooooooonnnnnnngggggggName2() { |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
51 return true; |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
52 } |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
53 |
19283
08aa0372dad4
Truffle-DSL: implement new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
16756
diff
changeset
|
54 @Specialization(guards = {"guardWithaReeeeeeeeaaaaaaaaaaalllllllllyyyyyyyyLLLLLLLLLLLLLoooooooonnnnnnngggggggName1()", |
08aa0372dad4
Truffle-DSL: implement new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
16756
diff
changeset
|
55 "guardWithaReeeeeeeeaaaaaaaaaaalllllllllyyyyyyyyLLLLLLLLLLLLLoooooooonnnnnnngggggggName2()", |
08aa0372dad4
Truffle-DSL: implement new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
16756
diff
changeset
|
56 "guardWithaReeeeeeeeaaaaaaaaaaalllllllllyyyyyyyyLLLLLLLLLLLLLoooooooonnnnnnngggggggName1()", |
08aa0372dad4
Truffle-DSL: implement new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
16756
diff
changeset
|
57 "guardWithaReeeeeeeeaaaaaaaaaaalllllllllyyyyyyyyLLLLLLLLLLLLLoooooooonnnnnnngggggggName2()", |
08aa0372dad4
Truffle-DSL: implement new guard expression syntax.
Christian Humer <christian.humer@gmail.com>
parents:
16756
diff
changeset
|
58 "guardWithaReeeeeeeeaaaaaaaaaaalllllllllyyyyyyyyLLLLLLLLLLLLLoooooooonnnnnnngggggggName1()"}) |
11182
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
59 public int execute() { |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
60 return 42; |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
61 } |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
62 } |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
63 |
fa65fc74eb76
Truffle-DSL: Added test for string-line wrapping (GRAAL-331 #comment added testcase)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
64 } |