Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/SpecializationGroupingTest.java @ 19124:a5f47cb74b1b
Merge.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Wed, 04 Feb 2015 13:51:17 +0100 |
parents | a665483c3881 |
children | 08aa0372dad4 |
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 |
12401
85dcc7f59c34
Truffle-DSL: fixed incorrect else guard connections for executeAndSpecialize.
Christian Humer <christian.humer@gmail.com>
parents:
11484
diff
changeset
|
40 * their execution order our implementation reduces the calls to guards as much as possible for the |
85dcc7f59c34
Truffle-DSL: fixed incorrect else guard connections for executeAndSpecialize.
Christian Humer <christian.humer@gmail.com>
parents:
11484
diff
changeset
|
41 * generic case. |
11195
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
42 */ |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
43 public class SpecializationGroupingTest { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
44 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
45 @Test |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
46 public void testGrouping() { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
47 MockAssumption a1 = new MockAssumption(true); |
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 |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
16756
diff
changeset
|
50 TestRootNode<TestGrouping> root = TestHelper.createRoot(TestGroupingFactory.getInstance(), a1, a3); |
11195
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)); |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
61 Assert.assertEquals(4, TestGrouping.true1); |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
62 Assert.assertEquals(0, TestGrouping.false1); |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
63 Assert.assertEquals(4, TestGrouping.true2); |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
64 Assert.assertEquals(5, TestGrouping.false2); |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
65 Assert.assertEquals(5, TestGrouping.true3); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
16756
diff
changeset
|
66 Assert.assertEquals(10, SimpleTypes.intCheck); |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
67 Assert.assertEquals(8, SimpleTypes.intCast); |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
68 Assert.assertEquals(4, a1.checked); |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
69 Assert.assertEquals(4, a3.checked); |
11195
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
70 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
71 Assert.assertEquals(42, TestHelper.executeWith(root, 21, 21)); |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
72 Assert.assertEquals(5, TestGrouping.true1); |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
73 Assert.assertEquals(0, TestGrouping.false1); |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
74 Assert.assertEquals(5, TestGrouping.true2); |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
75 Assert.assertEquals(6, TestGrouping.false2); |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
76 Assert.assertEquals(6, TestGrouping.true3); |
11195
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
77 |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
78 Assert.assertEquals(5, a1.checked); |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
79 Assert.assertEquals(5, a3.checked); |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
16756
diff
changeset
|
80 Assert.assertEquals(10, SimpleTypes.intCheck); |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
81 Assert.assertEquals(8, SimpleTypes.intCast); |
11195
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
82 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
83 } |
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 @SuppressWarnings("unused") |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
86 @NodeChildren({@NodeChild, @NodeChild}) |
18761
a665483c3881
Truffle-DSL: new node layout implementation.
Christian Humer <christian.humer@gmail.com>
parents:
16756
diff
changeset
|
87 @NodeAssumptions({"a1", "a3"}) |
11195
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
88 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
|
89 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
90 private static int true1; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
91 private static int false1; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
92 private static int true2; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
93 private static int false2; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
94 private static int true3; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
95 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
96 protected boolean true1(int value) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
97 true1++; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
98 return true; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
99 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
100 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
101 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
|
102 false1++; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
103 return false; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
104 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
105 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
106 protected boolean true2(int value) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
107 true2++; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
108 return true; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
109 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
110 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
111 protected boolean false2(int value) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
112 false2++; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
113 return false; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
114 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
115 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
116 protected boolean true3(int value) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
117 true3++; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
118 return true; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
119 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
120 |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
121 @Specialization |
11195
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
122 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
|
123 throw new AssertionError(); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
124 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
125 |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
126 @Specialization(guards = {"true1", "true2", "!false2", "true3"}, assumptions = {"a1", "a3"}, rewriteOn = RuntimeException.class) |
11195
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
127 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
|
128 throw new RuntimeException(); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
129 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
130 |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
131 @Specialization(guards = {"true1", "true2", "!false2", "true3"}, contains = "throwRewrite", assumptions = {"a1", "a3"}) |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
132 public int success(int value1, int value2) { |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
133 return value1 + value2; |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
134 } |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
135 |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
136 @Specialization(guards = {"true1", "true2", "!false2", "!true3"}, assumptions = {"a1", "a3"}) |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
137 public int fail5(int value1, int value2) { |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
138 throw new AssertionError(); |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
139 } |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
140 |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
141 @Specialization(guards = {"true1", "true2", "false2"}, assumptions = {"a1", "a3"}) |
11195
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
142 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
|
143 throw new AssertionError(); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
144 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
145 |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
146 @Specialization(guards = {"true1", "true2"}, assumptions = {"a1", "a3"}) |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
147 public int fail2break(int value1, int value2) { |
11195
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
148 throw new AssertionError(); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
149 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
150 |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
151 @Specialization(guards = {"true1", "false1"}) |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
152 public int fail1(int value1, int value2) { |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
153 throw new AssertionError(); |
11195
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
154 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
155 |
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 |
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
|
158 @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
|
159 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
|
160 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
|
161 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
|
162 } |
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 |
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 @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
|
165 @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
|
166 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
|
167 |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
168 @Specialization(rewriteOn = {SlowPathException.class}, guards = "isInitialized") |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
169 public int do1(int value) throws SlowPathException { |
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
|
170 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
|
171 } |
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 |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
173 @Specialization(contains = "do1", guards = "isInitialized") |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
174 public int do2(int value) { |
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
|
175 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
|
176 } |
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 |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
178 @Specialization(guards = "!isInitialized") |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
179 public Object do3(int value) { |
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
|
180 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
|
181 } |
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 |
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 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
|
184 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
|
185 } |
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 } |
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 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
|
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 @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
|
191 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
|
192 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
|
193 } |
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 |
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 @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
|
196 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
|
197 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
|
198 } |
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 |
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 |
11481
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
202 @Test |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
203 public void testElseConnectionBug2() { |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
204 TestHelper.assertRuns(TestElseConnectionBug2Factory.getInstance(), new Object[]{42}, new Object[]{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
|
205 } |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
206 |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
207 @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
|
208 @NodeChild |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
209 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
|
210 |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
211 @Specialization(guards = "guard0") |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
212 public int do1(int value) { |
11481
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
213 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
|
214 } |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
215 |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
216 @Specialization(guards = "guard1") |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
217 public int do2(int value) { |
11481
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
218 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
|
219 } |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
220 |
16756
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
221 @Specialization(guards = "!guard0") |
5148aab962af
Truffle-DSL: updated tests for the new generation layout.
Christian Humer <christian.humer@gmail.com>
parents:
12401
diff
changeset
|
222 public int do3(int value) { |
11481
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
223 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
|
224 } |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
225 |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
226 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
|
227 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
|
228 } |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
229 |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
230 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
|
231 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
|
232 } |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
233 } |
a317acdd5f2c
Truffle-DSL: fixed a bug in else connections of generic generated methods.
Christian Humer <christian.humer@gmail.com>
parents:
11470
diff
changeset
|
234 |
11195
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
235 private static class MockAssumption implements Assumption { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
236 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
237 int checked; |
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 private final boolean valid; |
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 public MockAssumption(boolean valid) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
242 this.valid = valid; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
243 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
244 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
245 public void check() throws InvalidAssumptionException { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
246 checked++; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
247 if (!valid) { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
248 throw new InvalidAssumptionException(); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
249 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
250 } |
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 public boolean isValid() { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
253 checked++; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
254 return valid; |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
255 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
256 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
257 public void invalidate() { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
258 throw new UnsupportedOperationException(); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
259 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
260 |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
261 public String getName() { |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
262 throw new UnsupportedOperationException(); |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
263 } |
4f52b08bd2f9
Truffle-DSL: Implemented specialization grouping for generic cases.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
264 |
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 } |