Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/SpecializationGroupingTest.java @ 11800:a28f24553ffa
Improvements to recent unsafe cast node changes
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Wed, 25 Sep 2013 17:40:58 -0700 |
parents | 2aac62d79af4 |
children | 85dcc7f59c34 |
rev | line source |
---|---|
11195
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 /* |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 * |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 * |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 * accompanied this code). |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 * |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 * |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
21 * questions. |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
22 */ |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
23 package com.oracle.truffle.api.dsl.test; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
24 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
25 import org.junit.*; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
26 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
27 import com.oracle.truffle.api.*; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
28 import com.oracle.truffle.api.dsl.*; |
11470
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
29 import com.oracle.truffle.api.dsl.test.SpecializationGroupingTestFactory.TestElseConnectionBug1Factory; |
11481
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
30 import com.oracle.truffle.api.dsl.test.SpecializationGroupingTestFactory.TestElseConnectionBug2Factory; |
11195
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
31 import com.oracle.truffle.api.dsl.test.SpecializationGroupingTestFactory.TestGroupingFactory; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
32 import com.oracle.truffle.api.dsl.test.TypeSystemTest.SimpleTypes; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
33 import com.oracle.truffle.api.dsl.test.TypeSystemTest.TestRootNode; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
34 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode; |
11470
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
35 import com.oracle.truffle.api.frame.*; |
11195
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
36 import com.oracle.truffle.api.nodes.*; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
37 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
38 /** |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
39 * Tests execution counts of guards. While we do not make guarantees for guard invocation except for |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
40 * their execution order our implementation reduces the calls to guards as much as possible. |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
41 */ |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
42 public class SpecializationGroupingTest { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
43 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
44 @Test |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
45 public void testGrouping() { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
46 MockAssumption a1 = new MockAssumption(true); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
47 MockAssumption a2 = new MockAssumption(false); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
48 MockAssumption a3 = new MockAssumption(true); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
49 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
50 TestRootNode<TestGrouping> root = TestHelper.createRoot(TestGroupingFactory.getInstance(), a1, a2, a3); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
51 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
52 SimpleTypes.intCast = 0; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
53 SimpleTypes.intCheck = 0; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
54 TestGrouping.true1 = 0; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
55 TestGrouping.false1 = 0; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
56 TestGrouping.true2 = 0; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
57 TestGrouping.false2 = 0; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
58 TestGrouping.true3 = 0; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
59 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
60 Assert.assertEquals(42, TestHelper.executeWith(root, 21, 21)); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
61 Assert.assertEquals(1, TestGrouping.true1); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
62 Assert.assertEquals(1, TestGrouping.false1); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
63 Assert.assertEquals(1, TestGrouping.true2); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
64 Assert.assertEquals(1, TestGrouping.false2); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
65 Assert.assertEquals(1, TestGrouping.true3); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
66 Assert.assertEquals(2, SimpleTypes.intCheck); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
67 Assert.assertEquals(2, SimpleTypes.intCast); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
68 Assert.assertEquals(1, a1.checked); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
69 Assert.assertEquals(1, a2.checked); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
70 Assert.assertEquals(1, a3.checked); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
71 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
72 Assert.assertEquals(42, TestHelper.executeWith(root, 21, 21)); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
73 Assert.assertEquals(2, TestGrouping.true1); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
74 Assert.assertEquals(1, TestGrouping.false1); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
75 Assert.assertEquals(2, TestGrouping.true2); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
76 Assert.assertEquals(2, TestGrouping.false2); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
77 Assert.assertEquals(2, TestGrouping.true3); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
78 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
79 Assert.assertEquals(2, a1.checked); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
80 Assert.assertEquals(1, a2.checked); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
81 Assert.assertEquals(2, a3.checked); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
82 Assert.assertEquals(2, SimpleTypes.intCheck); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
83 Assert.assertEquals(2, SimpleTypes.intCast); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
84 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
85 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
86 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
87 @SuppressWarnings("unused") |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
88 @NodeChildren({@NodeChild, @NodeChild}) |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
89 @NodeAssumptions({"a1", "a2", "a3"}) |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
90 public abstract static class TestGrouping extends ValueNode { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
91 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
92 private static int true1; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
93 private static int false1; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
94 private static int true2; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
95 private static int false2; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
96 private static int true3; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
97 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
98 protected boolean true1(int value) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
99 true1++; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
100 return true; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
101 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
102 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
103 protected boolean false1(int value, int value2) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
104 false1++; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
105 return false; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
106 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
107 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
108 protected boolean true2(int value) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
109 true2++; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
110 return true; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
111 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
112 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
113 protected boolean false2(int value) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
114 false2++; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
115 return false; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
116 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
117 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
118 protected boolean true3(int value) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
119 true3++; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
120 return true; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
121 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
122 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
123 @Specialization(order = 1) |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
124 public int fail(int value1, String value2) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
125 throw new AssertionError(); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
126 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
127 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
128 @Specialization(order = 2, guards = {"true1", "false1"}) |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
129 public int fail1(int value1, int value2) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
130 throw new AssertionError(); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
131 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
132 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
133 @Specialization(order = 3, guards = {"true1", "true2"}, assumptions = {"a1", "a2"}) |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
134 public int fail2(int value1, int value2) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
135 throw new AssertionError(); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
136 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
137 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
138 @Specialization(order = 4, guards = {"true1", "true2"}, assumptions = {"a1", "a3"}, rewriteOn = RuntimeException.class) |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
139 public int throwRewrite(int value1, int value2) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
140 throw new RuntimeException(); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
141 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
142 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
143 @Specialization(order = 5, guards = {"true1", "true2", "false2"}, assumptions = {"a1", "a3"}) |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
144 public int fail4(int value1, int value2) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
145 throw new AssertionError(); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
146 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
147 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
148 @Specialization(order = 6, guards = {"true1", "true2", "!false2", "!true3"}, assumptions = {"a1", "a3"}) |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
149 public int fail5(int value1, int value2) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
150 throw new AssertionError(); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
151 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
152 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
153 @Specialization(order = 7, guards = {"true1", "true2", "!false2", "true3"}, assumptions = {"a1", "a3"}) |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
154 public int success(int value1, int value2) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
155 return value1 + value2; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
156 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
157 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
158 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
159 |
11470
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
160 @Test |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
161 public void testElseConnectionBug1() { |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
162 CallTarget target = TestHelper.createCallTarget(TestElseConnectionBug1Factory.create(new GenericInt())); |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
163 Assert.assertEquals(42, target.call()); |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
164 } |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
165 |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
166 @SuppressWarnings("unused") |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
167 @NodeChild(value = "genericChild", type = GenericInt.class) |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
168 public abstract static class TestElseConnectionBug1 extends ValueNode { |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
169 |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
170 @Specialization(order = 1, rewriteOn = {SlowPathException.class}, guards = "isInitialized") |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
171 public int doInteger(int value) throws SlowPathException { |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
172 throw new SlowPathException(); |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
173 } |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
174 |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
175 @Specialization(order = 3, guards = "isInitialized") |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
176 public int doObject(int value) { |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
177 return value == 42 ? value : 0; |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
178 } |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
179 |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
180 @Specialization(order = 4, guards = "!isInitialized") |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
181 public Object doUninitialized(int value) { |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
182 throw new AssertionError(); |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
183 } |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
184 |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
185 boolean isInitialized(int value) { |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
186 return true; |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
187 } |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
188 } |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
189 |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
190 public static final class GenericInt extends ValueNode { |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
191 |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
192 @Override |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
193 public Object execute(VirtualFrame frame) { |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
194 return executeInt(frame); |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
195 } |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
196 |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
197 @Override |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
198 public int executeInt(VirtualFrame frame) { |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
199 return 42; |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
200 } |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
201 |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
202 } |
b010fd3de42d
Truffle-DSL: added a test that covers wrong a wrong else connection bug.
Christian Humer <christian.humer@gmail.com>
parents:
11195
diff
changeset
|
203 |
11481
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
204 @Test |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
205 public void testElseConnectionBug2() { |
11484
2aac62d79af4
Truffle-DSL: fixed bug if node class was used also as child.
Christian Humer <christian.humer@gmail.com>
parents:
11481
diff
changeset
|
206 TestHelper.assertRuns(TestElseConnectionBug2Factory.getInstance(), 42, 42); |
11481
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
207 } |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
208 |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
209 @SuppressWarnings("unused") |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
210 @NodeChild |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
211 public abstract static class TestElseConnectionBug2 extends ValueNode { |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
212 |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
213 @Specialization(order = 2, guards = "guard0") |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
214 public int doGuard0(int value) { |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
215 throw new AssertionError(); |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
216 } |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
217 |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
218 @Specialization(order = 3, guards = "guard1") |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
219 public int doGuard1(int value) { |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
220 throw new AssertionError(); |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
221 } |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
222 |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
223 @Specialization(order = 4, guards = "!guard0") |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
224 public int doUninitialized(int value) { |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
225 return value; |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
226 } |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
227 |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
228 boolean guard0(int value) { |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
229 return false; |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
230 } |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
231 |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
232 boolean guard1(int value) { |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
233 return false; |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
234 } |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
235 } |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
236 |
11195
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
237 private static class MockAssumption implements Assumption { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
238 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
239 int checked; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
240 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
241 private final boolean valid; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
242 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
243 public MockAssumption(boolean valid) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
244 this.valid = valid; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
245 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
246 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
247 public void check() throws InvalidAssumptionException { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
248 checked++; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
249 if (!valid) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
250 throw new InvalidAssumptionException(); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
251 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
252 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
253 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
254 public boolean isValid() { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
255 checked++; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
256 return valid; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
257 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
258 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
259 public void invalidate() { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
260 throw new UnsupportedOperationException(); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
261 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
262 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
263 public String getName() { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
264 throw new UnsupportedOperationException(); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
265 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
266 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
267 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
268 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
269 } |